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,123 @@
|
|
|
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, 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
|
+
FilterSettings = _ref.FilterSettings,
|
|
16
|
+
onChange = _ref.onChange;
|
|
17
|
+
var onGroupByChange = useCallback(function (option) {
|
|
18
|
+
var config = statistic.config;
|
|
19
|
+
var groupby_column_key = config.groupby_column_key;
|
|
20
|
+
var column = option.value;
|
|
21
|
+
var newColumnKey = column.key,
|
|
22
|
+
type = column.type;
|
|
23
|
+
var validValue = newColumnKey === 'Groupby_null' ? null : newColumnKey;
|
|
24
|
+
if (groupby_column_key === validValue) return;
|
|
25
|
+
var update = {
|
|
26
|
+
groupby_column_key: validValue
|
|
27
|
+
};
|
|
28
|
+
if (!validValue) {
|
|
29
|
+
update['groupby_date_granularity'] = null;
|
|
30
|
+
update['groupby_geolocation_granularity'] = null;
|
|
31
|
+
} else {
|
|
32
|
+
if (DATE_COLUMN_OPTIONS.includes(type)) {
|
|
33
|
+
update['groupby_date_granularity'] = STATISTIC_SUMMARY_TYPE.MONTH;
|
|
34
|
+
update['groupby_geolocation_granularity'] = null;
|
|
35
|
+
} else if (type === CellType.GEOLOCATION) {
|
|
36
|
+
var _ref2 = column.data || {},
|
|
37
|
+
geo_format = _ref2.geo_format;
|
|
38
|
+
if (geo_format === GEOLOCATION_FORMAT_MAP.PROVINCE) {
|
|
39
|
+
update['groupby_geolocation_granularity'] = GEOLOCATION_FORMAT_MAP.PROVINCE;
|
|
40
|
+
} else if (geo_format === GEOLOCATION_FORMAT_MAP.PROVINCE_CITY) {
|
|
41
|
+
update['groupby_geolocation_granularity'] = GEOLOCATION_FORMAT_CITY;
|
|
42
|
+
} else if (geo_format === GEOLOCATION_FORMAT_MAP.GEOLOCATION || !geo_format) {
|
|
43
|
+
update['groupby_geolocation_granularity'] = 'district';
|
|
44
|
+
} else {
|
|
45
|
+
update['groupby_geolocation_granularity'] = null;
|
|
46
|
+
}
|
|
47
|
+
update['groupby_date_granularity'] = null;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
onChange && onChange(update);
|
|
51
|
+
}, [statistic, onChange]);
|
|
52
|
+
var onGroupbyDateGranularityChange = useCallback(function (option) {
|
|
53
|
+
var config = statistic.config;
|
|
54
|
+
var groupby_date_granularity = config.groupby_date_granularity;
|
|
55
|
+
var value = option.value;
|
|
56
|
+
if (value === groupby_date_granularity) return;
|
|
57
|
+
onChange && onChange({
|
|
58
|
+
groupby_date_granularity: value
|
|
59
|
+
});
|
|
60
|
+
}, [statistic, onChange]);
|
|
61
|
+
var onGroupbyGeolocationGranularityChange = useCallback(function (option) {
|
|
62
|
+
var config = statistic.config;
|
|
63
|
+
var groupby_geolocation_granularity = config.groupby_geolocation_granularity;
|
|
64
|
+
var value = option.value;
|
|
65
|
+
if (value === groupby_geolocation_granularity) return;
|
|
66
|
+
onChange && onChange({
|
|
67
|
+
groupby_geolocation_granularity: value
|
|
68
|
+
});
|
|
69
|
+
}, [statistic, onChange]);
|
|
70
|
+
var onIncludeEmptyChange = useCallback(function (event) {
|
|
71
|
+
eventStopPropagation(event);
|
|
72
|
+
var config = statistic.config;
|
|
73
|
+
var groupby_include_empty_cells = config.groupby_include_empty_cells;
|
|
74
|
+
onChange && onChange({
|
|
75
|
+
groupby_include_empty_cells: !groupby_include_empty_cells
|
|
76
|
+
});
|
|
77
|
+
}, [statistic, onChange]);
|
|
78
|
+
var config = statistic.config;
|
|
79
|
+
var table_id = config.table_id,
|
|
80
|
+
groupby_column_key = config.groupby_column_key,
|
|
81
|
+
groupby_date_granularity = config.groupby_date_granularity,
|
|
82
|
+
groupby_geolocation_granularity = config.groupby_geolocation_granularity,
|
|
83
|
+
groupby_include_empty_cells = config.groupby_include_empty_cells;
|
|
84
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CommonDataSettings, {
|
|
85
|
+
statistic: statistic,
|
|
86
|
+
tables: tables,
|
|
87
|
+
FilterSettings: FilterSettings,
|
|
88
|
+
onChange: onChange
|
|
89
|
+
}), /*#__PURE__*/React.createElement(GroupBy, {
|
|
90
|
+
tables: tables,
|
|
91
|
+
className: "selected-x-axis",
|
|
92
|
+
label: intl.get('Group_by'),
|
|
93
|
+
selectedTableId: table_id,
|
|
94
|
+
selectedColumnKey: groupby_column_key,
|
|
95
|
+
selectedDateGranularity: groupby_date_granularity,
|
|
96
|
+
selectedGeolocationGranularity: groupby_geolocation_granularity,
|
|
97
|
+
onGroupByChange: onGroupByChange,
|
|
98
|
+
onGroupbyDateGranularityChange: onGroupbyDateGranularityChange,
|
|
99
|
+
onGroupbyGeolocationGranularityChange: onGroupbyGeolocationGranularityChange
|
|
100
|
+
}), /*#__PURE__*/React.createElement(Switch, {
|
|
101
|
+
key: "groupby_include_empty_cells",
|
|
102
|
+
checked: groupby_include_empty_cells,
|
|
103
|
+
placeholder: intl.get('Include_empty'),
|
|
104
|
+
onChange: onIncludeEmptyChange
|
|
105
|
+
}), /*#__PURE__*/React.createElement(Divider, {
|
|
106
|
+
className: "mt-4"
|
|
107
|
+
}), /*#__PURE__*/React.createElement(BasicSummary, {
|
|
108
|
+
className: "selected-y-axis",
|
|
109
|
+
label: intl.get('Summary_method'),
|
|
110
|
+
statistic: statistic,
|
|
111
|
+
selectedTableId: table_id,
|
|
112
|
+
tables: tables,
|
|
113
|
+
summaryTypeKey: 'summary_type',
|
|
114
|
+
summaryMethodKey: 'summary_method',
|
|
115
|
+
summaryColumnKey: 'summary_column_key',
|
|
116
|
+
supportColumnTypes: [CellType.NUMBER],
|
|
117
|
+
onChange: onChange
|
|
118
|
+
}), /*#__PURE__*/React.createElement(DataSort, {
|
|
119
|
+
statistic: statistic,
|
|
120
|
+
onChange: onChange
|
|
121
|
+
}));
|
|
122
|
+
};
|
|
123
|
+
export default DataSettings;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import React, { useCallback, useMemo } from 'react';
|
|
2
|
+
import { Label, FormGroup } from 'reactstrap';
|
|
3
|
+
import DTableSelect from "dtable-ui-component/lib/DTableSelect";
|
|
4
|
+
import Switch from '../widgets/switch';
|
|
5
|
+
import Divider from '../widgets/divider';
|
|
6
|
+
import MiniNumSlicePercent from '../widgets/mininum-slice-percent';
|
|
7
|
+
import { FontSizeSettings } from '../widgets/font-settings';
|
|
8
|
+
import { eventStopPropagation } from '../../../utils';
|
|
9
|
+
import { STATISTIC_LABEL_POSITIONS, STATISTIC_LABEL_POSITION_SHOW, STATISTIC_LABEL_FORMATS, STATISTIC_LABEL_FORMAT_SHOW } from '../../../constants';
|
|
10
|
+
import intl from '../../../intl';
|
|
11
|
+
var StyleSettings = function StyleSettings(_ref) {
|
|
12
|
+
var statistic = _ref.statistic,
|
|
13
|
+
onChange = _ref.onChange;
|
|
14
|
+
var labelPositionOptions = useMemo(function () {
|
|
15
|
+
return STATISTIC_LABEL_POSITIONS.map(function (item) {
|
|
16
|
+
return {
|
|
17
|
+
value: item,
|
|
18
|
+
label: intl.get(STATISTIC_LABEL_POSITION_SHOW[item])
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
}, []);
|
|
22
|
+
var labelFormatOptions = useMemo(function () {
|
|
23
|
+
return STATISTIC_LABEL_FORMATS.map(function (item) {
|
|
24
|
+
return {
|
|
25
|
+
value: item,
|
|
26
|
+
label: intl.get(STATISTIC_LABEL_FORMAT_SHOW[item])
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
}, []);
|
|
30
|
+
var onDisplayLegendChange = useCallback(function (event) {
|
|
31
|
+
eventStopPropagation(event);
|
|
32
|
+
var config = statistic.config;
|
|
33
|
+
var show_legend = config.show_legend;
|
|
34
|
+
onChange && onChange({
|
|
35
|
+
show_legend: !show_legend
|
|
36
|
+
});
|
|
37
|
+
}, [statistic, onChange]);
|
|
38
|
+
var onDisplayLabelChange = useCallback(function (event) {
|
|
39
|
+
eventStopPropagation(event);
|
|
40
|
+
var config = statistic.config;
|
|
41
|
+
var display_label = config.display_label;
|
|
42
|
+
onChange && onChange({
|
|
43
|
+
display_label: !display_label
|
|
44
|
+
});
|
|
45
|
+
}, [statistic, onChange]);
|
|
46
|
+
var onLabelPositionChange = useCallback(function (option) {
|
|
47
|
+
var value = option.value;
|
|
48
|
+
var config = statistic.config;
|
|
49
|
+
var label_position = config.label_position;
|
|
50
|
+
if (label_position === value) return;
|
|
51
|
+
onChange && onChange({
|
|
52
|
+
label_position: value
|
|
53
|
+
});
|
|
54
|
+
}, [statistic, onChange]);
|
|
55
|
+
var onLabelFormatChange = useCallback(function (option) {
|
|
56
|
+
var value = option.value;
|
|
57
|
+
var config = statistic.config;
|
|
58
|
+
var label_format = config.label_format;
|
|
59
|
+
if (label_format === value) return;
|
|
60
|
+
onChange && onChange({
|
|
61
|
+
label_format: value
|
|
62
|
+
});
|
|
63
|
+
}, [statistic, onChange]);
|
|
64
|
+
var onLabelFontSizeChange = useCallback(function (updatedFontSize) {
|
|
65
|
+
onChange && onChange({
|
|
66
|
+
label_font_size: updatedFontSize
|
|
67
|
+
});
|
|
68
|
+
}, [onChange]);
|
|
69
|
+
var onMinimumSlicePercentChange = useCallback(function (value) {
|
|
70
|
+
onChange && onChange({
|
|
71
|
+
minimum_slice_percent: value
|
|
72
|
+
});
|
|
73
|
+
}, [onChange]);
|
|
74
|
+
var config = statistic.config;
|
|
75
|
+
var show_legend = config.show_legend,
|
|
76
|
+
display_label = config.display_label,
|
|
77
|
+
label_position = config.label_position,
|
|
78
|
+
label_format = config.label_format,
|
|
79
|
+
label_font_size = config.label_font_size,
|
|
80
|
+
minimum_slice_percent = config.minimum_slice_percent;
|
|
81
|
+
var selectedLabelOption = labelPositionOptions.find(function (item) {
|
|
82
|
+
return item.value === label_position;
|
|
83
|
+
});
|
|
84
|
+
var selectedLabelFormat = labelFormatOptions.find(function (item) {
|
|
85
|
+
return item.value === label_format;
|
|
86
|
+
}) || labelFormatOptions[0];
|
|
87
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormGroup, {
|
|
88
|
+
className: "seastatistic-parameter-item"
|
|
89
|
+
}, /*#__PURE__*/React.createElement(Switch, {
|
|
90
|
+
key: "show_legend",
|
|
91
|
+
checked: show_legend || false,
|
|
92
|
+
placeholder: intl.get('Display_legend'),
|
|
93
|
+
onChange: onDisplayLegendChange
|
|
94
|
+
})), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(FormGroup, {
|
|
95
|
+
className: "seastatistic-parameter-item"
|
|
96
|
+
}, /*#__PURE__*/React.createElement(Switch, {
|
|
97
|
+
key: "display_label",
|
|
98
|
+
checked: display_label || false,
|
|
99
|
+
placeholder: intl.get('Display_label'),
|
|
100
|
+
onChange: onDisplayLabelChange
|
|
101
|
+
})), display_label && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormGroup, {
|
|
102
|
+
className: "seastatistic-parameter-item"
|
|
103
|
+
}, /*#__PURE__*/React.createElement(Label, null, intl.get('Label_position')), /*#__PURE__*/React.createElement(DTableSelect, {
|
|
104
|
+
value: selectedLabelOption,
|
|
105
|
+
onChange: onLabelPositionChange,
|
|
106
|
+
options: labelPositionOptions
|
|
107
|
+
})), /*#__PURE__*/React.createElement(FormGroup, {
|
|
108
|
+
className: "seastatistic-parameter-item"
|
|
109
|
+
}, /*#__PURE__*/React.createElement(Label, null, intl.get('Label_format')), /*#__PURE__*/React.createElement(DTableSelect, {
|
|
110
|
+
value: selectedLabelFormat,
|
|
111
|
+
onChange: onLabelFormatChange,
|
|
112
|
+
options: labelFormatOptions
|
|
113
|
+
})), /*#__PURE__*/React.createElement(MiniNumSlicePercent, {
|
|
114
|
+
value: minimum_slice_percent,
|
|
115
|
+
onChange: onMinimumSlicePercentChange
|
|
116
|
+
}), /*#__PURE__*/React.createElement(FontSizeSettings, {
|
|
117
|
+
title: intl.get('Label_font_size'),
|
|
118
|
+
fontSize: label_font_size,
|
|
119
|
+
defaultFontSize: 12,
|
|
120
|
+
modifyFontSize: onLabelFontSizeChange
|
|
121
|
+
})));
|
|
122
|
+
};
|
|
123
|
+
export default StyleSettings;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import React, { useCallback } from 'react';
|
|
3
|
+
import { STATISTIC_TYPE, SUPPORT_TITLE_CHART_TYPES } from '../../constants';
|
|
4
|
+
import { BarStyleSettings } from './bar-settings';
|
|
5
|
+
import { AdvanceBarStyleSettings } from './advance-bar-settings';
|
|
6
|
+
import { TimeComparisonStyleSettings } from './time-comparison-settings';
|
|
7
|
+
import { PieStyleSettings } from './pie-settings';
|
|
8
|
+
import Divider from './widgets/divider';
|
|
9
|
+
import { HorizontalStyleSettings } from './horizontal-bar-settings';
|
|
10
|
+
import { BasicNumberCardStyleSettings } from './basic-number-card';
|
|
11
|
+
import { CombinationStyleSettings } from './combination-settings';
|
|
12
|
+
import StatisticTitleSetting from './widgets/title-settings';
|
|
13
|
+
var StyleSettings = function StyleSettings(_ref) {
|
|
14
|
+
var statistic = _ref.statistic,
|
|
15
|
+
onChange = _ref.onChange;
|
|
16
|
+
var modifyStatisticSettings = useCallback(function (update) {
|
|
17
|
+
var newUpdate = _objectSpread(_objectSpread({}, statistic.config), update);
|
|
18
|
+
onChange({
|
|
19
|
+
config: newUpdate
|
|
20
|
+
});
|
|
21
|
+
}, [statistic, onChange]);
|
|
22
|
+
var modifyCommonSettings = useCallback(function (update) {
|
|
23
|
+
var newUpdate = _objectSpread(_objectSpread({}, statistic.style_config), update);
|
|
24
|
+
onChange({
|
|
25
|
+
style_config: newUpdate
|
|
26
|
+
});
|
|
27
|
+
}, [statistic, onChange]);
|
|
28
|
+
var modifyTitle = useCallback(function (title) {
|
|
29
|
+
var style_config = statistic.style_config;
|
|
30
|
+
var update = style_config ? _objectSpread(_objectSpread({}, style_config), {}, {
|
|
31
|
+
title: title
|
|
32
|
+
}) : {
|
|
33
|
+
title: title
|
|
34
|
+
};
|
|
35
|
+
onChange({
|
|
36
|
+
style_config: update
|
|
37
|
+
});
|
|
38
|
+
}, [statistic, onChange]);
|
|
39
|
+
var renderTitleSettings = useCallback(function () {
|
|
40
|
+
var type = statistic.config.type;
|
|
41
|
+
var style_config = statistic.style_config;
|
|
42
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, SUPPORT_TITLE_CHART_TYPES.includes(type) && /*#__PURE__*/React.createElement(StatisticTitleSetting, {
|
|
43
|
+
key: "title-setting-".concat(statistic.id),
|
|
44
|
+
title: style_config && style_config.title,
|
|
45
|
+
modifyTitle: modifyTitle
|
|
46
|
+
}), type !== STATISTIC_TYPE.TREE_MAP && type !== STATISTIC_TYPE.TABLE && /*#__PURE__*/React.createElement(Divider, null));
|
|
47
|
+
}, [statistic, modifyTitle]);
|
|
48
|
+
var renderStatisticStyleSettings = useCallback(function () {
|
|
49
|
+
var config = statistic.config;
|
|
50
|
+
var type = config.type;
|
|
51
|
+
var props = {
|
|
52
|
+
statistic: statistic,
|
|
53
|
+
onChange: modifyStatisticSettings
|
|
54
|
+
};
|
|
55
|
+
switch (type) {
|
|
56
|
+
case STATISTIC_TYPE.BAR:
|
|
57
|
+
case STATISTIC_TYPE.LINE:
|
|
58
|
+
case STATISTIC_TYPE.AREA:
|
|
59
|
+
{
|
|
60
|
+
return /*#__PURE__*/React.createElement(BarStyleSettings, props);
|
|
61
|
+
}
|
|
62
|
+
case STATISTIC_TYPE.HORIZONTAL_BAR:
|
|
63
|
+
case STATISTIC_TYPE.HORIZONTAL_GROUP_BAR:
|
|
64
|
+
{
|
|
65
|
+
return /*#__PURE__*/React.createElement(HorizontalStyleSettings, props);
|
|
66
|
+
}
|
|
67
|
+
case STATISTIC_TYPE.BAR_GROUP:
|
|
68
|
+
case STATISTIC_TYPE.BAR_STACK:
|
|
69
|
+
case STATISTIC_TYPE.LINE_GROUP:
|
|
70
|
+
case STATISTIC_TYPE.AREA_GROUP:
|
|
71
|
+
{
|
|
72
|
+
return /*#__PURE__*/React.createElement(AdvanceBarStyleSettings, props);
|
|
73
|
+
}
|
|
74
|
+
case STATISTIC_TYPE.COMPARE_BAR:
|
|
75
|
+
{
|
|
76
|
+
return /*#__PURE__*/React.createElement(TimeComparisonStyleSettings, props);
|
|
77
|
+
}
|
|
78
|
+
case STATISTIC_TYPE.COMBINATION:
|
|
79
|
+
{
|
|
80
|
+
return /*#__PURE__*/React.createElement(CombinationStyleSettings, props);
|
|
81
|
+
}
|
|
82
|
+
case STATISTIC_TYPE.PIE:
|
|
83
|
+
case STATISTIC_TYPE.RING:
|
|
84
|
+
{
|
|
85
|
+
return /*#__PURE__*/React.createElement(PieStyleSettings, props);
|
|
86
|
+
}
|
|
87
|
+
case STATISTIC_TYPE.BASIC_NUMBER_CARD:
|
|
88
|
+
case STATISTIC_TYPE.DASHBOARD:
|
|
89
|
+
{
|
|
90
|
+
return /*#__PURE__*/React.createElement(BasicNumberCardStyleSettings, props);
|
|
91
|
+
}
|
|
92
|
+
default:
|
|
93
|
+
{
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}, [statistic, modifyStatisticSettings]);
|
|
98
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, renderTitleSettings(), renderStatisticStyleSettings());
|
|
99
|
+
};
|
|
100
|
+
export default StyleSettings;
|