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,67 @@
|
|
|
1
|
+
.seastatistic-settings .select-group-container {
|
|
2
|
+
display: block;
|
|
3
|
+
width: 100%;
|
|
4
|
+
height: 2.375rem;
|
|
5
|
+
color: #212529;
|
|
6
|
+
background-color: #fff;
|
|
7
|
+
background-clip: padding-box;
|
|
8
|
+
border: 1px solid rgba(0, 40, 100, 0.12);
|
|
9
|
+
border-radius: 3px;
|
|
10
|
+
transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.seastatistic-settings .select-group {
|
|
14
|
+
height: 100%;
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
justify-content: center;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.seastatistic-settings .select-group-container .select-group-item {
|
|
21
|
+
height: 100%;
|
|
22
|
+
flex: 1;
|
|
23
|
+
text-align: center;
|
|
24
|
+
padding: 0 8px;
|
|
25
|
+
overflow: hidden;
|
|
26
|
+
text-overflow: ellipsis;
|
|
27
|
+
white-space: nowrap;
|
|
28
|
+
line-height: 36px;
|
|
29
|
+
cursor: pointer;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.seastatistic-settings .select-group-container .select-group-item.readOnly {
|
|
33
|
+
cursor: default;
|
|
34
|
+
opacity: .6;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.seastatistic-settings .select-group-container .select-group-item.active {
|
|
38
|
+
background-color: #FFF2E4;
|
|
39
|
+
color: #ff8000;
|
|
40
|
+
box-shadow: 0 0 0 1px #ff8000;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.seastatistic-settings .select-group-container .select-group-item:first-child.active {
|
|
44
|
+
border-top-left-radius: 3px;
|
|
45
|
+
border-bottom-left-radius: 3px;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.seastatistic-settings .select-group-container .select-group-item:last-child.active {
|
|
49
|
+
border-top-right-radius: 3px;
|
|
50
|
+
border-bottom-right-radius: 3px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.seastatistic-settings .no-active-option .select-group-item:hover {
|
|
54
|
+
cursor: pointer;
|
|
55
|
+
background-color: #FFF2E4;
|
|
56
|
+
box-shadow: 0 0 0 1px #ff8000;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.seastatistic-settings .no-active-option .select-group-item:first-child:hover {
|
|
60
|
+
border-top-left-radius: 3px;
|
|
61
|
+
border-bottom-left-radius: 3px;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.seastatistic-settings .no-active-option .select-group-item:last-child:hover {
|
|
65
|
+
border-top-right-radius: 3px;
|
|
66
|
+
border-bottom-right-radius: 3px;
|
|
67
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
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 intl from '../../intl';
|
|
7
|
+
import './index.css';
|
|
8
|
+
var SelectGroup = /*#__PURE__*/function (_React$Component) {
|
|
9
|
+
_inherits(SelectGroup, _React$Component);
|
|
10
|
+
var _super = _createSuper(SelectGroup);
|
|
11
|
+
function SelectGroup(props) {
|
|
12
|
+
var _this;
|
|
13
|
+
_classCallCheck(this, SelectGroup);
|
|
14
|
+
_this = _super.call(this, props);
|
|
15
|
+
_this.onSelectChanged = function (event) {
|
|
16
|
+
var option = event.target.dataset.option;
|
|
17
|
+
if (option === _this.state.activeOption) return;
|
|
18
|
+
_this.setState({
|
|
19
|
+
activeOption: option
|
|
20
|
+
});
|
|
21
|
+
_this.props.onSelectChanged(option);
|
|
22
|
+
};
|
|
23
|
+
_this.state = {
|
|
24
|
+
activeOption: props.activeOption
|
|
25
|
+
};
|
|
26
|
+
return _this;
|
|
27
|
+
}
|
|
28
|
+
_createClass(SelectGroup, [{
|
|
29
|
+
key: "UNSAFE_componentWillReceiveProps",
|
|
30
|
+
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
31
|
+
if (nextProps.activeOption !== this.state.activeOption) {
|
|
32
|
+
this.setState({
|
|
33
|
+
activeOption: nextProps.activeOption
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}, {
|
|
38
|
+
key: "render",
|
|
39
|
+
value: function render() {
|
|
40
|
+
var _this2 = this;
|
|
41
|
+
var _this$props = this.props,
|
|
42
|
+
options = _this$props.options,
|
|
43
|
+
optionsDisplay = _this$props.optionsDisplay;
|
|
44
|
+
var activeOption = this.state.activeOption;
|
|
45
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
46
|
+
className: "select-group-container"
|
|
47
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
48
|
+
className: "select-group"
|
|
49
|
+
}, options.map(function (option) {
|
|
50
|
+
var isActive = activeOption === option ? true : false;
|
|
51
|
+
var displayOption = optionsDisplay && optionsDisplay[option] ? intl.get(optionsDisplay[option]) : option;
|
|
52
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
53
|
+
key: option,
|
|
54
|
+
className: "select-group-item ".concat(isActive ? 'active' : ''),
|
|
55
|
+
"data-option": option,
|
|
56
|
+
onClick: _this2.onSelectChanged
|
|
57
|
+
}, displayOption);
|
|
58
|
+
})));
|
|
59
|
+
}
|
|
60
|
+
}]);
|
|
61
|
+
return SelectGroup;
|
|
62
|
+
}(React.Component);
|
|
63
|
+
export default SelectGroup;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { CellType, DATE_COLUMN_OPTIONS } from 'dtable-utils';
|
|
3
|
+
import CommonDataSettings from '../widgets/common-data-settings';
|
|
4
|
+
import Divider from '../widgets/divider';
|
|
5
|
+
import GroupBy from '../widgets/group-by';
|
|
6
|
+
import Switch from '../widgets/switch';
|
|
7
|
+
import YAxisGroupSettings from '../widgets/y-axis-group-settings';
|
|
8
|
+
import { STATISTIC_SUMMARY_TYPE, GEOLOCATION_FORMAT_CITY, GEOLOCATION_FORMAT_MAP } from '../../../constants';
|
|
9
|
+
import { eventStopPropagation } from '../../../utils';
|
|
10
|
+
import intl from '../../../intl';
|
|
11
|
+
var DataSettings = function DataSettings(_ref) {
|
|
12
|
+
var statistic = _ref.statistic,
|
|
13
|
+
onChange = _ref.onChange,
|
|
14
|
+
tables = _ref.tables,
|
|
15
|
+
xLabel = _ref.xLabel,
|
|
16
|
+
yLabel = _ref.yLabel,
|
|
17
|
+
FilterSettings = _ref.FilterSettings;
|
|
18
|
+
var onXAxisColumnChange = useCallback(function (option) {
|
|
19
|
+
var config = statistic.config;
|
|
20
|
+
var x_axis_column_key = config.x_axis_column_key;
|
|
21
|
+
var column = option.value;
|
|
22
|
+
var newXAxisColumnKey = column.key,
|
|
23
|
+
type = column.type;
|
|
24
|
+
var validValue = newXAxisColumnKey === 'Groupby_null' ? null : newXAxisColumnKey;
|
|
25
|
+
if (x_axis_column_key === validValue) return;
|
|
26
|
+
var update = {
|
|
27
|
+
x_axis_column_key: validValue
|
|
28
|
+
};
|
|
29
|
+
if (!validValue) {
|
|
30
|
+
update['x_axis_date_granularity'] = null;
|
|
31
|
+
update['x_axis_geolocation_granularity'] = null;
|
|
32
|
+
} else {
|
|
33
|
+
if (DATE_COLUMN_OPTIONS.includes(type)) {
|
|
34
|
+
update['x_axis_date_granularity'] = STATISTIC_SUMMARY_TYPE.MONTH;
|
|
35
|
+
update['x_axis_geolocation_granularity'] = null;
|
|
36
|
+
} else if (type === CellType.GEOLOCATION) {
|
|
37
|
+
var _ref2 = column.data || {},
|
|
38
|
+
geo_format = _ref2.geo_format;
|
|
39
|
+
if (geo_format === GEOLOCATION_FORMAT_MAP.PROVINCE) {
|
|
40
|
+
update['x_axis_geolocation_granularity'] = GEOLOCATION_FORMAT_MAP.PROVINCE;
|
|
41
|
+
} else if (geo_format === GEOLOCATION_FORMAT_MAP.PROVINCE_CITY) {
|
|
42
|
+
update['x_axis_geolocation_granularity'] = GEOLOCATION_FORMAT_CITY;
|
|
43
|
+
} else if (geo_format === GEOLOCATION_FORMAT_MAP.GEOLOCATION || !geo_format) {
|
|
44
|
+
update['x_axis_geolocation_granularity'] = 'district';
|
|
45
|
+
} else {
|
|
46
|
+
update['x_axis_geolocation_granularity'] = null;
|
|
47
|
+
}
|
|
48
|
+
update['x_axis_date_granularity'] = null;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
onChange && onChange(update);
|
|
52
|
+
}, [statistic, onChange]);
|
|
53
|
+
var onGroupbyDateGranularityChange = useCallback(function (option) {
|
|
54
|
+
var config = statistic.config;
|
|
55
|
+
var x_axis_date_granularity = config.x_axis_date_granularity;
|
|
56
|
+
var value = option.value;
|
|
57
|
+
if (value === x_axis_date_granularity) return;
|
|
58
|
+
onChange && onChange({
|
|
59
|
+
x_axis_date_granularity: value
|
|
60
|
+
});
|
|
61
|
+
}, [statistic, onChange]);
|
|
62
|
+
var onGroupbyGeolocationGranularityChange = useCallback(function (option) {
|
|
63
|
+
var config = statistic.config;
|
|
64
|
+
var x_axis_geolocation_granularity = config.x_axis_geolocation_granularity;
|
|
65
|
+
var value = option.value;
|
|
66
|
+
if (value === x_axis_geolocation_granularity) return;
|
|
67
|
+
onChange && onChange({
|
|
68
|
+
x_axis_geolocation_granularity: value
|
|
69
|
+
});
|
|
70
|
+
}, [statistic, onChange]);
|
|
71
|
+
var onIncludeEmptyChange = useCallback(function (event) {
|
|
72
|
+
eventStopPropagation(event);
|
|
73
|
+
var config = statistic.config;
|
|
74
|
+
var x_axis_include_empty_cells = config.x_axis_include_empty_cells;
|
|
75
|
+
onChange && onChange({
|
|
76
|
+
x_axis_include_empty_cells: !x_axis_include_empty_cells
|
|
77
|
+
});
|
|
78
|
+
}, [statistic, onChange]);
|
|
79
|
+
var config = statistic.config;
|
|
80
|
+
var table_id = config.table_id,
|
|
81
|
+
x_axis_column_key = config.x_axis_column_key,
|
|
82
|
+
x_axis_date_granularity = config.x_axis_date_granularity,
|
|
83
|
+
x_axis_geolocation_granularity = config.x_axis_geolocation_granularity,
|
|
84
|
+
x_axis_include_empty_cells = config.x_axis_include_empty_cells;
|
|
85
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CommonDataSettings, {
|
|
86
|
+
statistic: statistic,
|
|
87
|
+
tables: tables,
|
|
88
|
+
FilterSettings: FilterSettings,
|
|
89
|
+
onChange: onChange
|
|
90
|
+
}), /*#__PURE__*/React.createElement(GroupBy, {
|
|
91
|
+
tables: tables,
|
|
92
|
+
className: "selected-x-axis",
|
|
93
|
+
label: intl.get(xLabel),
|
|
94
|
+
selectedTableId: table_id,
|
|
95
|
+
selectedColumnKey: x_axis_column_key,
|
|
96
|
+
selectedDateGranularity: x_axis_date_granularity,
|
|
97
|
+
selectedGeolocationGranularity: x_axis_geolocation_granularity,
|
|
98
|
+
onGroupByChange: onXAxisColumnChange,
|
|
99
|
+
onGroupbyDateGranularityChange: onGroupbyDateGranularityChange,
|
|
100
|
+
onGroupbyGeolocationGranularityChange: onGroupbyGeolocationGranularityChange
|
|
101
|
+
}), /*#__PURE__*/React.createElement(Switch, {
|
|
102
|
+
key: "x_axis_include_empty_cells",
|
|
103
|
+
checked: x_axis_include_empty_cells,
|
|
104
|
+
placeholder: intl.get('Include_empty'),
|
|
105
|
+
onChange: onIncludeEmptyChange
|
|
106
|
+
}), /*#__PURE__*/React.createElement(Divider, {
|
|
107
|
+
className: "mt-4"
|
|
108
|
+
}), /*#__PURE__*/React.createElement(YAxisGroupSettings, {
|
|
109
|
+
className: "selected-y-axis",
|
|
110
|
+
label: intl.get(yLabel),
|
|
111
|
+
statistic: statistic,
|
|
112
|
+
tables: tables,
|
|
113
|
+
onChange: onChange
|
|
114
|
+
}));
|
|
115
|
+
};
|
|
116
|
+
DataSettings.defaultProps = {
|
|
117
|
+
xLabel: 'X_axis',
|
|
118
|
+
yLabel: 'Y_axis'
|
|
119
|
+
};
|
|
120
|
+
export default DataSettings;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import React, { useCallback, useMemo } from 'react';
|
|
3
|
+
import { Label, FormGroup } from 'reactstrap';
|
|
4
|
+
import DTableSelect from "dtable-ui-component/lib/DTableSelect";
|
|
5
|
+
import Switch from '../widgets/switch';
|
|
6
|
+
import Divider from '../widgets/divider';
|
|
7
|
+
import MinMaxSetting from '../widgets/min-max-setting';
|
|
8
|
+
import DisplayValuesSettings from '../widgets/display-values-settings';
|
|
9
|
+
import { eventStopPropagation } from '../../../utils';
|
|
10
|
+
import { X_LABEL_POSITIONS, Y_LABEL_POSITIONS, LABEL_POSITION_TYPE_SHOW } from '../../../constants';
|
|
11
|
+
import intl from '../../../intl';
|
|
12
|
+
var StyleSettings = function StyleSettings(_ref) {
|
|
13
|
+
var statistic = _ref.statistic,
|
|
14
|
+
xLabel = _ref.xLabel,
|
|
15
|
+
yLabel = _ref.yLabel,
|
|
16
|
+
onChange = _ref.onChange;
|
|
17
|
+
var xAxisLabelOptions = useMemo(function () {
|
|
18
|
+
return X_LABEL_POSITIONS.map(function (item) {
|
|
19
|
+
return {
|
|
20
|
+
value: item,
|
|
21
|
+
label: intl.get(LABEL_POSITION_TYPE_SHOW[item])
|
|
22
|
+
};
|
|
23
|
+
});
|
|
24
|
+
}, []);
|
|
25
|
+
var yAxisLabelOptions = useMemo(function () {
|
|
26
|
+
return Y_LABEL_POSITIONS.map(function (item) {
|
|
27
|
+
return {
|
|
28
|
+
value: item,
|
|
29
|
+
label: intl.get(LABEL_POSITION_TYPE_SHOW[item])
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
}, []);
|
|
33
|
+
var onAxisLabelShowChange = useCallback(function (event, labelKey) {
|
|
34
|
+
eventStopPropagation(event);
|
|
35
|
+
var config = statistic.config;
|
|
36
|
+
var value = config[labelKey];
|
|
37
|
+
onChange && onChange(_defineProperty({}, labelKey, !value));
|
|
38
|
+
}, [statistic, onChange]);
|
|
39
|
+
var onAxisLabelPositionChange = useCallback(function (option, positionKey) {
|
|
40
|
+
var position = option.value;
|
|
41
|
+
var config = statistic.config;
|
|
42
|
+
var oldValue = config[positionKey];
|
|
43
|
+
if (position === oldValue) return;
|
|
44
|
+
onChange && onChange(_defineProperty({}, positionKey, position));
|
|
45
|
+
}, [statistic, onChange]);
|
|
46
|
+
var onYAxisAutoRangeChange = useCallback(function (event) {
|
|
47
|
+
eventStopPropagation(event);
|
|
48
|
+
var config = statistic.config;
|
|
49
|
+
var y_axis_auto_range = config.y_axis_auto_range;
|
|
50
|
+
onChange && onChange({
|
|
51
|
+
y_axis_auto_range: !y_axis_auto_range
|
|
52
|
+
});
|
|
53
|
+
}, [statistic, onChange]);
|
|
54
|
+
var onYAxisMinChange = useCallback(function (min) {
|
|
55
|
+
var newMin = parseInt(min);
|
|
56
|
+
if (Number.isNaN(newMin)) return;
|
|
57
|
+
var config = statistic.config;
|
|
58
|
+
var y_axis_min = config.y_axis_min;
|
|
59
|
+
if (y_axis_min === newMin) return;
|
|
60
|
+
onChange && onChange({
|
|
61
|
+
y_axis_min: newMin
|
|
62
|
+
});
|
|
63
|
+
}, [statistic, onChange]);
|
|
64
|
+
var onYAxisMaxChange = useCallback(function (max) {
|
|
65
|
+
var newMax = parseInt(max);
|
|
66
|
+
if (Number.isNaN(newMax)) return;
|
|
67
|
+
var config = statistic.config;
|
|
68
|
+
var y_axis_max = config.y_axis_max;
|
|
69
|
+
if (y_axis_max === newMax) return;
|
|
70
|
+
onChange && onChange({
|
|
71
|
+
y_axis_max: newMax
|
|
72
|
+
});
|
|
73
|
+
}, [statistic, onChange]);
|
|
74
|
+
var onDisplayValueChange = useCallback(function (update) {
|
|
75
|
+
onChange(update);
|
|
76
|
+
}, [onChange]);
|
|
77
|
+
var config = statistic.config;
|
|
78
|
+
var x_axis_show_label = config.x_axis_show_label,
|
|
79
|
+
x_axis_label_position = config.x_axis_label_position,
|
|
80
|
+
y_axis_show_label = config.y_axis_show_label,
|
|
81
|
+
y_axis_label_position = config.y_axis_label_position,
|
|
82
|
+
_config$y_axis_auto_r = config.y_axis_auto_range,
|
|
83
|
+
y_axis_auto_range = _config$y_axis_auto_r === void 0 ? true : _config$y_axis_auto_r,
|
|
84
|
+
y_axis_min = config.y_axis_min,
|
|
85
|
+
y_axis_max = config.y_axis_max,
|
|
86
|
+
y_axis_show_value = config.y_axis_show_value,
|
|
87
|
+
label_font_size = config.label_font_size;
|
|
88
|
+
var xAxisLabelPosition = xAxisLabelOptions.find(function (option) {
|
|
89
|
+
return option.value === x_axis_label_position;
|
|
90
|
+
}) || xAxisLabelOptions[0];
|
|
91
|
+
var yAxisLabelPosition = yAxisLabelOptions.find(function (option) {
|
|
92
|
+
return option.value === y_axis_label_position;
|
|
93
|
+
}) || yAxisLabelOptions[0];
|
|
94
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormGroup, {
|
|
95
|
+
className: "seastatistic-parameter-item"
|
|
96
|
+
}, /*#__PURE__*/React.createElement(Label, null, intl.get(xLabel)), /*#__PURE__*/React.createElement(Switch, {
|
|
97
|
+
key: "x_axis_show_label",
|
|
98
|
+
checked: x_axis_show_label || false,
|
|
99
|
+
placeholder: intl.get('Display_title'),
|
|
100
|
+
onChange: function onChange(event) {
|
|
101
|
+
return onAxisLabelShowChange(event, 'x_axis_show_label');
|
|
102
|
+
}
|
|
103
|
+
}), x_axis_show_label && /*#__PURE__*/React.createElement(DTableSelect, {
|
|
104
|
+
value: xAxisLabelPosition,
|
|
105
|
+
options: xAxisLabelOptions,
|
|
106
|
+
onChange: function onChange(option) {
|
|
107
|
+
return onAxisLabelPositionChange(option, 'x_axis_label_position');
|
|
108
|
+
}
|
|
109
|
+
})), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(FormGroup, {
|
|
110
|
+
className: "seastatistic-parameter-item"
|
|
111
|
+
}, /*#__PURE__*/React.createElement(Label, null, intl.get(yLabel)), /*#__PURE__*/React.createElement(Switch, {
|
|
112
|
+
key: "y_axis_show_label",
|
|
113
|
+
checked: y_axis_show_label || false,
|
|
114
|
+
placeholder: intl.get('Display_title'),
|
|
115
|
+
onChange: function onChange(event) {
|
|
116
|
+
return onAxisLabelShowChange(event, 'y_axis_show_label');
|
|
117
|
+
}
|
|
118
|
+
}), y_axis_show_label && /*#__PURE__*/React.createElement("div", {
|
|
119
|
+
className: "seastatistic-parameter-container"
|
|
120
|
+
}, /*#__PURE__*/React.createElement(DTableSelect, {
|
|
121
|
+
value: yAxisLabelPosition,
|
|
122
|
+
classNamePrefix: "chart-y-axis-label-position",
|
|
123
|
+
options: yAxisLabelOptions,
|
|
124
|
+
onChange: function onChange(option) {
|
|
125
|
+
return onAxisLabelPositionChange(option, 'y_axis_label_position');
|
|
126
|
+
}
|
|
127
|
+
})), /*#__PURE__*/React.createElement(Switch, {
|
|
128
|
+
key: "y_axis_auto_range",
|
|
129
|
+
checked: y_axis_auto_range,
|
|
130
|
+
placeholder: intl.get('Auto_range'),
|
|
131
|
+
onChange: onYAxisAutoRangeChange
|
|
132
|
+
}), !y_axis_auto_range && /*#__PURE__*/React.createElement(MinMaxSetting, {
|
|
133
|
+
min: y_axis_min,
|
|
134
|
+
max: y_axis_max,
|
|
135
|
+
onMinChange: onYAxisMinChange,
|
|
136
|
+
onMaxChange: onYAxisMaxChange
|
|
137
|
+
})), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(DisplayValuesSettings, {
|
|
138
|
+
isShowValueKey: "y_axis_show_value",
|
|
139
|
+
isShowValue: y_axis_show_value,
|
|
140
|
+
fontSizeKey: "label_font_size",
|
|
141
|
+
fontSize: label_font_size,
|
|
142
|
+
onChange: onDisplayValueChange
|
|
143
|
+
}));
|
|
144
|
+
};
|
|
145
|
+
StyleSettings.defaultProps = {
|
|
146
|
+
xLabel: 'X_axis',
|
|
147
|
+
yLabel: 'Y_axis'
|
|
148
|
+
};
|
|
149
|
+
export default StyleSettings;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { CellType, DATE_COLUMN_OPTIONS } from 'dtable-utils';
|
|
3
|
+
import CommonDataSettings from '../widgets/common-data-settings';
|
|
4
|
+
import Divider from '../widgets/divider';
|
|
5
|
+
import GroupBy from '../widgets/group-by';
|
|
6
|
+
import Switch from '../widgets/switch';
|
|
7
|
+
import BasicSummary from '../widgets/basic-summary';
|
|
8
|
+
import DataSort from '../widgets/data-sort';
|
|
9
|
+
import { eventStopPropagation } from '../../../utils';
|
|
10
|
+
import { STATISTIC_SUMMARY_TYPE, SUPPORT_DATA_SORT_STATISTIC_TYPES, STATISTIC_SUMMARY_TYPES, GEOLOCATION_FORMAT_CITY, GEOLOCATION_FORMAT_MAP } from '../../../constants';
|
|
11
|
+
import intl from '../../../intl';
|
|
12
|
+
var DataSettings = function DataSettings(_ref) {
|
|
13
|
+
var statistic = _ref.statistic,
|
|
14
|
+
tables = _ref.tables,
|
|
15
|
+
xLabel = _ref.xLabel,
|
|
16
|
+
yLabel = _ref.yLabel,
|
|
17
|
+
FilterSettings = _ref.FilterSettings,
|
|
18
|
+
onChange = _ref.onChange;
|
|
19
|
+
var onXAxisColumnChange = useCallback(function (option) {
|
|
20
|
+
var config = statistic.config;
|
|
21
|
+
var x_axis_column_key = config.x_axis_column_key;
|
|
22
|
+
var column = option.value;
|
|
23
|
+
var newXAxisColumnKey = column.key,
|
|
24
|
+
type = column.type;
|
|
25
|
+
var validValue = newXAxisColumnKey === 'Groupby_null' ? null : newXAxisColumnKey;
|
|
26
|
+
if (x_axis_column_key === validValue) return;
|
|
27
|
+
var update = {
|
|
28
|
+
x_axis_column_key: validValue
|
|
29
|
+
};
|
|
30
|
+
if (!validValue) {
|
|
31
|
+
update['x_axis_date_granularity'] = null;
|
|
32
|
+
update['x_axis_geolocation_granularity'] = null;
|
|
33
|
+
} else {
|
|
34
|
+
if (DATE_COLUMN_OPTIONS.includes(type)) {
|
|
35
|
+
update['x_axis_date_granularity'] = STATISTIC_SUMMARY_TYPE.MONTH;
|
|
36
|
+
update['x_axis_geolocation_granularity'] = null;
|
|
37
|
+
} else if (type === CellType.GEOLOCATION) {
|
|
38
|
+
var _ref2 = column.data || {},
|
|
39
|
+
geo_format = _ref2.geo_format;
|
|
40
|
+
if (geo_format === GEOLOCATION_FORMAT_MAP.PROVINCE) {
|
|
41
|
+
update['x_axis_geolocation_granularity'] = GEOLOCATION_FORMAT_MAP.PROVINCE;
|
|
42
|
+
} else if (geo_format === GEOLOCATION_FORMAT_MAP.PROVINCE_CITY) {
|
|
43
|
+
update['x_axis_geolocation_granularity'] = GEOLOCATION_FORMAT_CITY;
|
|
44
|
+
} else if (geo_format === GEOLOCATION_FORMAT_MAP.GEOLOCATION || !geo_format) {
|
|
45
|
+
update['x_axis_geolocation_granularity'] = 'district';
|
|
46
|
+
} else {
|
|
47
|
+
update['x_axis_geolocation_granularity'] = null;
|
|
48
|
+
}
|
|
49
|
+
update['x_axis_date_granularity'] = null;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
onChange && onChange(update);
|
|
53
|
+
}, [statistic, onChange]);
|
|
54
|
+
var onGroupbyDateGranularityChange = useCallback(function (option) {
|
|
55
|
+
var config = statistic.config;
|
|
56
|
+
var x_axis_date_granularity = config.x_axis_date_granularity;
|
|
57
|
+
var value = option.value;
|
|
58
|
+
if (value === x_axis_date_granularity) return;
|
|
59
|
+
onChange && onChange({
|
|
60
|
+
x_axis_date_granularity: value
|
|
61
|
+
});
|
|
62
|
+
}, [statistic, onChange]);
|
|
63
|
+
var onGroupbyGeolocationGranularityChange = useCallback(function (option) {
|
|
64
|
+
var config = statistic.config;
|
|
65
|
+
var x_axis_geolocation_granularity = config.x_axis_geolocation_granularity;
|
|
66
|
+
var value = option.value;
|
|
67
|
+
if (value === x_axis_geolocation_granularity) return;
|
|
68
|
+
onChange && onChange({
|
|
69
|
+
x_axis_geolocation_granularity: value
|
|
70
|
+
});
|
|
71
|
+
}, [statistic, onChange]);
|
|
72
|
+
var onIncludeEmptyChange = useCallback(function (event) {
|
|
73
|
+
eventStopPropagation(event);
|
|
74
|
+
var config = statistic.config;
|
|
75
|
+
var x_axis_include_empty_cells = config.x_axis_include_empty_cells;
|
|
76
|
+
onChange && onChange({
|
|
77
|
+
x_axis_include_empty_cells: !x_axis_include_empty_cells
|
|
78
|
+
});
|
|
79
|
+
}, [statistic, onChange]);
|
|
80
|
+
var renderDataSort = useCallback(function () {
|
|
81
|
+
var config = statistic.config;
|
|
82
|
+
if (!SUPPORT_DATA_SORT_STATISTIC_TYPES.includes(config.type)) return null;
|
|
83
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Divider, {
|
|
84
|
+
className: "mt-4"
|
|
85
|
+
}), /*#__PURE__*/React.createElement(DataSort, {
|
|
86
|
+
statistic: statistic,
|
|
87
|
+
onChange: onChange
|
|
88
|
+
}));
|
|
89
|
+
}, [statistic, onChange]);
|
|
90
|
+
var config = statistic.config;
|
|
91
|
+
var table_id = config.table_id,
|
|
92
|
+
x_axis_column_key = config.x_axis_column_key,
|
|
93
|
+
x_axis_date_granularity = config.x_axis_date_granularity,
|
|
94
|
+
x_axis_geolocation_granularity = config.x_axis_geolocation_granularity,
|
|
95
|
+
x_axis_include_empty_cells = config.x_axis_include_empty_cells;
|
|
96
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CommonDataSettings, {
|
|
97
|
+
statistic: statistic,
|
|
98
|
+
tables: tables,
|
|
99
|
+
FilterSettings: FilterSettings,
|
|
100
|
+
onChange: onChange
|
|
101
|
+
}), /*#__PURE__*/React.createElement(GroupBy, {
|
|
102
|
+
tables: tables,
|
|
103
|
+
className: "selected-x-axis",
|
|
104
|
+
label: intl.get(xLabel),
|
|
105
|
+
selectedTableId: table_id,
|
|
106
|
+
selectedColumnKey: x_axis_column_key,
|
|
107
|
+
selectedDateGranularity: x_axis_date_granularity,
|
|
108
|
+
selectedGeolocationGranularity: x_axis_geolocation_granularity,
|
|
109
|
+
onGroupByChange: onXAxisColumnChange,
|
|
110
|
+
onGroupbyDateGranularityChange: onGroupbyDateGranularityChange,
|
|
111
|
+
onGroupbyGeolocationGranularityChange: onGroupbyGeolocationGranularityChange
|
|
112
|
+
}), /*#__PURE__*/React.createElement(Switch, {
|
|
113
|
+
key: "x_axis_include_empty_cells",
|
|
114
|
+
checked: x_axis_include_empty_cells,
|
|
115
|
+
placeholder: intl.get('Include_empty'),
|
|
116
|
+
onChange: onIncludeEmptyChange
|
|
117
|
+
}), /*#__PURE__*/React.createElement(Divider, {
|
|
118
|
+
className: "mt-4"
|
|
119
|
+
}), /*#__PURE__*/React.createElement(BasicSummary, {
|
|
120
|
+
className: "selected-y-axis",
|
|
121
|
+
label: intl.get(yLabel),
|
|
122
|
+
summaryTypeKey: 'y_axis_summary_type',
|
|
123
|
+
summaryMethodKey: 'y_axis_summary_method',
|
|
124
|
+
summaryColumnKey: 'y_axis_summary_column_key',
|
|
125
|
+
statistic: statistic,
|
|
126
|
+
selectedTableId: table_id,
|
|
127
|
+
tables: tables,
|
|
128
|
+
supportColumnTypes: [CellType.NUMBER],
|
|
129
|
+
summaryTypeOptions: STATISTIC_SUMMARY_TYPES,
|
|
130
|
+
onChange: onChange
|
|
131
|
+
}), renderDataSort());
|
|
132
|
+
};
|
|
133
|
+
DataSettings.defaultProps = {
|
|
134
|
+
xLabel: 'X_axis',
|
|
135
|
+
yLabel: 'Y_axis'
|
|
136
|
+
};
|
|
137
|
+
export default DataSettings;
|