dtable-statistic 4.2.1 → 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/api/dtable-db-api.js +31 -37
- package/es/calculator/base-calculator.js +49 -99
- package/es/calculator/basic-chart-calculator.js +335 -559
- package/es/calculator/combination-calculator.js +231 -299
- package/es/calculator/compare-bar-calculator.js +184 -281
- package/es/calculator/completeness-calculator.js +203 -288
- package/es/calculator/copy-value.js +18 -18
- package/es/calculator/dashboard-calculator.js +68 -137
- package/es/calculator/heat-map-calculator.js +139 -220
- package/es/calculator/horizontal-bar-calculator.js +64 -93
- package/es/calculator/index.js +53 -69
- package/es/calculator/map-calculator.js +98 -174
- package/es/calculator/mirror-calculator.js +137 -216
- package/es/calculator/number-card-calculator.js +58 -126
- package/es/calculator/pivot-table-calculator.js +750 -792
- package/es/calculator/scatter-calculator.js +72 -140
- package/es/calculator/thread-manager.js +48 -67
- package/es/calculator/trend-calculator.js +107 -191
- package/es/calculator/workers/basic-chart-calculator-worker.js +194 -165
- package/es/calculator/workers/calculator.worker.js +22 -6
- package/es/calculator/workers/card-calculator-worker.js +16 -14
- package/es/calculator/workers/combination-calculator-worker.js +128 -135
- package/es/calculator/workers/compare-bar-chart-calculator-worker.js +80 -96
- package/es/calculator/workers/completeness-calculator-worker.js +56 -49
- package/es/calculator/workers/dashboard-calculator-worker.js +24 -22
- package/es/calculator/workers/mirror-calculator-worker.js +52 -52
- package/es/calculator/workers/pivot-table-calculator-worker.js +247 -230
- package/es/calculator/workers/scatter-calculator-worker.js +34 -32
- package/es/calculator/workers/trend-calculator-worker.js +33 -29
- package/es/calculator/world-map-calculator.js +120 -197
- package/es/components/common-add-tool.js +7 -5
- package/es/components/dialog/chart-addition-edit-dialog.js +67 -77
- package/es/components/dialog/chart-addition-widgets/chart-selector.js +57 -67
- package/es/components/dialog/color-theme-dialog.js +34 -47
- package/es/components/dialog/delete-confirmation-dialog.js +7 -5
- package/es/components/dialog/enlarged-chart-dialog.js +68 -81
- package/es/components/dialog/new-table-dialog.js +62 -80
- package/es/components/dialog/new-view-dialog.js +50 -62
- package/es/components/dialog/rename-view-dialog.js +49 -58
- package/es/components/dialog/statistic-record-dialog/index.js +233 -231
- package/es/components/dialog/statistic-types-dialog/index.js +40 -49
- package/es/components/dialog/table-select-dialog.js +61 -70
- package/es/components/dropdown-menu/statistic-dropdown-menu.js +129 -142
- package/es/components/dtable-popover.js +62 -81
- package/es/components/dtable-search-input.js +89 -99
- package/es/components/dtable-select.js +55 -74
- package/es/components/icon.js +5 -3
- package/es/components/loading.js +1 -1
- package/es/components/modal-portal.js +15 -32
- package/es/components/popover/color-rules/color-rule.js +137 -141
- package/es/components/popover/color-rules/index.js +58 -66
- package/es/components/popover/color-rules/rule-filters/filter.js +124 -124
- package/es/components/popover/color-rules/rule-filters/index.js +50 -58
- package/es/components/popover/color-rules/rule-filters/number-input.js +42 -57
- package/es/components/popover/color-rules-popover.js +117 -121
- package/es/components/popover/color-selector-popover.js +60 -70
- package/es/components/seatable-radio/index.js +2 -2
- package/es/components/select/option-group.js +139 -157
- package/es/components/select/option.js +26 -40
- package/es/components/select/select.js +97 -112
- package/es/components/toast/alert.js +65 -80
- package/es/components/toast/index.js +1 -1
- package/es/components/toast/toast.js +76 -103
- package/es/components/toast/toastManager.js +57 -93
- package/es/components/toast/toaster.js +58 -56
- package/es/constants/color-rules.js +8 -5
- package/es/constants/dtable-select-style.js +44 -48
- package/es/constants/event-types.js +4 -4
- package/es/constants/index.js +328 -242
- package/es/constants/map.js +2 -2
- package/es/constants/model.js +20 -20
- package/es/constants/regions.js +1 -1
- package/es/constants/zIndexes.js +1 -1
- package/es/custom-g2.js +11 -11
- package/es/dashboard.js +343 -333
- package/es/desktop-dashboard.js +217 -224
- package/es/index.js +45 -58
- package/es/locale/index.js +3 -3
- package/es/locale/lang/de.js +1 -1
- package/es/locale/lang/en.js +7 -7
- package/es/locale/lang/fr.js +1 -1
- package/es/locale/lang/zh_CN.js +1 -1
- package/es/mobile-dashboard.js +76 -89
- package/es/model/bar-group.js +34 -44
- package/es/model/bar.js +26 -36
- package/es/model/base-model.js +11 -12
- package/es/model/basic-number-card.js +10 -20
- package/es/model/collaborators.js +10 -11
- package/es/model/combination.js +32 -42
- package/es/model/compare-bar.js +30 -40
- package/es/model/completeness-group.js +19 -29
- package/es/model/completeness.js +14 -24
- package/es/model/custom-bar.js +14 -24
- package/es/model/dashboard.js +9 -19
- package/es/model/generic-model.js +187 -197
- package/es/model/heat-map.js +16 -26
- package/es/model/horizontal-bar-group.js +32 -42
- package/es/model/horizontal-bar.js +26 -36
- package/es/model/index.js +31 -3
- package/es/model/map.js +20 -30
- package/es/model/mirror.js +15 -25
- package/es/model/pie.js +21 -31
- package/es/model/ring.js +23 -33
- package/es/model/scatter.js +11 -21
- package/es/model/statistic-dashboard.js +7 -8
- package/es/model/table.js +19 -29
- package/es/model/trend.js +15 -25
- package/es/model/world-map.js +17 -27
- package/es/service/chart-service.js +69 -65
- package/es/service/dashboard-service.js +421 -419
- package/es/service/map-json.js +112 -132
- package/es/stat-editor/chart-name-editor.js +44 -58
- package/es/stat-editor/index.js +59 -70
- package/es/stat-editor/stat-settings/advance-chart-settings/basic-number-card-settings.js +93 -98
- package/es/stat-editor/stat-settings/advance-chart-settings/combination-settings.js +246 -248
- package/es/stat-editor/stat-settings/advance-chart-settings/dashboard-chart-settings.js +127 -126
- package/es/stat-editor/stat-settings/advance-chart-settings/geo-granularity-settings.js +5 -3
- package/es/stat-editor/stat-settings/advance-chart-settings/heat-map-settings.js +78 -90
- package/es/stat-editor/stat-settings/advance-chart-settings/index.js +146 -150
- package/es/stat-editor/stat-settings/advance-chart-settings/map-settings.js +88 -98
- package/es/stat-editor/stat-settings/advance-chart-settings/mirror-settings.js +100 -118
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/combination-style-setting.js +161 -148
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/heat-map-settings.js +58 -66
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/map-setting.js +58 -60
- package/es/stat-editor/stat-settings/advance-chart-settings/summary-settings.js +152 -148
- package/es/stat-editor/stat-settings/advance-chart-settings/trend-chart-settings.js +101 -105
- package/es/stat-editor/stat-settings/advance-chart-settings/world-map-settings.js +81 -91
- package/es/stat-editor/stat-settings/basic-chart-settings/advance-bar-chart-settings.js +110 -122
- package/es/stat-editor/stat-settings/basic-chart-settings/bar-settings.js +101 -113
- package/es/stat-editor/stat-settings/basic-chart-settings/completeness-chart-settings.js +130 -120
- package/es/stat-editor/stat-settings/basic-chart-settings/custom-bar-settings.js +88 -102
- package/es/stat-editor/stat-settings/basic-chart-settings/groupby-settings.js +88 -102
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-axis-group-settings.js +200 -194
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-bar-settings.js +98 -110
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-group-chart-settings.js +106 -118
- package/es/stat-editor/stat-settings/basic-chart-settings/index.js +212 -223
- package/es/stat-editor/stat-settings/basic-chart-settings/pie-settings.js +109 -119
- package/es/stat-editor/stat-settings/basic-chart-settings/pivot-table-settings.js +329 -319
- package/es/stat-editor/stat-settings/basic-chart-settings/scatter-settings.js +82 -90
- package/es/stat-editor/stat-settings/basic-chart-settings/stack-item-settings.js +58 -65
- package/es/stat-editor/stat-settings/basic-chart-settings/stacks-settings.js +126 -116
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/bar-chart-style-setting.js +201 -182
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/completeness-style.js +79 -79
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/horizontal-bar-chart-style.js +196 -175
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/label-font-size-editor.js +35 -50
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/pie-chart-style-settings.js +180 -147
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/time-compare-style.js +31 -40
- package/es/stat-editor/stat-settings/basic-chart-settings/summary-method-setting.js +56 -67
- package/es/stat-editor/stat-settings/basic-chart-settings/summary-settings.js +60 -69
- package/es/stat-editor/stat-settings/basic-chart-settings/time-comparison-settings.js +165 -158
- package/es/stat-editor/stat-settings/basic-chart-settings/timer-picker.js +61 -74
- package/es/stat-editor/stat-settings/basic-chart-settings/y-axis-group-settings.js +199 -193
- package/es/stat-editor/stat-settings/color-setting/color-group-selector.js +25 -38
- package/es/stat-editor/stat-settings/color-setting/color-picker.js +79 -86
- package/es/stat-editor/stat-settings/color-setting/color-use-type-selector.js +138 -120
- package/es/stat-editor/stat-settings/map/map-level.js +31 -43
- package/es/stat-editor/stat-settings/map/map-province-city.js +82 -83
- package/es/stat-editor/stat-settings/public-setting/axis-label-position-setting.js +48 -50
- package/es/stat-editor/stat-settings/public-setting/base-settings.js +96 -96
- package/es/stat-editor/stat-settings/public-setting/calender.js +69 -75
- package/es/stat-editor/stat-settings/public-setting/column-settings.js +5 -3
- package/es/stat-editor/stat-settings/public-setting/custom-title-setting.js +36 -41
- package/es/stat-editor/stat-settings/public-setting/data-sort-setting.js +37 -41
- package/es/stat-editor/stat-settings/public-setting/ind-toggle-setting.js +25 -38
- package/es/stat-editor/stat-settings/public-setting/min-max-setting.js +40 -52
- package/es/stat-editor/stat-settings/public-setting/numeric-summary-item.js +90 -93
- package/es/stat-editor/stat-settings/public-setting/toggle-setting.js +23 -36
- package/es/stat-editor/stat-settings/public-setting/type-settings/index.js +39 -44
- package/es/stat-list/chart-preview.js +85 -98
- package/es/stat-list/index.js +170 -178
- package/es/stat-view/area-chart.js +282 -274
- package/es/stat-view/bar-chart.js +300 -292
- package/es/stat-view/base-chart.js +58 -52
- package/es/stat-view/basic-number-card.js +115 -168
- package/es/stat-view/combination-chart.js +298 -334
- package/es/stat-view/compare-chart.js +256 -254
- package/es/stat-view/completeness-chart.js +194 -206
- package/es/stat-view/custom-bar.js +221 -223
- package/es/stat-view/dashboard-chart.js +122 -180
- package/es/stat-view/heat-map.js +268 -294
- package/es/stat-view/horizontal-bar-chart.js +291 -281
- package/es/stat-view/index.js +136 -152
- package/es/stat-view/line-chart.js +267 -265
- package/es/stat-view/map.js +246 -246
- package/es/stat-view/mirror.js +141 -152
- package/es/stat-view/pie-chart.js +143 -156
- package/es/stat-view/pivot-table/index.js +113 -118
- package/es/stat-view/pivot-table/one-dimension-table-no-numeric-columns.js +104 -102
- package/es/stat-view/pivot-table/one-dimension-table-with-numeric-columns.js +116 -118
- package/es/stat-view/pivot-table/pivot-table-display-name.js +96 -95
- package/es/stat-view/pivot-table/two-dimension-table.js +238 -229
- package/es/stat-view/ring-chart.js +189 -200
- package/es/stat-view/scatter-chart.js +162 -213
- package/es/stat-view/treemap-chart.js +136 -200
- package/es/stat-view/trend-chart.js +137 -183
- package/es/stat-view/world-map.js +233 -243
- package/es/tabs/index.js +164 -169
- package/es/tabs/tab.js +101 -116
- package/es/utils/basic-chart-utils.js +7 -9
- package/es/utils/cell-format.js +48 -51
- package/es/utils/cell-value.js +1 -1
- package/es/utils/collaborator.js +15 -14
- package/es/utils/color-utils.js +48 -37
- package/es/utils/column-utils.js +47 -33
- package/es/utils/column.js +1 -1
- package/es/utils/common-utils.js +111 -117
- package/es/utils/date-format.js +17 -17
- package/es/utils/export-table-utils.js +507 -396
- package/es/utils/index.js +6 -6
- package/es/utils/map.js +30 -34
- package/es/utils/model.js +3 -5
- package/es/utils/object.js +4 -4
- package/es/utils/pivot-table.js +20 -20
- package/es/utils/row-utils.js +41 -33
- package/es/utils/search.js +18 -20
- package/es/utils/sql-utils.js +132 -98
- package/es/utils/stat-utils.js +303 -320
- package/es/utils/trend-utils.js +57 -67
- 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
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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:
|
|
53
|
+
handleToggleChange: this.onToggleIncludeEmpty,
|
|
60
54
|
label: intl.get('Including_empty_cell')
|
|
61
55
|
}));
|
|
62
56
|
};
|
|
63
|
-
|
|
57
|
+
this.getAvailableColumns = columns => {
|
|
64
58
|
if (!columns || !Array.isArray(columns)) return [];
|
|
65
|
-
return columns.filter(
|
|
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
|
-
|
|
70
|
-
|
|
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
|
|
65
|
+
return this.getColumnsOptions(summaryColumns);
|
|
74
66
|
};
|
|
75
|
-
|
|
67
|
+
this.getColumnsOptions = columns => {
|
|
76
68
|
if (!Array.isArray(columns)) return [];
|
|
77
|
-
return columns.map(
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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
|
|
94
|
-
key
|
|
95
|
-
type
|
|
85
|
+
name,
|
|
86
|
+
key,
|
|
87
|
+
type
|
|
96
88
|
}
|
|
97
89
|
};
|
|
98
90
|
});
|
|
99
91
|
};
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
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
|
-
|
|
121
|
-
|
|
122
|
-
|
|
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
|
-
|
|
119
|
+
this.getNumericColumns = columns => {
|
|
128
120
|
if (!columns) return [];
|
|
129
|
-
return columns.filter(
|
|
130
|
-
return column && isNumericColumn(column);
|
|
131
|
-
});
|
|
121
|
+
return columns.filter(column => column && isNumericColumn(column));
|
|
132
122
|
};
|
|
133
|
-
|
|
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(
|
|
138
|
-
return o.value.key === key;
|
|
139
|
-
}) || columnsOptions[0];
|
|
127
|
+
return columnsOptions.find(o => o.value.key === key) || columnsOptions[0];
|
|
140
128
|
};
|
|
141
|
-
|
|
142
|
-
return options.map(
|
|
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
|
-
|
|
152
|
-
|
|
153
|
-
statItem
|
|
154
|
-
labelColorConfigs
|
|
155
|
-
eventBus
|
|
156
|
-
getTableById
|
|
157
|
-
getTables
|
|
158
|
-
getViews
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
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:
|
|
178
|
-
columnGroupbyColumnsOptions:
|
|
179
|
-
numericColumnsOptions:
|
|
180
|
-
dateGranularityOptions:
|
|
181
|
-
geolocationGranularityOptions:
|
|
182
|
-
getSelectedColumnOption:
|
|
183
|
-
getConvertedChart:
|
|
184
|
-
updateStatItem:
|
|
185
|
-
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:
|
|
200
|
-
numericColumnsOptions:
|
|
201
|
-
dateGranularityOptions:
|
|
202
|
-
getSelectedColumnOption:
|
|
203
|
-
getConvertedChart:
|
|
204
|
-
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:
|
|
223
|
-
columnGroupbyColumnsOptions:
|
|
224
|
-
numericColumnsOptions:
|
|
225
|
-
dateGranularityOptions:
|
|
226
|
-
geolocationGranularityOptions:
|
|
227
|
-
getSelectedColumnOption:
|
|
228
|
-
getConvertedChart:
|
|
229
|
-
updateStatItem:
|
|
230
|
-
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:
|
|
246
|
-
numericColumnsOptions:
|
|
247
|
-
dateGranularityOptions:
|
|
248
|
-
geolocationGranularityOptions:
|
|
249
|
-
getSelectedColumnOption:
|
|
250
|
-
getConvertedChart:
|
|
251
|
-
updateStatItem:
|
|
252
|
-
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:
|
|
269
|
-
columnsOptions:
|
|
270
|
-
numericColumnsOptions:
|
|
271
|
-
dateGranularityOptions:
|
|
272
|
-
geolocationGranularityOptions:
|
|
273
|
-
getSelectedColumnOption:
|
|
274
|
-
updateStatisticsSettings:
|
|
275
|
-
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:
|
|
289
|
-
numericColumnsOptions:
|
|
290
|
-
generalColumnsOptions:
|
|
291
|
-
columnGroupbyColumnsOptions:
|
|
292
|
-
getSelectedColumnOption:
|
|
293
|
-
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:
|
|
308
|
-
generalColumnsOptions:
|
|
309
|
-
columnGroupbyColumnsOptions:
|
|
310
|
-
numericColumnsOptions:
|
|
311
|
-
dateGranularityOptions:
|
|
312
|
-
geolocationGranularityOptions:
|
|
313
|
-
getSelectedColumnOption:
|
|
314
|
-
updateStatItem:
|
|
315
|
-
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:
|
|
331
|
-
columnGroupbyColumnsOptions:
|
|
332
|
-
numericColumnsOptions:
|
|
333
|
-
dateGranularityOptions:
|
|
334
|
-
geolocationGranularityOptions:
|
|
335
|
-
getSelectedColumnOption:
|
|
336
|
-
updateStatItem:
|
|
337
|
-
getConvertedChart:
|
|
338
|
-
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:
|
|
342
|
+
getConvertedChart: this.props.getConvertedChart,
|
|
353
343
|
selectedTable: selectedTable,
|
|
354
|
-
generalColumnsOptions:
|
|
355
|
-
numericColumnsOptions:
|
|
356
|
-
updateStatItem:
|
|
357
|
-
getSelectedColumnOption:
|
|
358
|
-
columnGroupbyColumnsOptions:
|
|
359
|
-
geolocationGranularityOptions:
|
|
360
|
-
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:
|
|
363
|
+
getConvertedChart: this.props.getConvertedChart,
|
|
374
364
|
selectedTable: selectedTable,
|
|
375
|
-
generalColumnsOptions:
|
|
376
|
-
pivotTableSummaryColumnOptions:
|
|
377
|
-
updateStatItem:
|
|
378
|
-
getSelectedColumnOption:
|
|
379
|
-
columnGroupbyColumnsOptions:
|
|
380
|
-
geolocationGranularityOptions:
|
|
381
|
-
dateGranularityOptions:
|
|
382
|
-
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
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
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
|
-
|
|
405
|
+
this.props.updateStatItem(Object.assign({}, statItem, updated));
|
|
413
406
|
};
|
|
414
|
-
|
|
415
|
-
|
|
407
|
+
this.selectEditType = type => {
|
|
408
|
+
this.setState({
|
|
416
409
|
settingType: type
|
|
417
410
|
});
|
|
418
411
|
};
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
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
|
-
|
|
427
|
-
|
|
428
|
-
|
|
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
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
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
|
-
|
|
475
|
-
|
|
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;
|