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.
- package/README.md +3 -0
- package/es/api/dtable-db-api.js +43 -0
- package/es/assets/css/color-picker.css +53 -0
- package/es/assets/css/color-rules-popover.css +144 -0
- package/es/assets/css/color-theme-dialog.css +40 -0
- package/es/assets/css/dashboard.css +562 -0
- package/es/assets/css/dialog.css +415 -0
- package/es/assets/css/mobile-dashboard.module.css +91 -0
- package/es/assets/css/slider.css +77 -0
- package/es/assets/css/statistic-chart.module.css +11 -0
- package/es/assets/css/statistic-custom-title.module.css +3 -0
- package/es/assets/css/statistic-custom.module.css +4 -0
- package/es/assets/css/statistic-numeric-column-item.module.css +43 -0
- package/es/assets/css/statistic-time-picker.module.css +21 -0
- package/es/assets/css/theme.css +61 -0
- package/es/assets/images/icon.png +0 -0
- package/es/calculator/base-calculator.js +111 -0
- package/es/calculator/basic-chart-calculator.js +571 -0
- package/es/calculator/combination-calculator.js +296 -0
- package/es/calculator/compare-bar-calculator.js +291 -0
- package/es/calculator/completeness-calculator.js +307 -0
- package/es/calculator/copy-value.js +47 -0
- package/es/calculator/dashboard-calculator.js +146 -0
- package/es/calculator/heat-map-calculator.js +225 -0
- package/es/calculator/horizontal-bar-calculator.js +100 -0
- package/es/calculator/index.js +88 -0
- package/es/calculator/map-calculator.js +169 -0
- package/es/calculator/mirror-calculator.js +217 -0
- package/es/calculator/number-card-calculator.js +135 -0
- package/es/calculator/pivot-table-calculator.js +810 -0
- package/es/calculator/scatter-calculator.js +150 -0
- package/es/calculator/thread-manager.js +70 -0
- package/es/calculator/trend-calculator.js +204 -0
- package/es/calculator/workers/basic-chart-calculator-worker.js +410 -0
- package/es/calculator/workers/calculator.worker.js +22 -0
- package/es/calculator/workers/card-calculator-worker.js +28 -0
- package/es/calculator/workers/combination-calculator-worker.js +257 -0
- package/es/calculator/workers/compare-bar-chart-calculator-worker.js +149 -0
- package/es/calculator/workers/completeness-calculator-worker.js +153 -0
- package/es/calculator/workers/dashboard-calculator-worker.js +56 -0
- package/es/calculator/workers/mirror-calculator-worker.js +132 -0
- package/es/calculator/workers/pivot-table-calculator-worker.js +615 -0
- package/es/calculator/workers/scatter-calculator-worker.js +67 -0
- package/es/calculator/workers/trend-calculator-worker.js +93 -0
- package/es/calculator/world-map-calculator.js +193 -0
- package/es/components/common-add-tool.js +19 -0
- package/es/components/dialog/chart-addition-edit-dialog.js +89 -0
- package/es/components/dialog/chart-addition-widgets/chart-selector.js +261 -0
- package/es/components/dialog/chart-addition-widgets/statistic-chart-selector.module.css +74 -0
- package/es/components/dialog/color-theme-dialog.js +71 -0
- package/es/components/dialog/enlarged-chart-dialog.js +73 -0
- package/es/components/dialog/new-table-dialog.js +113 -0
- package/es/components/dialog/new-view-dialog.js +87 -0
- package/es/components/dialog/rename-view-dialog.js +87 -0
- package/es/components/dialog/statistic-record-dialog/index.css +114 -0
- package/es/components/dialog/statistic-record-dialog/index.js +174 -0
- package/es/components/dialog/table-select-dialog.js +93 -0
- package/es/components/dropdown-menu/statistic-dropdown-menu.js +94 -0
- package/es/components/dtable-popover.js +109 -0
- package/es/components/dtable-search-input.js +137 -0
- package/es/components/dtable-select.js +104 -0
- package/es/components/index.js +11 -0
- package/es/components/loading.js +8 -0
- package/es/components/modal-portal.js +36 -0
- package/es/components/popover/color-rules/color-rule.js +179 -0
- package/es/components/popover/color-rules/index.js +87 -0
- package/es/components/popover/color-rules/rule-filters/filter.js +214 -0
- package/es/components/popover/color-rules/rule-filters/index.css +214 -0
- package/es/components/popover/color-rules/rule-filters/index.js +97 -0
- package/es/components/popover/color-rules/rule-filters/number-input.js +85 -0
- package/es/components/popover/color-rules-popover.js +213 -0
- package/es/components/popover/color-selector-popover.js +85 -0
- package/es/components/seatable-radio/index.css +51 -0
- package/es/components/seatable-radio/index.js +28 -0
- package/es/components/select/index.js +2 -0
- package/es/components/select/option-group.css +104 -0
- package/es/components/select/option-group.js +225 -0
- package/es/components/select/option.js +51 -0
- package/es/components/select/select.css +211 -0
- package/es/components/select/select.js +157 -0
- package/es/components/toast/alert.js +130 -0
- package/es/components/toast/index.js +3 -0
- package/es/components/toast/toast.js +164 -0
- package/es/components/toast/toastManager.js +150 -0
- package/es/components/toast/toaster.js +64 -0
- package/es/constants/color-rules.js +8 -0
- package/es/constants/dtable-select-style.js +61 -0
- package/es/constants/event-types.js +1 -0
- package/es/constants/index.js +501 -0
- package/es/constants/key-codes.js +102 -0
- package/es/constants/zIndexes.js +1 -0
- package/es/custom-g2.js +614 -0
- package/es/dashboard.js +408 -0
- package/es/desktop-dashboard.js +299 -0
- package/es/index.js +33 -0
- package/es/locale/index.js +17 -0
- package/es/locale/lang/de.js +237 -0
- package/es/locale/lang/en.js +237 -0
- package/es/locale/lang/fr.js +237 -0
- package/es/locale/lang/zh_CN.js +237 -0
- package/es/mobile-dashboard.js +103 -0
- package/es/model/collaborators.js +11 -0
- package/es/model/stat-item.js +340 -0
- package/es/model/statistic-dashboard.js +8 -0
- package/es/service/chart-service.js +192 -0
- package/es/service/dashboard-service.js +415 -0
- package/es/stat-editor/chart-name-editor.js +75 -0
- package/es/stat-editor/index.js +74 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/basic-number-card-settings.js +149 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/combination-settings.js +415 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/dashboard-chart-settings.js +193 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/geo-granularity-settings.js +13 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/heat-map-settings.js +107 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/index.js +332 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/map-settings.js +170 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/mirror-settings.js +141 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/combination-style-setting.js +219 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/heat-map-settings.js +89 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/map-setting.js +132 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/summary-settings.js +319 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/trend-chart-settings.js +138 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/world-map-settings.js +135 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/advance-bar-chart-settings.js +156 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/bar-settings.js +147 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/completeness-chart-settings.js +195 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/custom-bar-settings.js +126 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/groupby-settings.js +169 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-axis-group-settings.js +352 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-bar-settings.js +145 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-group-chart-settings.js +153 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/index.js +466 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/pie-settings.js +183 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/pivot-table-settings.js +542 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/scatter-settings.js +111 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/stack-item-settings.js +86 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/stacks-settings.js +169 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/bar-chart-style-setting.js +273 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/completeness-style.js +105 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/horizontal-bar-chart-style.js +243 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/label-font-size-editor.js +65 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/pie-chart-style-settings.js +318 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/time-compare-style.js +49 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/summary-method-setting.js +124 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/summary-settings.js +150 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/time-comparison-settings.js +267 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/timer-picker.js +109 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/y-axis-group-settings.js +351 -0
- package/es/stat-editor/stat-settings/color-setting/color-group-selector.js +60 -0
- package/es/stat-editor/stat-settings/color-setting/color-picker.js +129 -0
- package/es/stat-editor/stat-settings/color-setting/color-use-type-selector.js +348 -0
- package/es/stat-editor/stat-settings/public-setting/axis-label-position-setting.js +102 -0
- package/es/stat-editor/stat-settings/public-setting/base-settings.js +124 -0
- package/es/stat-editor/stat-settings/public-setting/calender.js +124 -0
- package/es/stat-editor/stat-settings/public-setting/column-settings.js +15 -0
- package/es/stat-editor/stat-settings/public-setting/custom-title-setting.js +60 -0
- package/es/stat-editor/stat-settings/public-setting/data-sort-setting.js +57 -0
- package/es/stat-editor/stat-settings/public-setting/ind-toggle-setting.js +41 -0
- package/es/stat-editor/stat-settings/public-setting/min-max-setting.js +64 -0
- package/es/stat-editor/stat-settings/public-setting/numeric-summary-item.js +118 -0
- package/es/stat-editor/stat-settings/public-setting/toggle-setting.js +39 -0
- package/es/stat-list/chart-preview.js +139 -0
- package/es/stat-list/index.js +275 -0
- package/es/stat-view/area-chart.js +521 -0
- package/es/stat-view/bar-chart.js +568 -0
- package/es/stat-view/base-chart.js +44 -0
- package/es/stat-view/basic-number-card.js +255 -0
- package/es/stat-view/combination-chart.js +558 -0
- package/es/stat-view/compare-chart.js +485 -0
- package/es/stat-view/completeness-chart.js +389 -0
- package/es/stat-view/custom-bar.js +433 -0
- package/es/stat-view/dashboard-chart.js +317 -0
- package/es/stat-view/heat-map.js +501 -0
- package/es/stat-view/horizontal-bar-chart.js +569 -0
- package/es/stat-view/index.js +183 -0
- package/es/stat-view/line-chart.js +505 -0
- package/es/stat-view/map.js +428 -0
- package/es/stat-view/mirror.js +285 -0
- package/es/stat-view/pie-chart.js +326 -0
- package/es/stat-view/pivot-table/index.js +206 -0
- package/es/stat-view/pivot-table/one-dimension-table-no-numeric-columns.js +133 -0
- package/es/stat-view/pivot-table/one-dimension-table-with-numeric-columns.js +164 -0
- package/es/stat-view/pivot-table/statistic-pivot-table.module.css +132 -0
- package/es/stat-view/pivot-table/two-dimension-table.js +344 -0
- package/es/stat-view/ring-chart.js +416 -0
- package/es/stat-view/scatter-chart.js +367 -0
- package/es/stat-view/treemap-chart.js +318 -0
- package/es/stat-view/trend-chart.js +299 -0
- package/es/stat-view/world-map.js +443 -0
- package/es/tabs/index.js +252 -0
- package/es/tabs/statistic-tabs.module.css +154 -0
- package/es/tabs/tab.js +167 -0
- package/es/utils/basic-chart-utils.js +24 -0
- package/es/utils/cell-format.js +110 -0
- package/es/utils/cell-value.js +27 -0
- package/es/utils/collaborator.js +31 -0
- package/es/utils/color-utils.js +112 -0
- package/es/utils/column-utils.js +18 -0
- package/es/utils/column.js +13 -0
- package/es/utils/common-utils.js +303 -0
- package/es/utils/date-format.js +65 -0
- package/es/utils/export-table-utils.js +632 -0
- package/es/utils/index.js +26 -0
- package/es/utils/object.js +26 -0
- package/es/utils/row-utils.js +115 -0
- package/es/utils/search.js +67 -0
- package/es/utils/sql-utils.js +293 -0
- package/es/utils/stat-utils.js +353 -0
- package/es/utils/trend-utils.js +136 -0
- package/index.js +1 -0
- package/package.json +188 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
import quarterOfYear from 'dayjs/plugin/quarterOfYear';
|
|
3
|
+
import { FORMULA_COLUMN_TYPES_MAP, isNumber, TableUtils, Views } from 'dtable-store';
|
|
4
|
+
import { SUMMARY_TYPE } from '../../constants';
|
|
5
|
+
import StatUtils from '../../utils/stat-utils';
|
|
6
|
+
import { getCellValue } from '../../utils/row-utils';
|
|
7
|
+
import { getSummaryResult } from '../../utils/common-utils';
|
|
8
|
+
import { getCompareDate, summaryDurationResult } from '../../utils/trend-utils';
|
|
9
|
+
dayjs.extend(quarterOfYear);
|
|
10
|
+
function calculateStatItem(chart, value, username, userId) {
|
|
11
|
+
var table_id = chart.table_id,
|
|
12
|
+
view_id = chart.view_id,
|
|
13
|
+
date_column = chart.date_column,
|
|
14
|
+
date_granularity = chart.date_granularity,
|
|
15
|
+
summary_column = chart.summary_column,
|
|
16
|
+
summary_type = chart.summary_type,
|
|
17
|
+
summary_method = chart.summary_method;
|
|
18
|
+
var selectedTable = TableUtils.getTableById(value.tables, table_id);
|
|
19
|
+
var selectedView = selectedTable && Views.getViewById(selectedTable.views, view_id);
|
|
20
|
+
var selectedColumn = TableUtils.getTableColumnByKey(selectedTable, date_column);
|
|
21
|
+
var resultMap = new Map();
|
|
22
|
+
var formulaRows = {};
|
|
23
|
+
var rows = Views.getViewRows(selectedView, selectedTable, value, username, userId);
|
|
24
|
+
var numericColumn = TableUtils.getTableColumnByKey(selectedTable, summary_column);
|
|
25
|
+
if (summary_type === SUMMARY_TYPE.ADVANCED) {
|
|
26
|
+
if (FORMULA_COLUMN_TYPES_MAP[numericColumn.type]) {
|
|
27
|
+
formulaRows = Views.getTableFormulaResults(selectedTable, rows, value);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
var granularity = date_granularity;
|
|
31
|
+
if (date_granularity === 'days_7' || date_granularity === 'days_30') {
|
|
32
|
+
granularity = 'day';
|
|
33
|
+
}
|
|
34
|
+
rows.forEach(function (row) {
|
|
35
|
+
var dateValue = row[selectedColumn.key];
|
|
36
|
+
var label = StatUtils.getGroupLabel(dateValue, {}, selectedColumn, granularity, '', value);
|
|
37
|
+
if (dateValue) {
|
|
38
|
+
if (summary_type === SUMMARY_TYPE.COUNT) {
|
|
39
|
+
var currentCount = resultMap.get(label) || 0;
|
|
40
|
+
resultMap.set(label, currentCount + 1);
|
|
41
|
+
} else {
|
|
42
|
+
var formulaRow = formulaRows[row._id];
|
|
43
|
+
var numericValue = getCellValue(row, formulaRow, numericColumn);
|
|
44
|
+
var currentList = resultMap.get(label) || [];
|
|
45
|
+
if (isNumber(numericValue)) {
|
|
46
|
+
currentList.push(numericValue);
|
|
47
|
+
}
|
|
48
|
+
resultMap.set(label, currentList);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
var currentValues, previousValues;
|
|
53
|
+
if (date_granularity === 'days_30' || date_granularity === 'days_7') {
|
|
54
|
+
var _summaryDurationResul = summaryDurationResult(resultMap, date_granularity, summary_type, summary_column, false),
|
|
55
|
+
value1 = _summaryDurationResul.compareValue,
|
|
56
|
+
value2 = _summaryDurationResul.comparedValue;
|
|
57
|
+
currentValues = value1;
|
|
58
|
+
previousValues = value2;
|
|
59
|
+
} else {
|
|
60
|
+
var _getCompareDate = getCompareDate(date_granularity),
|
|
61
|
+
compareDate = _getCompareDate.compareDate,
|
|
62
|
+
comparedDate = _getCompareDate.comparedDate;
|
|
63
|
+
currentValues = resultMap.get(compareDate);
|
|
64
|
+
previousValues = resultMap.get(comparedDate);
|
|
65
|
+
if (summary_type === SUMMARY_TYPE.ADVANCED) {
|
|
66
|
+
if (currentValues) {
|
|
67
|
+
currentValues = getSummaryResult(currentValues, summary_method);
|
|
68
|
+
}
|
|
69
|
+
if (previousValues) {
|
|
70
|
+
previousValues = getSummaryResult(previousValues, summary_method);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (!currentValues) {
|
|
75
|
+
return {
|
|
76
|
+
latest: null,
|
|
77
|
+
previous: previousValues || null
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
if (!previousValues) {
|
|
81
|
+
return {
|
|
82
|
+
latest: currentValues,
|
|
83
|
+
previous: null
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
latest: currentValues,
|
|
88
|
+
previous: previousValues,
|
|
89
|
+
result: Math.abs(previousValues - currentValues) / previousValues,
|
|
90
|
+
type: currentValues > previousValues ? 'up' : 'down'
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
export default calculateStatItem;
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
4
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
5
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
6
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
7
|
+
import { filter2SqlCondition, TableUtils } from 'dtable-store';
|
|
8
|
+
import BaseCalculator from './base-calculator';
|
|
9
|
+
import { formatNumericValue, getSummaryColumnMethod } from '../utils/common-utils';
|
|
10
|
+
import { DTABLE_DB_SUMMARY_METHOD } from '../constants';
|
|
11
|
+
var WorldMapCalculator = /*#__PURE__*/function (_BaseCalculator) {
|
|
12
|
+
_inherits(WorldMapCalculator, _BaseCalculator);
|
|
13
|
+
var _super = _createSuper(WorldMapCalculator);
|
|
14
|
+
function WorldMapCalculator(_ref) {
|
|
15
|
+
var value = _ref.value,
|
|
16
|
+
statisticThreadManager = _ref.statisticThreadManager,
|
|
17
|
+
username = _ref.username,
|
|
18
|
+
userId = _ref.userId;
|
|
19
|
+
_classCallCheck(this, WorldMapCalculator);
|
|
20
|
+
return _super.call(this, {
|
|
21
|
+
value: value,
|
|
22
|
+
statisticThreadManager: statisticThreadManager,
|
|
23
|
+
username: username,
|
|
24
|
+
userId: userId
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
_createClass(WorldMapCalculator, [{
|
|
28
|
+
key: "isValidChart",
|
|
29
|
+
value: function isValidChart(chart) {
|
|
30
|
+
if (!this.validateBaseConfigs(chart)) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
var table_id = chart.table_id,
|
|
34
|
+
column = chart.column,
|
|
35
|
+
summary_column = chart.summary_column;
|
|
36
|
+
var table = this.getTableById(table_id);
|
|
37
|
+
var selectedColumn = column && TableUtils.getTableColumnByKey(table, column);
|
|
38
|
+
if (column && !selectedColumn) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
if (summary_column && !TableUtils.getTableColumnByKey(table, summary_column)) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
}, {
|
|
47
|
+
key: "calculate",
|
|
48
|
+
value: function () {
|
|
49
|
+
var _calculate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(chart) {
|
|
50
|
+
var convertedChart;
|
|
51
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
52
|
+
while (1) {
|
|
53
|
+
switch (_context.prev = _context.next) {
|
|
54
|
+
case 0:
|
|
55
|
+
if (this.isValidChart(chart)) {
|
|
56
|
+
_context.next = 2;
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
return _context.abrupt("return", []);
|
|
60
|
+
case 2:
|
|
61
|
+
if (!this.isCalcByQueryDB(chart)) {
|
|
62
|
+
_context.next = 6;
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
_context.next = 5;
|
|
66
|
+
return this.queryDb(chart);
|
|
67
|
+
case 5:
|
|
68
|
+
return _context.abrupt("return", _context.sent);
|
|
69
|
+
case 6:
|
|
70
|
+
convertedChart = this.convertChart(chart);
|
|
71
|
+
_context.next = 9;
|
|
72
|
+
return this.calculateWithWorker(convertedChart);
|
|
73
|
+
case 9:
|
|
74
|
+
return _context.abrupt("return", _context.sent);
|
|
75
|
+
case 10:
|
|
76
|
+
case "end":
|
|
77
|
+
return _context.stop();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}, _callee, this);
|
|
81
|
+
}));
|
|
82
|
+
function calculate(_x) {
|
|
83
|
+
return _calculate.apply(this, arguments);
|
|
84
|
+
}
|
|
85
|
+
return calculate;
|
|
86
|
+
}()
|
|
87
|
+
}, {
|
|
88
|
+
key: "queryDb",
|
|
89
|
+
value: function () {
|
|
90
|
+
var _queryDb = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(chart) {
|
|
91
|
+
var table_id, view_id, column, summary_type, summary_method, summary_column, selectedTable, selectedView, selectedColumn, columnName, isAdvanced, method, sqlCondition, summaryColumnName, summaryColumn, sqlString, summaryColumnMethod, result, data, newResult, _summaryColumnMethod, valueKey;
|
|
92
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
93
|
+
while (1) {
|
|
94
|
+
switch (_context2.prev = _context2.next) {
|
|
95
|
+
case 0:
|
|
96
|
+
table_id = chart.table_id, view_id = chart.view_id, column = chart.column, summary_type = chart.summary_type, summary_method = chart.summary_method, summary_column = chart.summary_column;
|
|
97
|
+
selectedTable = this.getTableById(table_id);
|
|
98
|
+
selectedView = this.getViewById(view_id, selectedTable);
|
|
99
|
+
selectedColumn = TableUtils.getTableColumnByKey(selectedTable, column);
|
|
100
|
+
if (selectedColumn) {
|
|
101
|
+
_context2.next = 6;
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
return _context2.abrupt("return", []);
|
|
105
|
+
case 6:
|
|
106
|
+
columnName = selectedColumn.name;
|
|
107
|
+
isAdvanced = summary_type === 'advanced';
|
|
108
|
+
method = isAdvanced ? DTABLE_DB_SUMMARY_METHOD[summary_method] : 'COUNT';
|
|
109
|
+
sqlCondition = filter2SqlCondition(selectedTable, selectedView);
|
|
110
|
+
summaryColumnName = '';
|
|
111
|
+
sqlString = '';
|
|
112
|
+
if (isAdvanced) {
|
|
113
|
+
summaryColumn = TableUtils.getTableColumnByKey(selectedTable, summary_column);
|
|
114
|
+
summaryColumnName = summaryColumn.name;
|
|
115
|
+
summaryColumnMethod = getSummaryColumnMethod(method, summaryColumnName);
|
|
116
|
+
sqlString = "select `".concat(columnName, "`, ").concat(summaryColumnMethod, " from ").concat(selectedTable.name, " ").concat(sqlCondition, " group by ").concat(columnName, " limit 5000");
|
|
117
|
+
} else {
|
|
118
|
+
sqlString = "select `".concat(columnName, "`, ").concat(method, "(").concat(columnName, ") from ").concat(selectedTable.name, " ").concat(sqlCondition, " group by ").concat(columnName, " limit 5000");
|
|
119
|
+
}
|
|
120
|
+
_context2.next = 15;
|
|
121
|
+
return this.sqlQuery(sqlString);
|
|
122
|
+
case 15:
|
|
123
|
+
result = _context2.sent;
|
|
124
|
+
if (!(result.status === 200 && result.data.success)) {
|
|
125
|
+
_context2.next = 25;
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
data = result.data;
|
|
129
|
+
if (data.results) {
|
|
130
|
+
_context2.next = 20;
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
return _context2.abrupt("return", []);
|
|
134
|
+
case 20:
|
|
135
|
+
newResult = [];
|
|
136
|
+
_summaryColumnMethod = getSummaryColumnMethod(method, summaryColumnName);
|
|
137
|
+
valueKey = isAdvanced ? "".concat(_summaryColumnMethod) : "".concat(method, "(").concat(columnName, ")");
|
|
138
|
+
data.results.forEach(function (item) {
|
|
139
|
+
var currentValue = item[column];
|
|
140
|
+
var value = item[valueKey];
|
|
141
|
+
if (isAdvanced) {
|
|
142
|
+
value = formatNumericValue(value, summaryColumn);
|
|
143
|
+
}
|
|
144
|
+
if (currentValue) {
|
|
145
|
+
var name = typeof currentValue === 'string' ? currentValue : currentValue.country_region;
|
|
146
|
+
newResult.push({
|
|
147
|
+
name: name,
|
|
148
|
+
value: value
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
return _context2.abrupt("return", newResult);
|
|
153
|
+
case 25:
|
|
154
|
+
return _context2.abrupt("return", []);
|
|
155
|
+
case 26:
|
|
156
|
+
case "end":
|
|
157
|
+
return _context2.stop();
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}, _callee2, this);
|
|
161
|
+
}));
|
|
162
|
+
function queryDb(_x2) {
|
|
163
|
+
return _queryDb.apply(this, arguments);
|
|
164
|
+
}
|
|
165
|
+
return queryDb;
|
|
166
|
+
}()
|
|
167
|
+
}, {
|
|
168
|
+
key: "convertChart",
|
|
169
|
+
value: function convertChart(chart) {
|
|
170
|
+
var _id = chart._id,
|
|
171
|
+
type = chart.type,
|
|
172
|
+
table_id = chart.table_id,
|
|
173
|
+
view_id = chart.view_id,
|
|
174
|
+
column = chart.column,
|
|
175
|
+
summary_type = chart.summary_type,
|
|
176
|
+
summary_column = chart.summary_column,
|
|
177
|
+
summary_method = chart.summary_method;
|
|
178
|
+
return {
|
|
179
|
+
_id: _id,
|
|
180
|
+
type: type,
|
|
181
|
+
table_id: table_id,
|
|
182
|
+
view_id: view_id,
|
|
183
|
+
geo_column: column,
|
|
184
|
+
summary_type: summary_type,
|
|
185
|
+
summary_method: summary_method,
|
|
186
|
+
summary_column: summary_column,
|
|
187
|
+
geolocation_granularity: 'country_region'
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
}]);
|
|
191
|
+
return WorldMapCalculator;
|
|
192
|
+
}(BaseCalculator);
|
|
193
|
+
export default WorldMapCalculator;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
function CommonAddTool(props) {
|
|
3
|
+
var callBack = props.callBack,
|
|
4
|
+
footerName = props.footerName,
|
|
5
|
+
className = props.className,
|
|
6
|
+
addIconClassName = props.addIconClassName;
|
|
7
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
8
|
+
className: "add-item-btn ".concat(className ? className : ''),
|
|
9
|
+
onClick: function onClick(e) {
|
|
10
|
+
callBack(e);
|
|
11
|
+
}
|
|
12
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
13
|
+
className: "dtable-font dtable-icon-add-table ".concat(addIconClassName || '')
|
|
14
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
15
|
+
className: "add-new-option text-truncate",
|
|
16
|
+
title: footerName
|
|
17
|
+
}, footerName));
|
|
18
|
+
}
|
|
19
|
+
export default CommonAddTool;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
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 } from 'react';
|
|
7
|
+
import intl from 'react-intl-universal';
|
|
8
|
+
import { Modal, ModalHeader, ModalBody } from 'reactstrap';
|
|
9
|
+
import ChartSelector from './chart-addition-widgets/chart-selector';
|
|
10
|
+
import StatEditor from '../../stat-editor';
|
|
11
|
+
var ChartAdditionEditDialog = /*#__PURE__*/function (_Component) {
|
|
12
|
+
_inherits(ChartAdditionEditDialog, _Component);
|
|
13
|
+
var _super = _createSuper(ChartAdditionEditDialog);
|
|
14
|
+
function ChartAdditionEditDialog(props) {
|
|
15
|
+
var _this;
|
|
16
|
+
_classCallCheck(this, ChartAdditionEditDialog);
|
|
17
|
+
_this = _super.call(this, props);
|
|
18
|
+
_this.addChart = function (chartType) {
|
|
19
|
+
var chart = _this.props.generateChart(chartType);
|
|
20
|
+
_this.setState({
|
|
21
|
+
chart: chart
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
_this.modifyChartName = function (name) {
|
|
25
|
+
var updatedChart = _objectSpread(_objectSpread({}, _this.state.chart), {}, {
|
|
26
|
+
name: name
|
|
27
|
+
});
|
|
28
|
+
_this.modifyChart(updatedChart);
|
|
29
|
+
};
|
|
30
|
+
_this.modifyChart = function (chart) {
|
|
31
|
+
_this.setState({
|
|
32
|
+
chart: chart
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
_this.state = {
|
|
36
|
+
chart: props.editingChart || null
|
|
37
|
+
};
|
|
38
|
+
return _this;
|
|
39
|
+
}
|
|
40
|
+
_createClass(ChartAdditionEditDialog, [{
|
|
41
|
+
key: "componentWillUnmount",
|
|
42
|
+
value: function componentWillUnmount() {
|
|
43
|
+
var chart = this.state.chart;
|
|
44
|
+
if (this.props.editingChart) {
|
|
45
|
+
this.props.modifyChart(chart);
|
|
46
|
+
} else {
|
|
47
|
+
this.props.addChart(chart);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}, {
|
|
51
|
+
key: "render",
|
|
52
|
+
value: function render() {
|
|
53
|
+
var _this$props = this.props,
|
|
54
|
+
getTableById = _this$props.getTableById,
|
|
55
|
+
colorThemeName = _this$props.colorThemeName,
|
|
56
|
+
labelColorConfigs = _this$props.labelColorConfigs,
|
|
57
|
+
chartCalculator = _this$props.chartCalculator,
|
|
58
|
+
eventBus = _this$props.eventBus;
|
|
59
|
+
var chart = this.state.chart;
|
|
60
|
+
var editMode = !!chart;
|
|
61
|
+
return /*#__PURE__*/React.createElement(Modal, {
|
|
62
|
+
isOpen: true,
|
|
63
|
+
toggle: this.props.hideChartAdditionDialog,
|
|
64
|
+
className: "statistic-chart-addition-dialog",
|
|
65
|
+
zIndex: 1048
|
|
66
|
+
}, /*#__PURE__*/React.createElement(ModalHeader, {
|
|
67
|
+
toggle: this.props.hideChartAdditionDialog
|
|
68
|
+
}, intl.get(editMode ? 'Edit_the_chart' : 'Choose_a_chart')), /*#__PURE__*/React.createElement(ModalBody, {
|
|
69
|
+
className: "statistic-modal-body"
|
|
70
|
+
}, editMode ? /*#__PURE__*/React.createElement(StatEditor, {
|
|
71
|
+
colorThemeName: colorThemeName,
|
|
72
|
+
statItem: chart,
|
|
73
|
+
labelColorConfigs: labelColorConfigs,
|
|
74
|
+
chartCalculator: chartCalculator,
|
|
75
|
+
eventBus: eventBus,
|
|
76
|
+
getTables: this.props.getTables,
|
|
77
|
+
getViews: this.props.getViews,
|
|
78
|
+
getTableById: getTableById,
|
|
79
|
+
modifyChartName: this.modifyChartName,
|
|
80
|
+
modifyChart: this.modifyChart,
|
|
81
|
+
toggleStatisticRecordsDialog: this.props.toggleStatisticRecordsDialog
|
|
82
|
+
}) : /*#__PURE__*/React.createElement(ChartSelector, {
|
|
83
|
+
addEditingChart: this.addChart
|
|
84
|
+
})));
|
|
85
|
+
}
|
|
86
|
+
}]);
|
|
87
|
+
return ChartAdditionEditDialog;
|
|
88
|
+
}(Component);
|
|
89
|
+
export default ChartAdditionEditDialog;
|
|
@@ -0,0 +1,261 @@
|
|
|
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 from 'react';
|
|
6
|
+
import { UncontrolledTooltip } from 'reactstrap';
|
|
7
|
+
import intl from 'react-intl-universal';
|
|
8
|
+
import { STAT_TYPE } from '../../../constants';
|
|
9
|
+
import { getImageUrl } from '../../../utils/common-utils';
|
|
10
|
+
import styles from './statistic-chart-selector.module.css';
|
|
11
|
+
var ChartSelector = /*#__PURE__*/function (_React$Component) {
|
|
12
|
+
_inherits(ChartSelector, _React$Component);
|
|
13
|
+
var _super = _createSuper(ChartSelector);
|
|
14
|
+
function ChartSelector(props) {
|
|
15
|
+
var _this;
|
|
16
|
+
_classCallCheck(this, ChartSelector);
|
|
17
|
+
_this = _super.call(this, props);
|
|
18
|
+
_this.setCurrentCatIndex = function (index, e) {
|
|
19
|
+
// in `dtable` project, there is `window.addEventListener('popstate', this.onHistoryState);`
|
|
20
|
+
// don't use anchor links here to avoid triggering 'popstate' event
|
|
21
|
+
e.preventDefault();
|
|
22
|
+
_this.setState({
|
|
23
|
+
currentCatIndex: index
|
|
24
|
+
});
|
|
25
|
+
document.getElementById('chart-types-container').scrollTop = document.getElementById("chart-type-".concat(index + 1)).offsetTop - 17;
|
|
26
|
+
};
|
|
27
|
+
_this.state = {
|
|
28
|
+
currentCatIndex: 0
|
|
29
|
+
};
|
|
30
|
+
var lang = window.dtable && window.dtable.lang || 'zh-cn';
|
|
31
|
+
_this.chartTypes = [{
|
|
32
|
+
catTitle: intl.get('Histogram'),
|
|
33
|
+
icon: 'dtable-icon-histogram',
|
|
34
|
+
items: [{
|
|
35
|
+
type: STAT_TYPE.BAR,
|
|
36
|
+
title: intl.get('Basic_histogram'),
|
|
37
|
+
image: 'bar.png'
|
|
38
|
+
}, {
|
|
39
|
+
type: STAT_TYPE.BAR_GROUP,
|
|
40
|
+
title: intl.get('Grouped_histogram'),
|
|
41
|
+
image: 'bar-group.png'
|
|
42
|
+
}, {
|
|
43
|
+
type: STAT_TYPE.BAR_STACK,
|
|
44
|
+
title: intl.get('Stacked_histogram'),
|
|
45
|
+
image: 'bar-stack.png'
|
|
46
|
+
}, {
|
|
47
|
+
type: STAT_TYPE.COMPARE_BAR,
|
|
48
|
+
title: intl.get('Time_comparison_histogram'),
|
|
49
|
+
image: 'compared-chart.png'
|
|
50
|
+
}, {
|
|
51
|
+
type: STAT_TYPE.CUSTOM_BAR,
|
|
52
|
+
title: intl.get('Custom_histogram'),
|
|
53
|
+
image: 'custom-bar.png'
|
|
54
|
+
}]
|
|
55
|
+
}, {
|
|
56
|
+
catTitle: intl.get('Bar_chart'),
|
|
57
|
+
icon: 'dtable-icon-bar-chart',
|
|
58
|
+
items: [{
|
|
59
|
+
type: STAT_TYPE.HORIZONTAL_BAR,
|
|
60
|
+
title: intl.get('Basic_bar_chart'),
|
|
61
|
+
image: 'horizontal-bar.png'
|
|
62
|
+
}, {
|
|
63
|
+
type: STAT_TYPE.HORIZONTAL_GROUP_BAR,
|
|
64
|
+
title: intl.get('Grouped_bar_chart'),
|
|
65
|
+
image: 'horizontal-group-bar.png'
|
|
66
|
+
}, {
|
|
67
|
+
type: STAT_TYPE.STACKED_HORIZONTAL_BAR,
|
|
68
|
+
title: intl.get('Stacked_bar_chart'),
|
|
69
|
+
image: 'stacked-horizontal-bar.png'
|
|
70
|
+
}, {
|
|
71
|
+
type: STAT_TYPE.COMPLETENESS_CHART,
|
|
72
|
+
title: intl.get('Completeness_chart'),
|
|
73
|
+
image: 'completeness-chart.png'
|
|
74
|
+
}, {
|
|
75
|
+
type: STAT_TYPE.GROUP_COMPLETENESS_CHART,
|
|
76
|
+
title: intl.get('Grouped_completeness_chart'),
|
|
77
|
+
image: 'group-completeness-chart.png'
|
|
78
|
+
}]
|
|
79
|
+
}, {
|
|
80
|
+
catTitle: intl.get('Line_chart'),
|
|
81
|
+
icon: 'dtable-icon-line-chart',
|
|
82
|
+
items: [{
|
|
83
|
+
type: STAT_TYPE.LINE,
|
|
84
|
+
title: intl.get('Basic_line_chart'),
|
|
85
|
+
image: 'line.png'
|
|
86
|
+
}, {
|
|
87
|
+
type: STAT_TYPE.GROUP_LINE,
|
|
88
|
+
title: intl.get('Grouped_line_chart'),
|
|
89
|
+
image: 'group_line.png'
|
|
90
|
+
}]
|
|
91
|
+
}, {
|
|
92
|
+
catTitle: intl.get('Area_chart'),
|
|
93
|
+
icon: 'dtable-icon-area-chart',
|
|
94
|
+
items: [{
|
|
95
|
+
type: STAT_TYPE.AREA_CHART,
|
|
96
|
+
title: intl.get('Area_chart'),
|
|
97
|
+
image: 'area-chart.png'
|
|
98
|
+
}, {
|
|
99
|
+
type: STAT_TYPE.AREA_GROUP_CHART,
|
|
100
|
+
title: intl.get('Grouped_area_chart'),
|
|
101
|
+
image: 'area-group-chart.png'
|
|
102
|
+
}]
|
|
103
|
+
}, {
|
|
104
|
+
catTitle: intl.get('Pie_chart'),
|
|
105
|
+
icon: 'dtable-icon-pie-chart',
|
|
106
|
+
items: [{
|
|
107
|
+
type: STAT_TYPE.PIE,
|
|
108
|
+
title: intl.get('Basic_pie_chart'),
|
|
109
|
+
image: 'pie.png'
|
|
110
|
+
}, {
|
|
111
|
+
type: STAT_TYPE.RING,
|
|
112
|
+
title: intl.get('Ring_chart'),
|
|
113
|
+
image: 'ring.png'
|
|
114
|
+
}]
|
|
115
|
+
}, {
|
|
116
|
+
catTitle: intl.get('Scatter_chart'),
|
|
117
|
+
icon: 'dtable-icon-scatter-chart',
|
|
118
|
+
items: [{
|
|
119
|
+
type: STAT_TYPE.SCATTER,
|
|
120
|
+
title: intl.get('Scatter_chart'),
|
|
121
|
+
image: 'scatter.png'
|
|
122
|
+
}]
|
|
123
|
+
}, {
|
|
124
|
+
catTitle: intl.get('Combination_chart'),
|
|
125
|
+
icon: 'dtable-icon-combination-chart',
|
|
126
|
+
items: [{
|
|
127
|
+
type: STAT_TYPE.COMBINATION_CHART,
|
|
128
|
+
title: intl.get('Combination_chart'),
|
|
129
|
+
image: 'combination-chart.png'
|
|
130
|
+
}]
|
|
131
|
+
}, {
|
|
132
|
+
catTitle: intl.get('Map'),
|
|
133
|
+
icon: 'dtable-icon-map',
|
|
134
|
+
items: [{
|
|
135
|
+
type: STAT_TYPE.MAP,
|
|
136
|
+
title: '中国地图',
|
|
137
|
+
image: 'map.png',
|
|
138
|
+
hide: lang != 'zh-cn'
|
|
139
|
+
}, {
|
|
140
|
+
type: STAT_TYPE.MAP_BUBBLE,
|
|
141
|
+
title: '中国地图(气泡图)',
|
|
142
|
+
image: 'map-bubble.png',
|
|
143
|
+
hide: lang != 'zh-cn'
|
|
144
|
+
}, {
|
|
145
|
+
type: STAT_TYPE.WORLD_MAP,
|
|
146
|
+
title: intl.get('World_map'),
|
|
147
|
+
image: 'world-map.png'
|
|
148
|
+
}, {
|
|
149
|
+
type: STAT_TYPE.WORLD_MAP_BUBBLE,
|
|
150
|
+
title: "".concat(intl.get('World_map'), "(").concat(intl.get('Bubble'), ")"),
|
|
151
|
+
image: 'world-map-bubble.png'
|
|
152
|
+
}]
|
|
153
|
+
}, {
|
|
154
|
+
catTitle: intl.get('Heat_map'),
|
|
155
|
+
icon: 'dtable-icon-heat-map',
|
|
156
|
+
items: [{
|
|
157
|
+
type: STAT_TYPE.HEAT_MAP,
|
|
158
|
+
title: intl.get('Heat_map'),
|
|
159
|
+
image: 'heat-map.png'
|
|
160
|
+
}]
|
|
161
|
+
}, {
|
|
162
|
+
catTitle: intl.get('Facet_chart'),
|
|
163
|
+
icon: 'dtable-icon-facet-chart',
|
|
164
|
+
items: [{
|
|
165
|
+
type: STAT_TYPE.MIRROR,
|
|
166
|
+
title: intl.get('Mirror_chart'),
|
|
167
|
+
image: 'mirror.png'
|
|
168
|
+
}]
|
|
169
|
+
}, {
|
|
170
|
+
catTitle: intl.get('Card'),
|
|
171
|
+
icon: 'dtable-icon-card',
|
|
172
|
+
items: [{
|
|
173
|
+
type: STAT_TYPE.BASIC_NUMBER_CARD,
|
|
174
|
+
title: intl.get('Basic_number_card'),
|
|
175
|
+
image: 'number-card.png'
|
|
176
|
+
}, {
|
|
177
|
+
type: STAT_TYPE.TREND_CHART,
|
|
178
|
+
title: intl.get('Trend_chart'),
|
|
179
|
+
image: 'trend-chart.png'
|
|
180
|
+
}]
|
|
181
|
+
}, {
|
|
182
|
+
catTitle: intl.get('Gauge'),
|
|
183
|
+
icon: 'dtable-icon-gauge',
|
|
184
|
+
items: [{
|
|
185
|
+
type: STAT_TYPE.DASHBOARD,
|
|
186
|
+
title: intl.get('Gauge'),
|
|
187
|
+
image: 'dashboard-chart.png'
|
|
188
|
+
}]
|
|
189
|
+
}, {
|
|
190
|
+
catTitle: intl.get('Treemap'),
|
|
191
|
+
icon: 'dtable-icon-rectangular-tree-diagram',
|
|
192
|
+
items: [{
|
|
193
|
+
type: STAT_TYPE.TREEMAP,
|
|
194
|
+
title: intl.get('Treemap'),
|
|
195
|
+
image: 'treemap.png'
|
|
196
|
+
}]
|
|
197
|
+
}, {
|
|
198
|
+
catTitle: intl.get('Pivot_table'),
|
|
199
|
+
icon: 'dtable-icon-dtable-logo',
|
|
200
|
+
items: [{
|
|
201
|
+
type: STAT_TYPE.PIVOT_TABLE,
|
|
202
|
+
title: intl.get('Pivot_table'),
|
|
203
|
+
image: 'pivot-table.png'
|
|
204
|
+
}]
|
|
205
|
+
}];
|
|
206
|
+
return _this;
|
|
207
|
+
}
|
|
208
|
+
_createClass(ChartSelector, [{
|
|
209
|
+
key: "render",
|
|
210
|
+
value: function render() {
|
|
211
|
+
var _this2 = this;
|
|
212
|
+
var currentCatIndex = this.state.currentCatIndex;
|
|
213
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
214
|
+
className: "".concat(styles['statistic-types-container'], " d-flex flex-column h-100")
|
|
215
|
+
}, /*#__PURE__*/React.createElement("ul", {
|
|
216
|
+
className: "".concat(styles['chart-categories-nav'], " flex-shrink-0 d-flex flex-wrap align-items-center list-unstyled")
|
|
217
|
+
}, this.chartTypes.map(function (item, index) {
|
|
218
|
+
return /*#__PURE__*/React.createElement("li", {
|
|
219
|
+
key: index,
|
|
220
|
+
className: 'px-4 py-2 chart-cat-nav-item'
|
|
221
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
222
|
+
id: item.icon,
|
|
223
|
+
className: "".concat(styles['chart-icon'], " dtable-font ").concat(item.icon, " ").concat(currentCatIndex === index ? "".concat(styles['icon-highlight']) : ''),
|
|
224
|
+
onClick: _this2.setCurrentCatIndex.bind(_this2, index)
|
|
225
|
+
}), /*#__PURE__*/React.createElement(UncontrolledTooltip, {
|
|
226
|
+
placement: "bottom",
|
|
227
|
+
target: item.icon
|
|
228
|
+
}, item.catTitle));
|
|
229
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
230
|
+
id: "chart-types-container",
|
|
231
|
+
className: "flex-fill o-auto ".concat(styles['statistic-type'])
|
|
232
|
+
}, this.chartTypes.map(function (item, index) {
|
|
233
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
234
|
+
key: "chart-type-".concat(index),
|
|
235
|
+
className: "mb-7"
|
|
236
|
+
}, /*#__PURE__*/React.createElement("h3", {
|
|
237
|
+
className: "".concat(styles['statistic-type-title'], " m-0"),
|
|
238
|
+
id: "chart-type-".concat(index + 1)
|
|
239
|
+
}, item.catTitle), /*#__PURE__*/React.createElement("div", {
|
|
240
|
+
className: 'd-flex flex-wrap'
|
|
241
|
+
}, item.items.map(function (chart, index) {
|
|
242
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
243
|
+
key: index,
|
|
244
|
+
onClick: _this2.props.addEditingChart.bind(_this2, chart.type),
|
|
245
|
+
className: "".concat(styles['statistic-type-item'], " ").concat(chart.hide ? 'd-none' : '')
|
|
246
|
+
}, /*#__PURE__*/React.createElement("p", {
|
|
247
|
+
className: "".concat(styles['statistic-type-description'])
|
|
248
|
+
}, chart.title), /*#__PURE__*/React.createElement("div", {
|
|
249
|
+
className: "".concat(styles['statistic-type-image-container'])
|
|
250
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
251
|
+
src: getImageUrl(chart.image),
|
|
252
|
+
alt: "",
|
|
253
|
+
className: "".concat(styles['statistic-type-demo-chart-image'])
|
|
254
|
+
})));
|
|
255
|
+
})));
|
|
256
|
+
})));
|
|
257
|
+
}
|
|
258
|
+
}]);
|
|
259
|
+
return ChartSelector;
|
|
260
|
+
}(React.Component);
|
|
261
|
+
export default ChartSelector;
|