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.
Files changed (214) hide show
  1. package/README.md +4 -0
  2. package/lib/assets/icons/area-chart.svg +10 -0
  3. package/lib/assets/icons/bar-chart.svg +12 -0
  4. package/lib/assets/icons/card.svg +22 -0
  5. package/lib/assets/icons/combination-chart.svg +17 -0
  6. package/lib/assets/icons/dtable-logo.svg +16 -0
  7. package/lib/assets/icons/facet-chart.svg +12 -0
  8. package/lib/assets/icons/gauge.svg +18 -0
  9. package/lib/assets/icons/heat-map.svg +14 -0
  10. package/lib/assets/icons/histogram.svg +12 -0
  11. package/lib/assets/icons/line-chart.svg +12 -0
  12. package/lib/assets/icons/map.svg +20 -0
  13. package/lib/assets/icons/pie-chart.svg +11 -0
  14. package/lib/assets/icons/rectangular-tree-diagram.svg +10 -0
  15. package/lib/assets/icons/scatter-chart.svg +15 -0
  16. package/lib/assets/icons/type-change.svg +17 -0
  17. package/lib/assets/img/area-chart.png +0 -0
  18. package/lib/assets/img/area-group-chart.png +0 -0
  19. package/lib/assets/img/bar-group.png +0 -0
  20. package/lib/assets/img/bar-stack.png +0 -0
  21. package/lib/assets/img/bar.png +0 -0
  22. package/lib/assets/img/combination-chart.png +0 -0
  23. package/lib/assets/img/compared-chart.png +0 -0
  24. package/lib/assets/img/completeness-chart.png +0 -0
  25. package/lib/assets/img/custom-bar.png +0 -0
  26. package/lib/assets/img/dashboard-chart.png +0 -0
  27. package/lib/assets/img/group-completeness-chart.png +0 -0
  28. package/lib/assets/img/group_line.png +0 -0
  29. package/lib/assets/img/heat-map.png +0 -0
  30. package/lib/assets/img/horizontal-bar.png +0 -0
  31. package/lib/assets/img/horizontal-group-bar.png +0 -0
  32. package/lib/assets/img/line.png +0 -0
  33. package/lib/assets/img/map-bubble.png +0 -0
  34. package/lib/assets/img/map.png +0 -0
  35. package/lib/assets/img/mirror.png +0 -0
  36. package/lib/assets/img/number-card.png +0 -0
  37. package/lib/assets/img/pie.png +0 -0
  38. package/lib/assets/img/pivot-table.png +0 -0
  39. package/lib/assets/img/ring.png +0 -0
  40. package/lib/assets/img/scatter.png +0 -0
  41. package/lib/assets/img/stacked-horizontal-bar.png +0 -0
  42. package/lib/assets/img/treemap.png +0 -0
  43. package/lib/assets/img/trend-chart.png +0 -0
  44. package/lib/assets/img/world-map-bubble.png +0 -0
  45. package/lib/assets/img/world-map.png +0 -0
  46. package/lib/components/collaborator/index.js +24 -0
  47. package/lib/components/formatter/area.js +162 -0
  48. package/lib/components/formatter/bar-group.js +160 -0
  49. package/lib/components/formatter/bar.js +150 -0
  50. package/lib/components/formatter/basic-number-card.js +138 -0
  51. package/lib/components/formatter/chart-component.js +266 -0
  52. package/lib/components/formatter/combination.js +407 -0
  53. package/lib/components/formatter/dashboard.js +182 -0
  54. package/lib/components/formatter/horizontal-bar-group.js +161 -0
  55. package/lib/components/formatter/horizontal-bar.js +152 -0
  56. package/lib/components/formatter/horizontal-component.js +91 -0
  57. package/lib/components/formatter/index.js +181 -0
  58. package/lib/components/formatter/line-group.js +157 -0
  59. package/lib/components/formatter/line.js +170 -0
  60. package/lib/components/formatter/pie.js +201 -0
  61. package/lib/components/formatter/ring.js +277 -0
  62. package/lib/components/formatter/table/index.css +103 -0
  63. package/lib/components/formatter/table/index.js +42 -0
  64. package/lib/components/formatter/table/one-dimension-table-no-numeric-columns.js +145 -0
  65. package/lib/components/formatter/table/one-dimension-table-with-numeric-columns.js +193 -0
  66. package/lib/components/formatter/table/pivot-table-display-name.js +249 -0
  67. package/lib/components/formatter/table/two-dimension-table.js +241 -0
  68. package/lib/components/formatter/treemap.js +213 -0
  69. package/lib/components/icon/index.css +5 -0
  70. package/lib/components/icon/index.js +22 -0
  71. package/lib/components/index.js +5 -0
  72. package/lib/components/loading/index.css +54 -0
  73. package/lib/components/loading/index.js +10 -0
  74. package/lib/components/number-input/index.js +31 -0
  75. package/lib/components/pixel-editor/index.css +29 -0
  76. package/lib/components/pixel-editor/index.js +42 -0
  77. package/lib/components/select-group/index.css +67 -0
  78. package/lib/components/select-group/index.js +63 -0
  79. package/lib/components/settings/advance-bar-settings/data-settings.js +120 -0
  80. package/lib/components/settings/advance-bar-settings/index.js +3 -0
  81. package/lib/components/settings/advance-bar-settings/style-settings.js +149 -0
  82. package/lib/components/settings/bar-settings/data-settings.js +137 -0
  83. package/lib/components/settings/bar-settings/index.js +3 -0
  84. package/lib/components/settings/bar-settings/style-settings.js +163 -0
  85. package/lib/components/settings/basic-number-card/data-settings.js +121 -0
  86. package/lib/components/settings/basic-number-card/index.js +3 -0
  87. package/lib/components/settings/basic-number-card/style-settings.js +42 -0
  88. package/lib/components/settings/combination-settings/data-settings.js +256 -0
  89. package/lib/components/settings/combination-settings/index.js +3 -0
  90. package/lib/components/settings/combination-settings/style-settings.js +183 -0
  91. package/lib/components/settings/dashboard-settings/data-settings.js +167 -0
  92. package/lib/components/settings/dashboard-settings/index.js +2 -0
  93. package/lib/components/settings/data-settings.js +67 -0
  94. package/lib/components/settings/horizontal-bar-settings/data-settings.js +45 -0
  95. package/lib/components/settings/horizontal-bar-settings/index.js +3 -0
  96. package/lib/components/settings/horizontal-bar-settings/style-settings.js +38 -0
  97. package/lib/components/settings/index.css +73 -0
  98. package/lib/components/settings/index.js +74 -0
  99. package/lib/components/settings/pie-settings/data-settings.js +123 -0
  100. package/lib/components/settings/pie-settings/index.js +3 -0
  101. package/lib/components/settings/pie-settings/style-settings.js +123 -0
  102. package/lib/components/settings/style-settings.js +100 -0
  103. package/lib/components/settings/table-settings/data-settings.js +488 -0
  104. package/lib/components/settings/table-settings/index.js +2 -0
  105. package/lib/components/settings/time-comparison-settings/data-settings.js +157 -0
  106. package/lib/components/settings/time-comparison-settings/index.js +3 -0
  107. package/lib/components/settings/time-comparison-settings/style-settings.js +191 -0
  108. package/lib/components/settings/widgets/basic-summary/index.css +12 -0
  109. package/lib/components/settings/widgets/basic-summary/index.js +173 -0
  110. package/lib/components/settings/widgets/common-data-settings.js +42 -0
  111. package/lib/components/settings/widgets/data-filter/index.css +17 -0
  112. package/lib/components/settings/widgets/data-filter/index.js +76 -0
  113. package/lib/components/settings/widgets/data-sort.js +38 -0
  114. package/lib/components/settings/widgets/date-summary-item.js +126 -0
  115. package/lib/components/settings/widgets/display-values-settings/index.css +13 -0
  116. package/lib/components/settings/widgets/display-values-settings/index.js +37 -0
  117. package/lib/components/settings/widgets/divider/index.css +4 -0
  118. package/lib/components/settings/widgets/divider/index.js +10 -0
  119. package/lib/components/settings/widgets/font-settings/font-size-settings.js +31 -0
  120. package/lib/components/settings/widgets/font-settings/font-weight-settings.js +46 -0
  121. package/lib/components/settings/widgets/font-settings/index.js +3 -0
  122. package/lib/components/settings/widgets/group-by.js +168 -0
  123. package/lib/components/settings/widgets/label-color.js +30 -0
  124. package/lib/components/settings/widgets/min-max-setting.js +64 -0
  125. package/lib/components/settings/widgets/mininum-slice-percent.js +72 -0
  126. package/lib/components/settings/widgets/numeric-summary-item.js +109 -0
  127. package/lib/components/settings/widgets/select-table/index.css +0 -0
  128. package/lib/components/settings/widgets/select-table/index.js +49 -0
  129. package/lib/components/settings/widgets/stack.js +58 -0
  130. package/lib/components/settings/widgets/statistic-type/index.css +31 -0
  131. package/lib/components/settings/widgets/statistic-type/index.js +54 -0
  132. package/lib/components/settings/widgets/summary-method-setting.js +80 -0
  133. package/lib/components/settings/widgets/summary-settings.js +394 -0
  134. package/lib/components/settings/widgets/switch/index.css +37 -0
  135. package/lib/components/settings/widgets/switch/index.js +21 -0
  136. package/lib/components/settings/widgets/text-horizontal-settings.js +23 -0
  137. package/lib/components/settings/widgets/time-picker.js +182 -0
  138. package/lib/components/settings/widgets/title-settings/index.js +58 -0
  139. package/lib/components/settings/widgets/title-settings/title-text.js +31 -0
  140. package/lib/components/settings/widgets/x-axios.js +0 -0
  141. package/lib/components/settings/widgets/y-axis-group-settings.js +399 -0
  142. package/lib/components/types-dialog/index.css +97 -0
  143. package/lib/components/types-dialog/index.js +127 -0
  144. package/lib/constants/geolocation.js +11 -0
  145. package/lib/constants/index.js +164 -0
  146. package/lib/constants/model.js +167 -0
  147. package/lib/constants/style.js +13 -0
  148. package/lib/constants/type-image.js +32 -0
  149. package/lib/constants/type.js +97 -0
  150. package/lib/context.js +49 -0
  151. package/lib/index.js +6 -0
  152. package/lib/intl.js +37 -0
  153. package/lib/layout/index.js +4 -0
  154. package/lib/layout/statistic/index.css +53 -0
  155. package/lib/layout/statistic/index.js +190 -0
  156. package/lib/layout/title/index.css +3 -0
  157. package/lib/layout/title/index.js +41 -0
  158. package/lib/locale/index.js +11 -0
  159. package/lib/locale/lang/de.js +141 -0
  160. package/lib/locale/lang/en.js +143 -0
  161. package/lib/locale/lang/es.js +141 -0
  162. package/lib/locale/lang/fr.js +141 -0
  163. package/lib/locale/lang/pt.js +141 -0
  164. package/lib/locale/lang/ru.js +141 -0
  165. package/lib/locale/lang/zh_CN.js +143 -0
  166. package/lib/model/area-group.js +51 -0
  167. package/lib/model/area.js +42 -0
  168. package/lib/model/bar-group.js +54 -0
  169. package/lib/model/bar-stack.js +51 -0
  170. package/lib/model/bar.js +48 -0
  171. package/lib/model/base-model.js +11 -0
  172. package/lib/model/basic-number-card.js +32 -0
  173. package/lib/model/combination.js +48 -0
  174. package/lib/model/compare-bar.js +49 -0
  175. package/lib/model/completeness-group.js +34 -0
  176. package/lib/model/completeness.js +28 -0
  177. package/lib/model/dashboard.js +26 -0
  178. package/lib/model/generic-model.js +235 -0
  179. package/lib/model/heat-map.js +33 -0
  180. package/lib/model/horizontal-bar.js +48 -0
  181. package/lib/model/horizontal-group-bar.js +53 -0
  182. package/lib/model/index.js +36 -0
  183. package/lib/model/line-group.js +54 -0
  184. package/lib/model/line.js +48 -0
  185. package/lib/model/map-bubble.js +37 -0
  186. package/lib/model/map.js +37 -0
  187. package/lib/model/mirror.js +36 -0
  188. package/lib/model/pie.js +36 -0
  189. package/lib/model/ring.js +36 -0
  190. package/lib/model/scatter.js +29 -0
  191. package/lib/model/stacked-horizontal-bar.js +42 -0
  192. package/lib/model/statistic.js +22 -0
  193. package/lib/model/table.js +33 -0
  194. package/lib/model/tree-map.js +30 -0
  195. package/lib/model/trend.js +34 -0
  196. package/lib/model/user.js +22 -0
  197. package/lib/model/world-map-bubble.js +36 -0
  198. package/lib/model/world-map.js +36 -0
  199. package/lib/utils/cell-format-utils.js +41 -0
  200. package/lib/utils/chart.js +6 -0
  201. package/lib/utils/collaborator-utils.js +40 -0
  202. package/lib/utils/column-utils.js +247 -0
  203. package/lib/utils/custom-g2.js +612 -0
  204. package/lib/utils/data-filter/filter-item-utils.js +80 -0
  205. package/lib/utils/data-filter/filters-utils.js +406 -0
  206. package/lib/utils/data-filter/index.js +3 -0
  207. package/lib/utils/date-translate.js +66 -0
  208. package/lib/utils/index.js +50 -0
  209. package/lib/utils/key-generator.js +13 -0
  210. package/lib/utils/object-utils.js +61 -0
  211. package/lib/utils/options-utils.js +61 -0
  212. package/lib/utils/statistic-column-2-sql-column-utils.js +499 -0
  213. package/lib/utils/statistic-utils.js +1685 -0
  214. 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,3 @@
1
+ import PieDataSettings from './data-settings';
2
+ import PieStyleSettings from './style-settings';
3
+ export { PieDataSettings, PieStyleSettings };
@@ -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;