sea-chart 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/lib/assets/icons/area-chart.svg +10 -0
- package/lib/assets/icons/bar-chart.svg +12 -0
- package/lib/assets/icons/card.svg +22 -0
- package/lib/assets/icons/combination-chart.svg +17 -0
- package/lib/assets/icons/dtable-logo.svg +16 -0
- package/lib/assets/icons/facet-chart.svg +12 -0
- package/lib/assets/icons/gauge.svg +18 -0
- package/lib/assets/icons/heat-map.svg +14 -0
- package/lib/assets/icons/histogram.svg +12 -0
- package/lib/assets/icons/line-chart.svg +12 -0
- package/lib/assets/icons/map.svg +20 -0
- package/lib/assets/icons/pie-chart.svg +11 -0
- package/lib/assets/icons/rectangular-tree-diagram.svg +10 -0
- package/lib/assets/icons/scatter-chart.svg +15 -0
- package/lib/assets/icons/type-change.svg +17 -0
- package/lib/assets/img/area-chart.png +0 -0
- package/lib/assets/img/area-group-chart.png +0 -0
- package/lib/assets/img/bar-group.png +0 -0
- package/lib/assets/img/bar-stack.png +0 -0
- package/lib/assets/img/bar.png +0 -0
- package/lib/assets/img/combination-chart.png +0 -0
- package/lib/assets/img/compared-chart.png +0 -0
- package/lib/assets/img/completeness-chart.png +0 -0
- package/lib/assets/img/custom-bar.png +0 -0
- package/lib/assets/img/dashboard-chart.png +0 -0
- package/lib/assets/img/group-completeness-chart.png +0 -0
- package/lib/assets/img/group_line.png +0 -0
- package/lib/assets/img/heat-map.png +0 -0
- package/lib/assets/img/horizontal-bar.png +0 -0
- package/lib/assets/img/horizontal-group-bar.png +0 -0
- package/lib/assets/img/line.png +0 -0
- package/lib/assets/img/map-bubble.png +0 -0
- package/lib/assets/img/map.png +0 -0
- package/lib/assets/img/mirror.png +0 -0
- package/lib/assets/img/number-card.png +0 -0
- package/lib/assets/img/pie.png +0 -0
- package/lib/assets/img/pivot-table.png +0 -0
- package/lib/assets/img/ring.png +0 -0
- package/lib/assets/img/scatter.png +0 -0
- package/lib/assets/img/stacked-horizontal-bar.png +0 -0
- package/lib/assets/img/treemap.png +0 -0
- package/lib/assets/img/trend-chart.png +0 -0
- package/lib/assets/img/world-map-bubble.png +0 -0
- package/lib/assets/img/world-map.png +0 -0
- package/lib/components/collaborator/index.js +24 -0
- package/lib/components/formatter/area.js +162 -0
- package/lib/components/formatter/bar-group.js +160 -0
- package/lib/components/formatter/bar.js +150 -0
- package/lib/components/formatter/basic-number-card.js +138 -0
- package/lib/components/formatter/chart-component.js +266 -0
- package/lib/components/formatter/combination.js +407 -0
- package/lib/components/formatter/dashboard.js +182 -0
- package/lib/components/formatter/horizontal-bar-group.js +161 -0
- package/lib/components/formatter/horizontal-bar.js +152 -0
- package/lib/components/formatter/horizontal-component.js +91 -0
- package/lib/components/formatter/index.js +181 -0
- package/lib/components/formatter/line-group.js +157 -0
- package/lib/components/formatter/line.js +170 -0
- package/lib/components/formatter/pie.js +201 -0
- package/lib/components/formatter/ring.js +277 -0
- package/lib/components/formatter/table/index.css +103 -0
- package/lib/components/formatter/table/index.js +42 -0
- package/lib/components/formatter/table/one-dimension-table-no-numeric-columns.js +145 -0
- package/lib/components/formatter/table/one-dimension-table-with-numeric-columns.js +193 -0
- package/lib/components/formatter/table/pivot-table-display-name.js +249 -0
- package/lib/components/formatter/table/two-dimension-table.js +241 -0
- package/lib/components/formatter/treemap.js +213 -0
- package/lib/components/icon/index.css +5 -0
- package/lib/components/icon/index.js +22 -0
- package/lib/components/index.js +5 -0
- package/lib/components/loading/index.css +54 -0
- package/lib/components/loading/index.js +10 -0
- package/lib/components/number-input/index.js +31 -0
- package/lib/components/pixel-editor/index.css +29 -0
- package/lib/components/pixel-editor/index.js +42 -0
- package/lib/components/select-group/index.css +67 -0
- package/lib/components/select-group/index.js +63 -0
- package/lib/components/settings/advance-bar-settings/data-settings.js +120 -0
- package/lib/components/settings/advance-bar-settings/index.js +3 -0
- package/lib/components/settings/advance-bar-settings/style-settings.js +149 -0
- package/lib/components/settings/bar-settings/data-settings.js +137 -0
- package/lib/components/settings/bar-settings/index.js +3 -0
- package/lib/components/settings/bar-settings/style-settings.js +163 -0
- package/lib/components/settings/basic-number-card/data-settings.js +121 -0
- package/lib/components/settings/basic-number-card/index.js +3 -0
- package/lib/components/settings/basic-number-card/style-settings.js +42 -0
- package/lib/components/settings/combination-settings/data-settings.js +256 -0
- package/lib/components/settings/combination-settings/index.js +3 -0
- package/lib/components/settings/combination-settings/style-settings.js +183 -0
- package/lib/components/settings/dashboard-settings/data-settings.js +167 -0
- package/lib/components/settings/dashboard-settings/index.js +2 -0
- package/lib/components/settings/data-settings.js +67 -0
- package/lib/components/settings/horizontal-bar-settings/data-settings.js +45 -0
- package/lib/components/settings/horizontal-bar-settings/index.js +3 -0
- package/lib/components/settings/horizontal-bar-settings/style-settings.js +38 -0
- package/lib/components/settings/index.css +73 -0
- package/lib/components/settings/index.js +74 -0
- package/lib/components/settings/pie-settings/data-settings.js +123 -0
- package/lib/components/settings/pie-settings/index.js +3 -0
- package/lib/components/settings/pie-settings/style-settings.js +123 -0
- package/lib/components/settings/style-settings.js +100 -0
- package/lib/components/settings/table-settings/data-settings.js +488 -0
- package/lib/components/settings/table-settings/index.js +2 -0
- package/lib/components/settings/time-comparison-settings/data-settings.js +157 -0
- package/lib/components/settings/time-comparison-settings/index.js +3 -0
- package/lib/components/settings/time-comparison-settings/style-settings.js +191 -0
- package/lib/components/settings/widgets/basic-summary/index.css +12 -0
- package/lib/components/settings/widgets/basic-summary/index.js +173 -0
- package/lib/components/settings/widgets/common-data-settings.js +42 -0
- package/lib/components/settings/widgets/data-filter/index.css +17 -0
- package/lib/components/settings/widgets/data-filter/index.js +76 -0
- package/lib/components/settings/widgets/data-sort.js +38 -0
- package/lib/components/settings/widgets/date-summary-item.js +126 -0
- package/lib/components/settings/widgets/display-values-settings/index.css +13 -0
- package/lib/components/settings/widgets/display-values-settings/index.js +37 -0
- package/lib/components/settings/widgets/divider/index.css +4 -0
- package/lib/components/settings/widgets/divider/index.js +10 -0
- package/lib/components/settings/widgets/font-settings/font-size-settings.js +31 -0
- package/lib/components/settings/widgets/font-settings/font-weight-settings.js +46 -0
- package/lib/components/settings/widgets/font-settings/index.js +3 -0
- package/lib/components/settings/widgets/group-by.js +168 -0
- package/lib/components/settings/widgets/label-color.js +30 -0
- package/lib/components/settings/widgets/min-max-setting.js +64 -0
- package/lib/components/settings/widgets/mininum-slice-percent.js +72 -0
- package/lib/components/settings/widgets/numeric-summary-item.js +109 -0
- package/lib/components/settings/widgets/select-table/index.css +0 -0
- package/lib/components/settings/widgets/select-table/index.js +49 -0
- package/lib/components/settings/widgets/stack.js +58 -0
- package/lib/components/settings/widgets/statistic-type/index.css +31 -0
- package/lib/components/settings/widgets/statistic-type/index.js +54 -0
- package/lib/components/settings/widgets/summary-method-setting.js +80 -0
- package/lib/components/settings/widgets/summary-settings.js +394 -0
- package/lib/components/settings/widgets/switch/index.css +37 -0
- package/lib/components/settings/widgets/switch/index.js +21 -0
- package/lib/components/settings/widgets/text-horizontal-settings.js +23 -0
- package/lib/components/settings/widgets/time-picker.js +182 -0
- package/lib/components/settings/widgets/title-settings/index.js +58 -0
- package/lib/components/settings/widgets/title-settings/title-text.js +31 -0
- package/lib/components/settings/widgets/x-axios.js +0 -0
- package/lib/components/settings/widgets/y-axis-group-settings.js +399 -0
- package/lib/components/types-dialog/index.css +97 -0
- package/lib/components/types-dialog/index.js +127 -0
- package/lib/constants/geolocation.js +11 -0
- package/lib/constants/index.js +164 -0
- package/lib/constants/model.js +167 -0
- package/lib/constants/style.js +13 -0
- package/lib/constants/type-image.js +32 -0
- package/lib/constants/type.js +97 -0
- package/lib/context.js +49 -0
- package/lib/index.js +6 -0
- package/lib/intl.js +37 -0
- package/lib/layout/index.js +4 -0
- package/lib/layout/statistic/index.css +53 -0
- package/lib/layout/statistic/index.js +190 -0
- package/lib/layout/title/index.css +3 -0
- package/lib/layout/title/index.js +41 -0
- package/lib/locale/index.js +11 -0
- package/lib/locale/lang/de.js +141 -0
- package/lib/locale/lang/en.js +143 -0
- package/lib/locale/lang/es.js +141 -0
- package/lib/locale/lang/fr.js +141 -0
- package/lib/locale/lang/pt.js +141 -0
- package/lib/locale/lang/ru.js +141 -0
- package/lib/locale/lang/zh_CN.js +143 -0
- package/lib/model/area-group.js +51 -0
- package/lib/model/area.js +42 -0
- package/lib/model/bar-group.js +54 -0
- package/lib/model/bar-stack.js +51 -0
- package/lib/model/bar.js +48 -0
- package/lib/model/base-model.js +11 -0
- package/lib/model/basic-number-card.js +32 -0
- package/lib/model/combination.js +48 -0
- package/lib/model/compare-bar.js +49 -0
- package/lib/model/completeness-group.js +34 -0
- package/lib/model/completeness.js +28 -0
- package/lib/model/dashboard.js +26 -0
- package/lib/model/generic-model.js +235 -0
- package/lib/model/heat-map.js +33 -0
- package/lib/model/horizontal-bar.js +48 -0
- package/lib/model/horizontal-group-bar.js +53 -0
- package/lib/model/index.js +36 -0
- package/lib/model/line-group.js +54 -0
- package/lib/model/line.js +48 -0
- package/lib/model/map-bubble.js +37 -0
- package/lib/model/map.js +37 -0
- package/lib/model/mirror.js +36 -0
- package/lib/model/pie.js +36 -0
- package/lib/model/ring.js +36 -0
- package/lib/model/scatter.js +29 -0
- package/lib/model/stacked-horizontal-bar.js +42 -0
- package/lib/model/statistic.js +22 -0
- package/lib/model/table.js +33 -0
- package/lib/model/tree-map.js +30 -0
- package/lib/model/trend.js +34 -0
- package/lib/model/user.js +22 -0
- package/lib/model/world-map-bubble.js +36 -0
- package/lib/model/world-map.js +36 -0
- package/lib/utils/cell-format-utils.js +41 -0
- package/lib/utils/chart.js +6 -0
- package/lib/utils/collaborator-utils.js +40 -0
- package/lib/utils/column-utils.js +247 -0
- package/lib/utils/custom-g2.js +612 -0
- package/lib/utils/data-filter/filter-item-utils.js +80 -0
- package/lib/utils/data-filter/filters-utils.js +406 -0
- package/lib/utils/data-filter/index.js +3 -0
- package/lib/utils/date-translate.js +66 -0
- package/lib/utils/index.js +50 -0
- package/lib/utils/key-generator.js +13 -0
- package/lib/utils/object-utils.js +61 -0
- package/lib/utils/options-utils.js +61 -0
- package/lib/utils/statistic-column-2-sql-column-utils.js +499 -0
- package/lib/utils/statistic-utils.js +1685 -0
- package/package.json +160 -0
|
@@ -0,0 +1,109 @@
|
|
|
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 } from 'react';
|
|
6
|
+
import DTableSelect from "dtable-ui-component/lib/DTableSelect";
|
|
7
|
+
import { FormGroup, Label } from 'reactstrap';
|
|
8
|
+
import shallowEqual from 'shallowequal';
|
|
9
|
+
import { STATISTIC_TYPE, STATISTIC_SUMMARY_CALCULATION_METHOD, STATISTIC_SUMMARY_SHOW, STATISTIC_DATE_SUMMARY_CALCULATION_METHOD } from '../../../constants';
|
|
10
|
+
import { StatisticsUtils } from '../../../utils';
|
|
11
|
+
import intl from '../../../intl';
|
|
12
|
+
var NumericSummaryItem = /*#__PURE__*/function (_Component) {
|
|
13
|
+
_inherits(NumericSummaryItem, _Component);
|
|
14
|
+
var _super = _createSuper(NumericSummaryItem);
|
|
15
|
+
function NumericSummaryItem(_props) {
|
|
16
|
+
var _this;
|
|
17
|
+
_classCallCheck(this, NumericSummaryItem);
|
|
18
|
+
_this = _super.call(this, _props);
|
|
19
|
+
_this.initSummaryMethodOptions = function (props) {
|
|
20
|
+
var value = props.value,
|
|
21
|
+
numericColumnOptions = props.numericColumnOptions;
|
|
22
|
+
var selectedOption = numericColumnOptions.find(function (item) {
|
|
23
|
+
return item.value.key === value.column_key;
|
|
24
|
+
});
|
|
25
|
+
var summaryMethodOptions = selectedOption && StatisticsUtils.isDateSummaryColumn(selectedOption.value) ? STATISTIC_DATE_SUMMARY_CALCULATION_METHOD : STATISTIC_SUMMARY_CALCULATION_METHOD;
|
|
26
|
+
_this.summaryMethodOptions = summaryMethodOptions.map(function (item) {
|
|
27
|
+
return {
|
|
28
|
+
value: item,
|
|
29
|
+
label: intl.get(STATISTIC_SUMMARY_SHOW[item])
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
_this.onToggleExpand = function () {
|
|
34
|
+
_this.setState({
|
|
35
|
+
isExpand: !_this.state.isExpand
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
_this.state = {
|
|
39
|
+
isExpand: true
|
|
40
|
+
};
|
|
41
|
+
_this.initSummaryMethodOptions(_props);
|
|
42
|
+
return _this;
|
|
43
|
+
}
|
|
44
|
+
_createClass(NumericSummaryItem, [{
|
|
45
|
+
key: "UNSAFE_componentWillReceiveProps",
|
|
46
|
+
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
47
|
+
if (!shallowEqual(this.props.value, nextProps.value)) {
|
|
48
|
+
this.initSummaryMethodOptions(nextProps);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}, {
|
|
52
|
+
key: "render",
|
|
53
|
+
value: function render() {
|
|
54
|
+
var _this2 = this;
|
|
55
|
+
var _this$props = this.props,
|
|
56
|
+
index = _this$props.index,
|
|
57
|
+
statistic = _this$props.statistic,
|
|
58
|
+
value = _this$props.value,
|
|
59
|
+
numericColumnOptions = _this$props.numericColumnOptions;
|
|
60
|
+
var type = statistic.config.type;
|
|
61
|
+
var column_key = value.column_key,
|
|
62
|
+
summary_method = value.summary_method;
|
|
63
|
+
var selectedColumnOption = numericColumnOptions.find(function (option) {
|
|
64
|
+
return option.value.key === column_key;
|
|
65
|
+
});
|
|
66
|
+
var selectedSummaryMethodOption = this.summaryMethodOptions.find(function (option) {
|
|
67
|
+
return option.value === summary_method;
|
|
68
|
+
});
|
|
69
|
+
var isExpand = this.state.isExpand;
|
|
70
|
+
var isFirst = index === 0;
|
|
71
|
+
return /*#__PURE__*/React.createElement(FormGroup, {
|
|
72
|
+
className: "seastatistic-parameter-item"
|
|
73
|
+
}, /*#__PURE__*/React.createElement(Label, {
|
|
74
|
+
className: "numeric-summary-item d-flex align-items-center justify-content-between w-100"
|
|
75
|
+
}, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("i", {
|
|
76
|
+
onClick: this.onToggleExpand,
|
|
77
|
+
className: "numeric-summary-item-icon dtable-font mr-2 ".concat(isExpand ? 'dtable-icon-drop-down' : 'dtable-icon-right-slide')
|
|
78
|
+
}), /*#__PURE__*/React.createElement("span", null, (type === STATISTIC_TYPE.TABLE ? intl.get('Summary_field') : intl.get('Numeric_field')) + ' ' + (1 + index))), !isFirst && /*#__PURE__*/React.createElement("div", {
|
|
79
|
+
className: "delete-numeric-summary-item-content close d-flex align-items-center justify-content-center",
|
|
80
|
+
onClick: function onClick() {
|
|
81
|
+
return _this2.props.onDelete(index);
|
|
82
|
+
}
|
|
83
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
84
|
+
className: "dtable-font dtable-icon-fork-number delete-icon"
|
|
85
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
86
|
+
className: "pl-4 ".concat(isExpand ? 'expanded-numeric-summary-content' : 'collapsed-numeric-summary-content d-none')
|
|
87
|
+
}, /*#__PURE__*/React.createElement(FormGroup, {
|
|
88
|
+
className: "seastatistic-parameter-item numeric-column"
|
|
89
|
+
}, /*#__PURE__*/React.createElement(DTableSelect, {
|
|
90
|
+
value: selectedColumnOption,
|
|
91
|
+
placeholder: intl.get('Select_a_column'),
|
|
92
|
+
onChange: function onChange(option) {
|
|
93
|
+
return _this2.props.onColumnOptionChange(option, index);
|
|
94
|
+
},
|
|
95
|
+
options: numericColumnOptions
|
|
96
|
+
})), /*#__PURE__*/React.createElement(FormGroup, {
|
|
97
|
+
className: "seastatistic-parameter-item summary-method"
|
|
98
|
+
}, /*#__PURE__*/React.createElement(Label, null, intl.get('Summary_method')), /*#__PURE__*/React.createElement(DTableSelect, {
|
|
99
|
+
value: selectedSummaryMethodOption,
|
|
100
|
+
onChange: function onChange(option) {
|
|
101
|
+
return _this2.props.onSummaryMethodChange(option, index);
|
|
102
|
+
},
|
|
103
|
+
options: this.summaryMethodOptions
|
|
104
|
+
}))));
|
|
105
|
+
}
|
|
106
|
+
}]);
|
|
107
|
+
return NumericSummaryItem;
|
|
108
|
+
}(Component);
|
|
109
|
+
export default NumericSummaryItem;
|
|
File without changes
|
|
@@ -0,0 +1,49 @@
|
|
|
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 { Label, FormGroup } from 'reactstrap';
|
|
7
|
+
import DTableSelect from "dtable-ui-component/lib/DTableSelect";
|
|
8
|
+
import intl from '../../../../intl';
|
|
9
|
+
var SelectTable = /*#__PURE__*/function (_React$Component) {
|
|
10
|
+
_inherits(SelectTable, _React$Component);
|
|
11
|
+
var _super = _createSuper(SelectTable);
|
|
12
|
+
function SelectTable(props) {
|
|
13
|
+
var _this;
|
|
14
|
+
_classCallCheck(this, SelectTable);
|
|
15
|
+
_this = _super.call(this, props);
|
|
16
|
+
_this.renderSelector = function () {
|
|
17
|
+
var selectedTableId = _this.props.selectedTableId;
|
|
18
|
+
var selectedOption = selectedTableId ? _this.tableOptions.find(function (option) {
|
|
19
|
+
return option.value === selectedTableId;
|
|
20
|
+
}) : null;
|
|
21
|
+
return /*#__PURE__*/React.createElement(DTableSelect, {
|
|
22
|
+
menuPortalTarget: '#wrapper',
|
|
23
|
+
value: selectedOption,
|
|
24
|
+
options: _this.tableOptions,
|
|
25
|
+
onChange: _this.props.onSettingUpdate
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
var tables = props.tables;
|
|
29
|
+
_this.tableOptions = Array.isArray(tables) ? tables.map(function (table) {
|
|
30
|
+
var value = table._id;
|
|
31
|
+
var label = table['name'];
|
|
32
|
+
return {
|
|
33
|
+
value: value,
|
|
34
|
+
label: label
|
|
35
|
+
};
|
|
36
|
+
}) : [];
|
|
37
|
+
return _this;
|
|
38
|
+
}
|
|
39
|
+
_createClass(SelectTable, [{
|
|
40
|
+
key: "render",
|
|
41
|
+
value: function render() {
|
|
42
|
+
return /*#__PURE__*/React.createElement(FormGroup, {
|
|
43
|
+
className: "seastatistic-setting-item table-setting"
|
|
44
|
+
}, /*#__PURE__*/React.createElement(Label, null, intl.get('Table')), this.renderSelector());
|
|
45
|
+
}
|
|
46
|
+
}]);
|
|
47
|
+
return SelectTable;
|
|
48
|
+
}(React.Component);
|
|
49
|
+
export default SelectTable;
|
|
@@ -0,0 +1,58 @@
|
|
|
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 } from 'react';
|
|
6
|
+
import { Label, FormGroup } from 'reactstrap';
|
|
7
|
+
import { getTableById, getTableColumnByKey } from 'dtable-utils';
|
|
8
|
+
import Switch from './switch';
|
|
9
|
+
import { eventStopPropagation } from '../../../utils';
|
|
10
|
+
import intl from '../../../intl';
|
|
11
|
+
var Stack = /*#__PURE__*/function (_Component) {
|
|
12
|
+
_inherits(Stack, _Component);
|
|
13
|
+
var _super = _createSuper(Stack);
|
|
14
|
+
function Stack() {
|
|
15
|
+
var _this;
|
|
16
|
+
_classCallCheck(this, Stack);
|
|
17
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
18
|
+
args[_key] = arguments[_key];
|
|
19
|
+
}
|
|
20
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
21
|
+
_this.onUseStackChange = function (event) {
|
|
22
|
+
eventStopPropagation(event);
|
|
23
|
+
var statistic = _this.props.statistic;
|
|
24
|
+
var config = statistic.config;
|
|
25
|
+
var y_axis_use_stack = config.y_axis_use_stack;
|
|
26
|
+
_this.props.onChange({
|
|
27
|
+
y_axis_use_stack: !y_axis_use_stack
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
return _this;
|
|
31
|
+
}
|
|
32
|
+
_createClass(Stack, [{
|
|
33
|
+
key: "render",
|
|
34
|
+
value: function render() {
|
|
35
|
+
var _this$props = this.props,
|
|
36
|
+
statistic = _this$props.statistic,
|
|
37
|
+
tables = _this$props.tables,
|
|
38
|
+
selectedTableId = _this$props.selectedTableId;
|
|
39
|
+
var _statistic$config = statistic.config,
|
|
40
|
+
y_axis_use_stack = _statistic$config.y_axis_use_stack,
|
|
41
|
+
column_groupby_column_key = _statistic$config.column_groupby_column_key;
|
|
42
|
+
if (!column_groupby_column_key) return null;
|
|
43
|
+
var selectedTable = getTableById(tables, selectedTableId);
|
|
44
|
+
if (!selectedTable) return null;
|
|
45
|
+
var columnGroupbyColumn = getTableColumnByKey(selectedTable, column_groupby_column_key);
|
|
46
|
+
if (!columnGroupbyColumn) return null;
|
|
47
|
+
return /*#__PURE__*/React.createElement(FormGroup, {
|
|
48
|
+
className: "seastatistic-parameter-item"
|
|
49
|
+
}, /*#__PURE__*/React.createElement(Label, null, intl.get('Display_mode')), /*#__PURE__*/React.createElement(Switch, {
|
|
50
|
+
checked: y_axis_use_stack || false,
|
|
51
|
+
placeholder: intl.get('Stack'),
|
|
52
|
+
onChange: this.onUseStackChange
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
}]);
|
|
56
|
+
return Stack;
|
|
57
|
+
}(Component);
|
|
58
|
+
export default Stack;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
.seastatistic-settings .seastatistic-selected-type-container {
|
|
2
|
+
height: 38px;
|
|
3
|
+
border: 1px solid hsl(0, 0%, 80%);
|
|
4
|
+
border-radius: 4px;
|
|
5
|
+
padding-left: 8px;
|
|
6
|
+
padding-right: 3px;
|
|
7
|
+
justify-content: space-between;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.seastatistic-settings .seastatistic-type-icon-container {
|
|
11
|
+
height: 24px;
|
|
12
|
+
width: 24px;
|
|
13
|
+
margin-left: 10px;
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.seastatistic-settings .seastatistic-type-icon-container:hover {
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.seastatistic-settings .seastatistic-type-icon-container .seastatistic-type-icon {
|
|
24
|
+
height: 14px;
|
|
25
|
+
width: 14px;
|
|
26
|
+
color: #ccc;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.seastatistic-settings .seastatistic-type-icon-container:hover .seastatistic-type-icon {
|
|
30
|
+
color: #999;
|
|
31
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
import React, { useCallback, useState } from 'react';
|
|
4
|
+
import { Label, FormGroup } from 'reactstrap';
|
|
5
|
+
import TypesDialog from '../../../types-dialog';
|
|
6
|
+
import { STATISTIC_TYPE_SHOW } from '../../../../constants';
|
|
7
|
+
import { eventStopPropagation } from '../../../../utils';
|
|
8
|
+
import intl from '../../../../intl';
|
|
9
|
+
import Icon from '../../../icon';
|
|
10
|
+
import './index.css';
|
|
11
|
+
var StatisticType = function StatisticType(_ref) {
|
|
12
|
+
var statistic = _ref.statistic,
|
|
13
|
+
generateChartConfig = _ref.generateChartConfig,
|
|
14
|
+
onChange = _ref.onChange;
|
|
15
|
+
var _useState = useState(false),
|
|
16
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
17
|
+
isDialogShow = _useState2[0],
|
|
18
|
+
setDialogShow = _useState2[1];
|
|
19
|
+
var openTypesDialog = useCallback(function (event) {
|
|
20
|
+
eventStopPropagation(event);
|
|
21
|
+
setDialogShow(true);
|
|
22
|
+
}, []);
|
|
23
|
+
var closeTypesDialog = useCallback(function () {
|
|
24
|
+
setDialogShow(false);
|
|
25
|
+
}, []);
|
|
26
|
+
var onTypeChange = useCallback(function (type) {
|
|
27
|
+
var config = statistic.config;
|
|
28
|
+
var oldType = config.type;
|
|
29
|
+
if (type === oldType) return;
|
|
30
|
+
var convertedChart = generateChartConfig(_objectSpread(_objectSpread({}, config), {}, {
|
|
31
|
+
type: type
|
|
32
|
+
}));
|
|
33
|
+
onChange && onChange(convertedChart);
|
|
34
|
+
}, [statistic, generateChartConfig, onChange]);
|
|
35
|
+
var config = statistic.config;
|
|
36
|
+
var type = config.type;
|
|
37
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormGroup, {
|
|
38
|
+
className: "seastatistic-parameter-item",
|
|
39
|
+
id: "seastatistic-type-container"
|
|
40
|
+
}, /*#__PURE__*/React.createElement(Label, null, intl.get('Chart_type')), /*#__PURE__*/React.createElement("div", {
|
|
41
|
+
className: "seastatistic-selected-type-container d-flex align-items-center"
|
|
42
|
+
}, /*#__PURE__*/React.createElement("span", null, intl.get(STATISTIC_TYPE_SHOW[type])), /*#__PURE__*/React.createElement("div", {
|
|
43
|
+
className: "seastatistic-type-icon-container",
|
|
44
|
+
onClick: openTypesDialog
|
|
45
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
46
|
+
symbol: "type-change",
|
|
47
|
+
className: "seastatistic-type-icon"
|
|
48
|
+
})))), isDialogShow && /*#__PURE__*/React.createElement(TypesDialog, {
|
|
49
|
+
type: type,
|
|
50
|
+
onToggle: closeTypesDialog,
|
|
51
|
+
onChange: onTypeChange
|
|
52
|
+
}));
|
|
53
|
+
};
|
|
54
|
+
export default StatisticType;
|
|
@@ -0,0 +1,80 @@
|
|
|
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 } from 'react';
|
|
6
|
+
import DTableSelect from "dtable-ui-component/lib/DTableSelect";
|
|
7
|
+
import { FormGroup, Label } from 'reactstrap';
|
|
8
|
+
import shallowEqual from 'shallowequal';
|
|
9
|
+
import { STATISTIC_TYPE, STATISTIC_SUMMARY_CALCULATION_METHOD, STATISTIC_SUMMARY_SHOW, STATISTIC_DATE_SUMMARY_CALCULATION_METHOD } from '../../../constants';
|
|
10
|
+
import { StatisticsUtils } from '../../../utils';
|
|
11
|
+
import intl from '../../../intl';
|
|
12
|
+
var SummaryMethodSettings = /*#__PURE__*/function (_Component) {
|
|
13
|
+
_inherits(SummaryMethodSettings, _Component);
|
|
14
|
+
var _super = _createSuper(SummaryMethodSettings);
|
|
15
|
+
function SummaryMethodSettings(_props) {
|
|
16
|
+
var _this;
|
|
17
|
+
_classCallCheck(this, SummaryMethodSettings);
|
|
18
|
+
_this = _super.call(this, _props);
|
|
19
|
+
_this.initSummaryMethodOptions = function (props) {
|
|
20
|
+
var value = props.value,
|
|
21
|
+
numericColumnOptions = props.numericColumnOptions;
|
|
22
|
+
var selectedOption = numericColumnOptions.find(function (item) {
|
|
23
|
+
return item.value.key === value.column_key;
|
|
24
|
+
});
|
|
25
|
+
var summaryMethodOptions = selectedOption && StatisticsUtils.isDateSummaryColumn(selectedOption.value) ? STATISTIC_DATE_SUMMARY_CALCULATION_METHOD : STATISTIC_SUMMARY_CALCULATION_METHOD;
|
|
26
|
+
_this.summaryMethodOptions = summaryMethodOptions.map(function (item) {
|
|
27
|
+
return {
|
|
28
|
+
value: item,
|
|
29
|
+
label: intl.get(STATISTIC_SUMMARY_SHOW[item])
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
_this.state = {
|
|
34
|
+
isExpand: true
|
|
35
|
+
};
|
|
36
|
+
_this.initSummaryMethodOptions(_props);
|
|
37
|
+
return _this;
|
|
38
|
+
}
|
|
39
|
+
_createClass(SummaryMethodSettings, [{
|
|
40
|
+
key: "UNSAFE_componentWillReceiveProps",
|
|
41
|
+
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
42
|
+
if (!shallowEqual(this.props.value, nextProps.value)) {
|
|
43
|
+
this.initSummaryMethodOptions(nextProps);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}, {
|
|
47
|
+
key: "render",
|
|
48
|
+
value: function render() {
|
|
49
|
+
var _this$props = this.props,
|
|
50
|
+
statistic = _this$props.statistic,
|
|
51
|
+
value = _this$props.value,
|
|
52
|
+
numericColumnOptions = _this$props.numericColumnOptions;
|
|
53
|
+
var type = statistic.config.type;
|
|
54
|
+
var column_key = value.column_key,
|
|
55
|
+
summary_method = value.summary_method;
|
|
56
|
+
var selectedColumnOption = numericColumnOptions.find(function (option) {
|
|
57
|
+
return option.value.key === column_key;
|
|
58
|
+
});
|
|
59
|
+
var selectedSummaryMethodOption = this.summaryMethodOptions.find(function (option) {
|
|
60
|
+
return option.value === summary_method;
|
|
61
|
+
});
|
|
62
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormGroup, {
|
|
63
|
+
className: "statistic-parameter-item"
|
|
64
|
+
}, /*#__PURE__*/React.createElement(Label, null, type === STATISTIC_TYPE.TABLE ? intl.get('Summary_field') : intl.get('Numeric_field')), /*#__PURE__*/React.createElement(DTableSelect, {
|
|
65
|
+
value: selectedColumnOption,
|
|
66
|
+
placeholder: intl.get('Select_a_column'),
|
|
67
|
+
onChange: this.props.onColumnOptionChange,
|
|
68
|
+
options: numericColumnOptions
|
|
69
|
+
})), /*#__PURE__*/React.createElement(FormGroup, {
|
|
70
|
+
className: "statistic-parameter-item"
|
|
71
|
+
}, /*#__PURE__*/React.createElement(Label, null, intl.get('Summary_method')), /*#__PURE__*/React.createElement(DTableSelect, {
|
|
72
|
+
value: selectedSummaryMethodOption,
|
|
73
|
+
onChange: this.props.onSummaryMethodChange,
|
|
74
|
+
options: this.summaryMethodOptions
|
|
75
|
+
})));
|
|
76
|
+
}
|
|
77
|
+
}]);
|
|
78
|
+
return SummaryMethodSettings;
|
|
79
|
+
}(Component);
|
|
80
|
+
export default SummaryMethodSettings;
|