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,135 @@
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 { CellType, FORMULA_RESULT_TYPE, FORMULA_COLUMN_TYPES } from 'dtable-store';
8
+ import BaseSettings from '../public-setting/base-settings';
9
+ import ColumnSettings from '../public-setting/column-settings';
10
+ import SummarySettings from './summary-settings';
11
+ import MapStyleSetting from './style-setting/map-setting';
12
+ var WordMapSettings = /*#__PURE__*/function (_Component) {
13
+ _inherits(WordMapSettings, _Component);
14
+ var _super = _createSuper(WordMapSettings);
15
+ function WordMapSettings(props) {
16
+ var _this;
17
+ _classCallCheck(this, WordMapSettings);
18
+ _this = _super.call(this, props);
19
+ _this.getColumns = function (columns) {
20
+ var geoColumns = columns.filter(function (column) {
21
+ var type = column.type,
22
+ data = column.data;
23
+ if (type === CellType.TEXT) return true;
24
+ if (type === CellType.GEOLOCATION) {
25
+ var _ref = data || {},
26
+ geo_format = _ref.geo_format;
27
+ if (geo_format === 'country_region') {
28
+ return true;
29
+ }
30
+ }
31
+ if (FORMULA_COLUMN_TYPES.includes(type)) {
32
+ var _data = column.data;
33
+ var _ref2 = _data || {},
34
+ result_type = _ref2.result_type,
35
+ array_type = _ref2.array_type,
36
+ array_data = _ref2.array_data;
37
+ if (result_type !== FORMULA_RESULT_TYPE.ARRAY || array_type !== CellType.GEOLOCATION) {
38
+ return false;
39
+ }
40
+ var _ref3 = array_data || {},
41
+ _geo_format = _ref3.geo_format;
42
+ if (_geo_format === 'country_region') {
43
+ return true;
44
+ }
45
+ }
46
+ return false;
47
+ });
48
+ return geoColumns;
49
+ };
50
+ _this.getSelectedTextColumnOption = function () {
51
+ return _this.textColumnsOptions.find(function (option) {
52
+ return option.value.key === _this.props.statItem.column;
53
+ });
54
+ };
55
+ _this.onSelectTextColumn = function (option) {
56
+ var column = _this.props.statItem.column;
57
+ var new_column = option.value.key;
58
+ if (new_column === column) return;
59
+ _this.props.updateStatItem(Object.assign({}, _this.props.statItem, {
60
+ column: new_column
61
+ }));
62
+ };
63
+ var getColumnsOptions = props.getColumnsOptions,
64
+ _columns = props.columns;
65
+ var textColumns = _this.getColumns(_columns);
66
+ _this.textColumnsOptions = getColumnsOptions(textColumns);
67
+ return _this;
68
+ }
69
+ _createClass(WordMapSettings, [{
70
+ key: "componentWillReceiveProps",
71
+ value: function componentWillReceiveProps(nextProps) {
72
+ if (nextProps.selectedTableId !== this.props.selectedTableId) {
73
+ var getColumnsOptions = nextProps.getColumnsOptions,
74
+ columns = nextProps.columns;
75
+ var textColumns = this.getColumns(columns);
76
+ this.textColumnsOptions = getColumnsOptions(textColumns);
77
+ }
78
+ }
79
+ }, {
80
+ key: "render",
81
+ value: function render() {
82
+ var _this$props = this.props,
83
+ getTables = _this$props.getTables,
84
+ getViews = _this$props.getViews,
85
+ settingType = _this$props.settingType,
86
+ selectedTableId = _this$props.selectedTableId,
87
+ statItem = _this$props.statItem,
88
+ getColumnsOptions = _this$props.getColumnsOptions,
89
+ numericColumns = _this$props.numericColumns;
90
+ var selectedTextColumnOption = this.getSelectedTextColumnOption();
91
+ var selectedViewId = statItem.view_id;
92
+ if (settingType === 'style') {
93
+ return /*#__PURE__*/React.createElement(MapStyleSetting, {
94
+ statItem: statItem,
95
+ currentColor: statItem.data_color,
96
+ onChangeColor: this.props.onChangeColor,
97
+ updateStatItem: this.props.updateStatItem
98
+ });
99
+ }
100
+ return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(BaseSettings, {
101
+ statItem: statItem,
102
+ selectedTableId: selectedTableId,
103
+ selectedViewId: selectedViewId,
104
+ getTables: getTables,
105
+ getViews: getViews,
106
+ getTableById: this.props.getTableById,
107
+ updateStatItem: this.props.updateStatItem
108
+ }), /*#__PURE__*/React.createElement("div", {
109
+ className: "statistic-chart-parameter-divider"
110
+ }), /*#__PURE__*/React.createElement("div", {
111
+ className: "statistic-chart-parameter-item"
112
+ }, /*#__PURE__*/React.createElement("label", null, intl.get('Location_field')), /*#__PURE__*/React.createElement(ColumnSettings, {
113
+ columnsOptions: this.textColumnsOptions,
114
+ selectedColumnOption: selectedTextColumnOption,
115
+ onChangeSelectedColumn: this.onSelectTextColumn
116
+ })), /*#__PURE__*/React.createElement("div", {
117
+ className: "statistic-chart-parameter-divider"
118
+ }), /*#__PURE__*/React.createElement(SummarySettings, {
119
+ label: intl.get('Summary_method'),
120
+ statItem: statItem,
121
+ selectedTableId: selectedTableId,
122
+ numericColumns: numericColumns,
123
+ summaryType: statItem.summary_type,
124
+ summaryMethod: statItem.summary_method,
125
+ summaryColumn: statItem.summary_column,
126
+ getColumnsOptions: getColumnsOptions,
127
+ onChangeSummaryType: this.props.onChangeSummaryType,
128
+ onSelectSummaryColumn: this.props.onSelectSummaryColumn,
129
+ onSelectSummaryMethod: this.props.onSelectSummaryMethod
130
+ }));
131
+ }
132
+ }]);
133
+ return WordMapSettings;
134
+ }(Component);
135
+ export default WordMapSettings;
@@ -0,0 +1,156 @@
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 DataSort from '../public-setting/data-sort-setting';
9
+ import BarChartStyle from './style-setting/bar-chart-style-setting';
10
+ import GroupbySettings from './groupby-settings';
11
+ import YAxisGroupSettings from './y-axis-group-settings';
12
+ import { GROUPBY_TYPE, STAT_TYPE } from '../../../constants';
13
+ var AdvanceBarChartSettings = /*#__PURE__*/function (_Component) {
14
+ _inherits(AdvanceBarChartSettings, _Component);
15
+ var _super = _createSuper(AdvanceBarChartSettings);
16
+ function AdvanceBarChartSettings() {
17
+ var _this;
18
+ _classCallCheck(this, AdvanceBarChartSettings);
19
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
20
+ args[_key] = arguments[_key];
21
+ }
22
+ _this = _super.call.apply(_super, [this].concat(args));
23
+ _this.onSelectGroupbyColumn = function (type, groupbyColumnKey, groupbyDateGranularity, groupbyGeolocationGranularity) {
24
+ var updated = {
25
+ x_axis_column_key: groupbyColumnKey,
26
+ x_axis_date_granularity: groupbyDateGranularity,
27
+ x_axis_geolocation_granularity: groupbyGeolocationGranularity
28
+ };
29
+ _this.props.updateStatItem(Object.assign({}, _this.props.statItem, updated));
30
+ };
31
+ _this.onSelectGroupbyDateGranularity = function (type, dateGranularity) {
32
+ var updated = {
33
+ x_axis_date_granularity: dateGranularity
34
+ };
35
+ _this.props.updateStatItem(Object.assign({}, _this.props.statItem, updated));
36
+ };
37
+ _this.onSelectGroupbyGeolocationGranularity = function (type, geolocationGranularity) {
38
+ var updated = {
39
+ x_axis_geolocation_granularity: geolocationGranularity
40
+ };
41
+ _this.props.updateStatItem(Object.assign({}, _this.props.statItem, updated));
42
+ };
43
+ _this.updatedSummaryType = function (summaryType, summaryColumnKey, summaryMethod) {
44
+ var statItem = _this.props.statItem;
45
+ var updated = {
46
+ y_axis_summary_type: summaryType,
47
+ y_axis_column_key: summaryColumnKey,
48
+ y_axis_summary_method: summaryMethod
49
+ };
50
+ _this.props.updateStatItem(Object.assign({}, statItem, updated));
51
+ };
52
+ _this.updateSummaryColumn = function (summaryColumnKey) {
53
+ _this.props.updateStatItem(Object.assign({}, _this.props.statItem, {
54
+ y_axis_column_key: summaryColumnKey
55
+ }));
56
+ };
57
+ _this.updateSummaryMethod = function (summaryMethod) {
58
+ _this.props.updateStatItem(Object.assign({}, _this.props.statItem, {
59
+ y_axis_summary_method: summaryMethod
60
+ }));
61
+ };
62
+ return _this;
63
+ }
64
+ _createClass(AdvanceBarChartSettings, [{
65
+ key: "render",
66
+ value: function render() {
67
+ var _this$props = this.props,
68
+ getTables = _this$props.getTables,
69
+ getViews = _this$props.getViews,
70
+ getTableById = _this$props.getTableById,
71
+ statItem = _this$props.statItem,
72
+ labelColorConfigs = _this$props.labelColorConfigs,
73
+ eventBus = _this$props.eventBus,
74
+ selectedTable = _this$props.selectedTable,
75
+ generalColumnsOptions = _this$props.generalColumnsOptions,
76
+ numericColumnsOptions = _this$props.numericColumnsOptions,
77
+ dateGranularityOptions = _this$props.dateGranularityOptions,
78
+ geolocationGranularityOptions = _this$props.geolocationGranularityOptions,
79
+ renderIncludeEmpty = _this$props.renderIncludeEmpty,
80
+ settingType = _this$props.settingType,
81
+ columnGroupbyColumnsOptions = _this$props.columnGroupbyColumnsOptions;
82
+ var _ref = statItem || {},
83
+ type = _ref.type,
84
+ selectedTableId = _ref.table_id,
85
+ selectedViewId = _ref.view_id,
86
+ x_axis_column_key = _ref.x_axis_column_key,
87
+ x_axis_date_granularity = _ref.x_axis_date_granularity,
88
+ x_axis_geolocation_granularity = _ref.x_axis_geolocation_granularity,
89
+ y_axis_summary_type = _ref.y_axis_summary_type,
90
+ y_axis_column_key = _ref.y_axis_column_key,
91
+ y_axis_summary_method = _ref.y_axis_summary_method;
92
+ if (settingType === 'style') {
93
+ return /*#__PURE__*/React.createElement(BarChartStyle, {
94
+ showRangeSetting: type !== STAT_TYPE.BAR_STACK,
95
+ statItem: statItem,
96
+ labelColorConfigs: labelColorConfigs,
97
+ eventBus: eventBus,
98
+ getTableById: getTableById,
99
+ updateStatItem: this.props.updateStatItem
100
+ });
101
+ }
102
+ return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(BaseSettings, {
103
+ statItem: statItem,
104
+ selectedTableId: selectedTableId,
105
+ selectedViewId: selectedViewId,
106
+ getTables: getTables,
107
+ getViews: getViews,
108
+ getTableById: this.props.getTableById,
109
+ updateStatItem: this.props.updateStatItem
110
+ }), /*#__PURE__*/React.createElement("div", {
111
+ className: "statistic-chart-parameter-divider"
112
+ }), /*#__PURE__*/React.createElement(GroupbySettings, {
113
+ selectedTable: selectedTable,
114
+ columnsOptions: generalColumnsOptions,
115
+ dateGranularityOptions: dateGranularityOptions,
116
+ geolocationGranularityOptions: geolocationGranularityOptions,
117
+ label: intl.get('X-axis'),
118
+ groupbyColumnKey: x_axis_column_key,
119
+ groupbyDateGranularity: x_axis_date_granularity,
120
+ groupbyGeolocationGranularity: x_axis_geolocation_granularity,
121
+ getSelectedColumnOption: this.props.getSelectedColumnOption,
122
+ onSelectGroupbyColumn: this.onSelectGroupbyColumn.bind(this, GROUPBY_TYPE.ROW),
123
+ onSelectGroupbyDateGranularity: this.onSelectGroupbyDateGranularity.bind(this, GROUPBY_TYPE.ROW),
124
+ onSelectGroupbyGeolocationGranularity: this.onSelectGroupbyGeolocationGranularity.bind(this, GROUPBY_TYPE.ROW),
125
+ renderIncludeEmpty: renderIncludeEmpty
126
+ }), /*#__PURE__*/React.createElement("div", {
127
+ className: "statistic-chart-parameter-divider"
128
+ }), /*#__PURE__*/React.createElement(YAxisGroupSettings, {
129
+ label: intl.get('Y-axis'),
130
+ statItem: statItem,
131
+ selectedTable: selectedTable,
132
+ summaryType: y_axis_summary_type,
133
+ summaryColumnKey: y_axis_column_key,
134
+ summaryMethod: y_axis_summary_method,
135
+ columnGroupbyColumnsOptions: columnGroupbyColumnsOptions,
136
+ dateGranularityOptions: dateGranularityOptions,
137
+ geolocationGranularityOptions: geolocationGranularityOptions,
138
+ numericColumnsOptions: numericColumnsOptions,
139
+ getSelectedColumnOption: this.props.getSelectedColumnOption,
140
+ onChangeColumnGroupbyType: this.updateColumnGroupby,
141
+ onSelectGroupbyColumn: this.onSelectGroupbyColumn.bind(this, GROUPBY_TYPE.COLUMN),
142
+ onSelectGroupbyDateGranularity: this.onSelectGroupbyDateGranularity.bind(this, GROUPBY_TYPE.COLUMN),
143
+ onSelectGroupbyGeolocationGranularity: this.onSelectGroupbyGeolocationGranularity.bind(this, GROUPBY_TYPE.COLUMN),
144
+ updatedColumnGroupbyNumericColumns: this.updatedColumnGroupbyNumericColumns,
145
+ updateStatItem: this.props.updateStatItem
146
+ }), type === STAT_TYPE.BAR_STACK && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
147
+ className: "statistic-chart-parameter-divider"
148
+ }), /*#__PURE__*/React.createElement(DataSort, {
149
+ statItem: statItem,
150
+ updateStatItem: this.props.updateStatItem
151
+ })));
152
+ }
153
+ }]);
154
+ return AdvanceBarChartSettings;
155
+ }(Component);
156
+ export default AdvanceBarChartSettings;
@@ -0,0 +1,147 @@
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 BarChartStyle from './style-setting/bar-chart-style-setting';
9
+ import GroupbySettings from './groupby-settings';
10
+ import SummarySettings from './summary-settings';
11
+ import DataSort from '../public-setting/data-sort-setting';
12
+ import { GROUPBY_TYPE } from '../../../constants';
13
+ var BarSettings = /*#__PURE__*/function (_Component) {
14
+ _inherits(BarSettings, _Component);
15
+ var _super = _createSuper(BarSettings);
16
+ function BarSettings() {
17
+ var _this;
18
+ _classCallCheck(this, BarSettings);
19
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
20
+ args[_key] = arguments[_key];
21
+ }
22
+ _this = _super.call.apply(_super, [this].concat(args));
23
+ _this.onSelectGroupbyColumn = function (type, groupbyColumnKey, groupbyDateGranularity, groupbyGeolocationGranularity) {
24
+ var updated = {
25
+ x_axis_column_key: groupbyColumnKey,
26
+ x_axis_date_granularity: groupbyDateGranularity,
27
+ x_axis_geolocation_granularity: groupbyGeolocationGranularity
28
+ };
29
+ _this.props.updateStatItem(Object.assign({}, _this.props.statItem, updated));
30
+ };
31
+ _this.onSelectGroupbyDateGranularity = function (type, dateGranularity) {
32
+ var updated = {
33
+ x_axis_date_granularity: dateGranularity
34
+ };
35
+ _this.props.updateStatItem(Object.assign({}, _this.props.statItem, updated));
36
+ };
37
+ _this.onSelectGroupbyGeolocationGranularity = function (type, geolocationGranularity) {
38
+ var updated = {
39
+ x_axis_geolocation_granularity: geolocationGranularity
40
+ };
41
+ _this.props.updateStatItem(Object.assign({}, _this.props.statItem, updated));
42
+ };
43
+ _this.updatedSummaryType = function (summaryType, summaryColumnKey, summaryMethod) {
44
+ var statItem = _this.props.statItem;
45
+ var updated = {
46
+ y_axis_summary_type: summaryType,
47
+ y_axis_column_key: summaryColumnKey,
48
+ y_axis_summary_method: summaryMethod
49
+ };
50
+ _this.props.updateStatItem(Object.assign({}, statItem, updated));
51
+ };
52
+ _this.updateSummaryColumn = function (summaryColumnKey) {
53
+ _this.props.updateStatItem(Object.assign({}, _this.props.statItem, {
54
+ y_axis_column_key: summaryColumnKey
55
+ }));
56
+ };
57
+ _this.updateSummaryMethod = function (summaryMethod) {
58
+ _this.props.updateStatItem(Object.assign({}, _this.props.statItem, {
59
+ y_axis_summary_method: summaryMethod
60
+ }));
61
+ };
62
+ return _this;
63
+ }
64
+ _createClass(BarSettings, [{
65
+ key: "render",
66
+ value: function render() {
67
+ var _this$props = this.props,
68
+ getTables = _this$props.getTables,
69
+ getViews = _this$props.getViews,
70
+ getTableById = _this$props.getTableById,
71
+ statItem = _this$props.statItem,
72
+ labelColorConfigs = _this$props.labelColorConfigs,
73
+ eventBus = _this$props.eventBus,
74
+ selectedTable = _this$props.selectedTable,
75
+ generalColumnsOptions = _this$props.generalColumnsOptions,
76
+ numericColumnsOptions = _this$props.numericColumnsOptions,
77
+ dateGranularityOptions = _this$props.dateGranularityOptions,
78
+ geolocationGranularityOptions = _this$props.geolocationGranularityOptions,
79
+ renderIncludeEmpty = _this$props.renderIncludeEmpty,
80
+ settingType = _this$props.settingType;
81
+ var _ref = statItem || {},
82
+ selectedTableId = _ref.table_id,
83
+ selectedViewId = _ref.view_id,
84
+ x_axis_column_key = _ref.x_axis_column_key,
85
+ x_axis_date_granularity = _ref.x_axis_date_granularity,
86
+ x_axis_geolocation_granularity = _ref.x_axis_geolocation_granularity,
87
+ y_axis_summary_type = _ref.y_axis_summary_type,
88
+ y_axis_column_key = _ref.y_axis_column_key,
89
+ y_axis_summary_method = _ref.y_axis_summary_method;
90
+ if (settingType === 'style') {
91
+ return /*#__PURE__*/React.createElement(BarChartStyle, {
92
+ statItem: statItem,
93
+ labelColorConfigs: labelColorConfigs,
94
+ eventBus: eventBus,
95
+ getTableById: getTableById,
96
+ updateStatItem: this.props.updateStatItem
97
+ });
98
+ }
99
+ return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(BaseSettings, {
100
+ statItem: statItem,
101
+ selectedTableId: selectedTableId,
102
+ selectedViewId: selectedViewId,
103
+ getTables: getTables,
104
+ getViews: getViews,
105
+ getTableById: this.props.getTableById,
106
+ updateStatItem: this.props.updateStatItem
107
+ }), /*#__PURE__*/React.createElement("div", {
108
+ className: "statistic-chart-parameter-divider"
109
+ }), /*#__PURE__*/React.createElement(GroupbySettings, {
110
+ selectedTable: selectedTable,
111
+ columnsOptions: generalColumnsOptions,
112
+ dateGranularityOptions: dateGranularityOptions,
113
+ geolocationGranularityOptions: geolocationGranularityOptions,
114
+ label: intl.get('X-axis'),
115
+ placeholder: intl.get('Select_a_column'),
116
+ groupbyColumnKey: x_axis_column_key,
117
+ groupbyDateGranularity: x_axis_date_granularity,
118
+ groupbyGeolocationGranularity: x_axis_geolocation_granularity,
119
+ getSelectedColumnOption: this.props.getSelectedColumnOption,
120
+ onSelectGroupbyColumn: this.onSelectGroupbyColumn.bind(this, GROUPBY_TYPE.ROW),
121
+ onSelectGroupbyDateGranularity: this.onSelectGroupbyDateGranularity.bind(this, GROUPBY_TYPE.ROW),
122
+ onSelectGroupbyGeolocationGranularity: this.onSelectGroupbyGeolocationGranularity.bind(this, GROUPBY_TYPE.ROW),
123
+ renderIncludeEmpty: renderIncludeEmpty
124
+ }), /*#__PURE__*/React.createElement("div", {
125
+ className: "statistic-chart-parameter-divider"
126
+ }), /*#__PURE__*/React.createElement(SummarySettings, {
127
+ statItem: statItem,
128
+ label: intl.get('Y-axis'),
129
+ numericColumnsOptions: numericColumnsOptions,
130
+ summaryType: y_axis_summary_type,
131
+ summaryColumnKey: y_axis_column_key,
132
+ summaryMethod: y_axis_summary_method,
133
+ getSelectedColumnOption: this.props.getSelectedColumnOption,
134
+ onChangeSummaryType: this.updatedSummaryType,
135
+ onSelectNumericColumn: this.updateSummaryColumn,
136
+ onSelectSummaryMethod: this.updateSummaryMethod
137
+ }), /*#__PURE__*/React.createElement("div", {
138
+ className: "statistic-chart-parameter-divider"
139
+ }), /*#__PURE__*/React.createElement(DataSort, {
140
+ statItem: statItem,
141
+ updateStatItem: this.props.updateStatItem
142
+ }));
143
+ }
144
+ }]);
145
+ return BarSettings;
146
+ }(Component);
147
+ export default BarSettings;
@@ -0,0 +1,195 @@
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 { CellType, TableUtils } from 'dtable-store';
8
+ import { DTableSelect } from '../../../components';
9
+ import CompletenessStyle from './style-setting/completeness-style';
10
+ import GroupbySettings from './groupby-settings';
11
+ import BaseSettings from '../public-setting/base-settings';
12
+ import DataSort from '../public-setting/data-sort-setting';
13
+ import { TIME_COLUMN_LIST, STAT_TYPE } from '../../../constants';
14
+ var COLUMN_TYPES = [CellType.TEXT, CellType.COLLABORATOR, CellType.SINGLE_SELECT];
15
+ var CompletenessSetting = /*#__PURE__*/function (_Component) {
16
+ _inherits(CompletenessSetting, _Component);
17
+ var _super = _createSuper(CompletenessSetting);
18
+ function CompletenessSetting(props) {
19
+ var _this;
20
+ _classCallCheck(this, CompletenessSetting);
21
+ _this = _super.call(this, props);
22
+ _this.renderNameSettings = function () {
23
+ var _this$props = _this.props,
24
+ statItem = _this$props.statItem,
25
+ getSelectedColumnOption = _this$props.getSelectedColumnOption;
26
+ var name_column = statItem.name_column;
27
+ var selectedItem = getSelectedColumnOption(name_column, _this.columnOptions);
28
+ return /*#__PURE__*/React.createElement("div", {
29
+ className: "statistic-chart-parameter-item"
30
+ }, /*#__PURE__*/React.createElement("label", null, intl.get('Name_field')), /*#__PURE__*/React.createElement(DTableSelect, {
31
+ placeholder: intl.get('Select_a_column'),
32
+ value: selectedItem,
33
+ onChange: _this.onSelectGroupColumn,
34
+ options: _this.columnOptions
35
+ }));
36
+ };
37
+ _this.onSelectGroupColumn = function (option) {
38
+ var statItem = _this.props.statItem;
39
+ _this.props.updateStatItem(Object.assign({}, statItem, {
40
+ name_column: option.value.key
41
+ }));
42
+ };
43
+ _this.renderCompletionSettings = function () {
44
+ var _this$props2 = _this.props,
45
+ statItem = _this$props2.statItem,
46
+ getSelectedColumnOption = _this$props2.getSelectedColumnOption;
47
+ var completed_column = statItem.completed_column;
48
+ var selectedItem = getSelectedColumnOption(completed_column, _this.props.numericColumnsOptions);
49
+ return /*#__PURE__*/React.createElement("div", {
50
+ className: "statistic-chart-parameter-item"
51
+ }, /*#__PURE__*/React.createElement("label", null, intl.get('Completion_value_field')), /*#__PURE__*/React.createElement(DTableSelect, {
52
+ placeholder: intl.get('Select_a_column'),
53
+ value: selectedItem,
54
+ onChange: _this.onSelectCompletionColumn,
55
+ options: _this.props.numericColumnsOptions
56
+ }));
57
+ };
58
+ _this.renderGroupSettings = function () {
59
+ var _this$props3 = _this.props,
60
+ selectedTable = _this$props3.selectedTable,
61
+ columnGroupbyColumnsOptions = _this$props3.columnGroupbyColumnsOptions,
62
+ dateGranularityOptions = _this$props3.dateGranularityOptions,
63
+ geolocationGranularityOptions = _this$props3.geolocationGranularityOptions,
64
+ statItem = _this$props3.statItem,
65
+ getSelectedColumnOption = _this$props3.getSelectedColumnOption;
66
+ var group_column = statItem.group_column,
67
+ date_granularity = statItem.date_granularity,
68
+ geolocation_granularity = statItem.geolocation_granularity;
69
+ return /*#__PURE__*/React.createElement(GroupbySettings, {
70
+ selectedTable: selectedTable,
71
+ columnsOptions: columnGroupbyColumnsOptions,
72
+ dateGranularityOptions: dateGranularityOptions,
73
+ geolocationGranularityOptions: geolocationGranularityOptions,
74
+ label: intl.get('Group_by'),
75
+ groupbyColumnKey: group_column,
76
+ groupbyDateGranularity: date_granularity,
77
+ groupbyGeolocationGranularity: geolocation_granularity,
78
+ getSelectedColumnOption: getSelectedColumnOption,
79
+ onSelectGroupbyColumn: _this.onSelectColumnGroupColumn,
80
+ onSelectGroupbyDateGranularity: _this.onSelectDateGranularity,
81
+ onSelectGroupbyGeolocationGranularity: _this.onSelectGeolocationGranularity
82
+ });
83
+ };
84
+ _this.onSelectColumnGroupColumn = function (key) {
85
+ var _this$props4 = _this.props,
86
+ statItem = _this$props4.statItem,
87
+ selectedTable = _this$props4.selectedTable;
88
+ if (key === statItem.group_column) return;
89
+ var selectedColumn = TableUtils.getTableColumnByKey(selectedTable, key);
90
+ var newStatItem = {};
91
+ if (selectedColumn && TIME_COLUMN_LIST.includes(selectedColumn.type)) {
92
+ newStatItem.date_granularity = 'month';
93
+ }
94
+ if (selectedColumn.type === CellType.GEOLOCATION) {
95
+ newStatItem.geolocation_granularity = 'district';
96
+ }
97
+ newStatItem.group_column = key;
98
+ _this.props.updateStatItem(Object.assign({}, statItem, newStatItem));
99
+ };
100
+ _this.onSelectDateGranularity = function (key) {
101
+ var statItem = _this.props.statItem;
102
+ if (key === statItem.date_granularity) return;
103
+ _this.props.updateStatItem(Object.assign({}, statItem, {
104
+ date_granularity: key
105
+ }));
106
+ };
107
+ _this.onSelectGeolocationGranularity = function (key) {
108
+ var statItem = _this.props.statItem;
109
+ if (key === statItem.geolocation_granularity) return;
110
+ _this.props.updateStatItem(Object.assign({}, statItem, {
111
+ geolocation_granularity: key
112
+ }));
113
+ };
114
+ _this.onSelectCompletionColumn = function (option) {
115
+ var statItem = _this.props.statItem;
116
+ _this.props.updateStatItem(Object.assign({}, statItem, {
117
+ completed_column: option.value.key
118
+ }));
119
+ };
120
+ _this.renderTotalValueSettings = function () {
121
+ var _this$props5 = _this.props,
122
+ statItem = _this$props5.statItem,
123
+ getSelectedColumnOption = _this$props5.getSelectedColumnOption;
124
+ var target_column = statItem.target_column;
125
+ var selectedItem = getSelectedColumnOption(target_column, _this.props.numericColumnsOptions);
126
+ return /*#__PURE__*/React.createElement("div", {
127
+ className: "statistic-chart-parameter-item"
128
+ }, /*#__PURE__*/React.createElement("label", null, intl.get('Total_value_field')), /*#__PURE__*/React.createElement(DTableSelect, {
129
+ placeholder: intl.get('Select_a_column'),
130
+ value: selectedItem,
131
+ onChange: _this.onSelectTotalColumn,
132
+ options: _this.props.numericColumnsOptions
133
+ }));
134
+ };
135
+ _this.onSelectTotalColumn = function (option) {
136
+ var statItem = _this.props.statItem;
137
+ _this.props.updateStatItem(Object.assign({}, statItem, {
138
+ target_column: option.value.key
139
+ }));
140
+ };
141
+ _this.columnOptions = props.generalColumnsOptions.filter(function (item) {
142
+ return COLUMN_TYPES.includes(item.value.type);
143
+ });
144
+ return _this;
145
+ }
146
+ _createClass(CompletenessSetting, [{
147
+ key: "componentWillReceiveProps",
148
+ value: function componentWillReceiveProps(nextProps, props) {
149
+ if (nextProps.selectedTable._id !== this.props.selectedTable._id) {
150
+ this.columnOptions = nextProps.generalColumnsOptions.filter(function (item) {
151
+ return COLUMN_TYPES.includes(item.value.type);
152
+ });
153
+ }
154
+ }
155
+ }, {
156
+ key: "render",
157
+ value: function render() {
158
+ var _this$props6 = this.props,
159
+ getTables = _this$props6.getTables,
160
+ getViews = _this$props6.getViews,
161
+ statItem = _this$props6.statItem,
162
+ settingType = _this$props6.settingType;
163
+ var _ref = statItem || {},
164
+ selectedTableId = _ref.table_id,
165
+ selectedViewId = _ref.view_id;
166
+ var isGroupChart = statItem.type === STAT_TYPE.GROUP_COMPLETENESS_CHART;
167
+ if (settingType === 'style') {
168
+ return /*#__PURE__*/React.createElement(CompletenessStyle, {
169
+ statItem: statItem,
170
+ updateStatItem: this.props.updateStatItem
171
+ });
172
+ }
173
+ return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(BaseSettings, {
174
+ statItem: statItem,
175
+ selectedTableId: selectedTableId,
176
+ selectedViewId: selectedViewId,
177
+ getTables: getTables,
178
+ getViews: getViews,
179
+ getTableById: this.props.getTableById,
180
+ updateStatItem: this.props.updateStatItem
181
+ }), /*#__PURE__*/React.createElement("div", {
182
+ className: "statistic-chart-parameter-divider"
183
+ }), this.renderNameSettings(), /*#__PURE__*/React.createElement("div", {
184
+ className: "statistic-chart-parameter-divider"
185
+ }), this.renderCompletionSettings(), this.renderTotalValueSettings(), isGroupChart && this.renderGroupSettings(), !isGroupChart && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
186
+ className: "statistic-chart-parameter-divider"
187
+ }), /*#__PURE__*/React.createElement(DataSort, {
188
+ statItem: statItem,
189
+ updateStatItem: this.props.updateStatItem
190
+ })));
191
+ }
192
+ }]);
193
+ return CompletenessSetting;
194
+ }(Component);
195
+ export default CompletenessSetting;