sea-chart 1.1.0 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/components/chart-color-selector/color-selector.js +3 -3
  2. package/dist/components/color-picker/index.js +46 -62
  3. package/dist/constants/color-rules.js +1 -1
  4. package/dist/constants/error.js +6 -0
  5. package/dist/constants/index.js +22 -4
  6. package/dist/context.js +2 -2
  7. package/dist/locale/lang/de.js +3 -2
  8. package/dist/locale/lang/en.js +1 -0
  9. package/dist/locale/lang/es.js +1 -0
  10. package/dist/locale/lang/fr.js +3 -2
  11. package/dist/locale/lang/pt.js +1 -0
  12. package/dist/locale/lang/ru.js +1 -0
  13. package/dist/locale/lang/zh_CN.js +1 -0
  14. package/dist/model/trend.js +2 -2
  15. package/dist/settings/advance-bar-settings/style-settings.js +2 -2
  16. package/dist/settings/basic-number-card/style-settings.js +8 -3
  17. package/dist/settings/completeness-settings/style-settings.js +3 -1
  18. package/dist/settings/index.js +9 -4
  19. package/dist/settings/pie-settings/style-settings.js +2 -2
  20. package/dist/settings/trend-settings/style-setting.js +8 -3
  21. package/dist/settings/widgets/color-settings/index.js +9 -1
  22. package/dist/settings/widgets/time-picker.js +1 -1
  23. package/dist/settings/widgets/title-settings/index.js +6 -3
  24. package/dist/utils/contexts.js +2 -1
  25. package/dist/utils/index.js +8 -1
  26. package/dist/view/index.css +5 -0
  27. package/dist/view/index.js +6 -2
  28. package/dist/view/wrapper/area.js +20 -9
  29. package/dist/view/wrapper/bar-custom.js +1 -0
  30. package/dist/view/wrapper/bar-group.js +4 -4
  31. package/dist/view/wrapper/bar.js +2 -2
  32. package/dist/view/wrapper/basic-number-card.js +1 -1
  33. package/dist/view/wrapper/chart-component.js +17 -3
  34. package/dist/view/wrapper/combination.js +1 -0
  35. package/dist/view/wrapper/compare.js +2 -2
  36. package/dist/view/wrapper/completeness.js +4 -4
  37. package/dist/view/wrapper/heat-map.js +1 -0
  38. package/dist/view/wrapper/horizontal-bar-group.js +4 -4
  39. package/dist/view/wrapper/horizontal-bar.js +2 -2
  40. package/dist/view/wrapper/index.js +4 -2
  41. package/dist/view/wrapper/line-group.js +9 -3
  42. package/dist/view/wrapper/line.js +13 -3
  43. package/dist/view/wrapper/map.js +1 -2
  44. package/dist/view/wrapper/mirror.js +2 -2
  45. package/dist/view/wrapper/pie.js +7 -9
  46. package/dist/view/wrapper/ring.js +7 -9
  47. package/dist/view/wrapper/scatter.js +3 -3
  48. package/dist/view/wrapper/treemap.js +1 -0
  49. package/dist/view/wrapper/world-map.js +1 -2
  50. package/package.json +2 -2
  51. package/dist/components/color-setting/color-picker.js +0 -123
@@ -1,7 +1,7 @@
1
1
  import _DTableSelect from "dtable-ui-component/lib/DTableSelect";
2
2
  import React from 'react';
3
3
  import { FormGroup, Label } from 'reactstrap';
4
- import { STACK_AND_PIE_CHART_THEMES_OPTIONS } from '../../constants/color-rules';
4
+ import { SUPPORT_SINGLE_SELECT_THEMES_OPTIONS } from '../../constants/color-rules';
5
5
  import intl from '../../intl';
6
6
  export default function ColorSelector(_ref) {
7
7
  let {
@@ -9,10 +9,10 @@ export default function ColorSelector(_ref) {
9
9
  onChange
10
10
  } = _ref;
11
11
  const options = [{
12
- value: STACK_AND_PIE_CHART_THEMES_OPTIONS.DEFAULT,
12
+ value: SUPPORT_SINGLE_SELECT_THEMES_OPTIONS.DEFAULT,
13
13
  label: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, intl.get('Use_default_color')))
14
14
  }, {
15
- value: STACK_AND_PIE_CHART_THEMES_OPTIONS.SINGLE_SELECT_COLUMN_COLORS,
15
+ value: SUPPORT_SINGLE_SELECT_THEMES_OPTIONS.SINGLE_SELECT_COLUMN_COLORS,
16
16
  label: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, intl.get('Use_colors_in_single_select_solumn')))
17
17
  }];
18
18
  const selectedOption = options.find(option => option.value === colorTheme);
@@ -1,77 +1,65 @@
1
+ import _DTableColorPicker from "dtable-ui-component/lib/DTableColorPicker";
1
2
  import React from 'react';
2
- import { ChromePicker } from 'react-color';
3
3
  import './index.css';
4
- const COVER = {
5
- top: '0px',
6
- right: '0px',
7
- bottom: '0px',
8
- left: '0px'
9
- };
10
4
  class ColorPicker extends React.PureComponent {
11
5
  constructor(props) {
12
6
  super(props);
13
- this.onInputChanged = event => {
14
- const value = event.target.value;
15
- if (value === this.state.activeColor) return;
16
- this.updateColor(value);
17
- this.setState({
18
- activeColor: value
19
- });
20
- };
21
7
  this.onPickColorToggle = () => {
22
8
  this.setState({
23
9
  isShowColorPicker: !this.state.isShowColorPicker
10
+ }, () => {
11
+ if (this.state.isShowColorPicker) {
12
+ this.getPopoverStyle();
13
+ }
24
14
  });
25
15
  };
26
- this.onPickChanged = color => {
27
- if (color.hex === this.state.activeColor) return;
28
- this.updateColor(color.hex);
29
- this.setState({
30
- activeColor: color.hex
31
- });
32
- };
33
- this.updateColor = color => {
34
- this.props.onColorChanged(color);
16
+ this.onInputChanged = event => {
17
+ const value = event.target.value;
18
+ if (value === this.props.activeColor) return;
19
+ this.props.onColorChanged(value);
35
20
  };
36
21
  this.getPopoverStyle = () => {
37
- if (!this.colorPickerContainerRef) return {};
38
- const {
39
- top,
40
- height
41
- } = this.colorPickerContainerRef.getBoundingClientRect();
42
- const {
43
- clientHeight
44
- } = document.body;
45
- const selectTop = top + height;
46
- if (clientHeight - selectTop < 247) {
47
- // 247: ChromePicker's height
48
- return {
49
- position: 'absolute',
50
- left: 0,
51
- bottom: '2.375rem',
52
- zIndex: '2'
22
+ if (!this.colorPickerContainerRef || !this.colorPickerRef) return {};
23
+ setTimeout(() => {
24
+ const {
25
+ top,
26
+ height
27
+ } = this.colorPickerContainerRef.getBoundingClientRect();
28
+ const {
29
+ clientHeight
30
+ } = document.body;
31
+ const selectTop = top + height;
32
+ let colorPickerHeight = 0;
33
+ if (this.colorPickerRef.current) {
34
+ colorPickerHeight = this.colorPickerRef.current.getHeight();
35
+ }
36
+ let style = {
37
+ left: 0
53
38
  };
54
- }
55
- return {
56
- position: 'absolute',
57
- left: 0,
58
- zIndex: '2'
59
- };
39
+ if (clientHeight - selectTop < colorPickerHeight) {
40
+ style = {
41
+ ...style,
42
+ bottom: '2.375rem'
43
+ };
44
+ }
45
+ this.setState({
46
+ popoverStyle: style
47
+ });
48
+ }, 10);
60
49
  };
61
50
  this.state = {
62
51
  isShowColorPicker: false,
63
- activeColor: props.activeColor
52
+ popoverStyle: {}
64
53
  };
65
54
  this.colorPickerContainerRef = null;
66
- }
67
- UNSAFE_componentWillReceiveProps(nextProps) {
68
- this.setState({
69
- activeColor: nextProps.activeColor
70
- });
55
+ this.colorPickerRef = React.createRef();
71
56
  }
72
57
  render() {
73
58
  const {
74
59
  activeColor
60
+ } = this.props;
61
+ const {
62
+ popoverStyle
75
63
  } = this.state;
76
64
  const isWhiteColor = activeColor && activeColor.toUpperCase() === '#FFFFFF';
77
65
  return /*#__PURE__*/React.createElement("div", {
@@ -90,17 +78,13 @@ class ColorPicker extends React.PureComponent {
90
78
  type: "text",
91
79
  value: activeColor,
92
80
  onChange: this.onInputChanged
93
- })), this.state.isShowColorPicker && /*#__PURE__*/React.createElement("div", {
94
- style: this.getPopoverStyle()
95
- }, /*#__PURE__*/React.createElement("div", {
96
- className: "position-fixed",
97
- style: COVER,
98
- onClick: this.onPickColorToggle
99
- }), /*#__PURE__*/React.createElement(ChromePicker, {
100
- disableAlpha: true,
81
+ })), this.state.isShowColorPicker && /*#__PURE__*/React.createElement(_DTableColorPicker, {
82
+ ref: this.colorPickerRef,
101
83
  color: activeColor,
102
- onChange: this.onPickChanged
103
- })));
84
+ onSubmit: this.props.onColorChanged,
85
+ onToggle: this.onPickColorToggle,
86
+ popoverStyle: popoverStyle
87
+ }));
104
88
  }
105
89
  }
106
90
  ColorPicker.defaultProps = {
@@ -1,5 +1,5 @@
1
1
  import { CellType, FILTER_PREDICATE_TYPE } from 'dtable-utils';
2
- export const STACK_AND_PIE_CHART_THEMES_OPTIONS = {
2
+ export const SUPPORT_SINGLE_SELECT_THEMES_OPTIONS = {
3
3
  DEFAULT: 'default',
4
4
  SINGLE_SELECT_COLUMN_COLORS: 'single_select_column_colors'
5
5
  };
@@ -0,0 +1,6 @@
1
+ export const SERVER_ERROR_MSG = {
2
+ EXECUTION_COST_EXCEEDED: 'Execution cost exceeded'
3
+ };
4
+ export const SERVER_ERROR_DISPLAY_KEY = {
5
+ [SERVER_ERROR_MSG.EXECUTION_COST_EXCEEDED]: 'Execution_time_of_the_query_exceeds_the_limit'
6
+ };
@@ -172,9 +172,16 @@ export const CHART_THEME_COLOR = {
172
172
  textColor: '#ffffff',
173
173
  fontSize: 13,
174
174
  gridColor: '#4E4E56',
175
+ XAxisColor: '#ffffff',
175
176
  labelColor: '#ffffff',
177
+ ringLabelColor: '#ffffff',
178
+ annotationTitleFontColor: '#ffffff',
179
+ annotationValueFontColor: '#ffffff',
180
+ annotationFontSize: 18,
176
181
  legendPageNavigatorMarkerColor: '#ffffff',
177
- cardColor: '#ffffff'
182
+ cardColor: '#ffffff',
183
+ legendTextColor: '#ffffff',
184
+ legendFontSize: 14
178
185
  },
179
186
  light: {
180
187
  pivotTextColor: '#212529',
@@ -187,10 +194,10 @@ export const CHART_THEME_COLOR = {
187
194
  annotationTitleFontColor: '#666666',
188
195
  annotationValueFontColor: '#212529',
189
196
  annotationFontSize: 18,
197
+ legendPageNavigatorMarkerColor: '#999999',
190
198
  cardColor: '#545454',
191
199
  legendTextColor: '#333333',
192
- legendFontSize: 14,
193
- legendPageNavigatorMarkerColor: '#999999'
200
+ legendFontSize: 14
194
201
  }
195
202
  };
196
203
  export const DTABLE_DB_SUMMARY_METHOD = {
@@ -210,7 +217,18 @@ export const CHART_SUPPORT_FONT_WEIGHTS = [400, 700];
210
217
  export const DEFAULT_CHART_FONT_WEIGHT = CHART_SUPPORT_FONT_WEIGHTS[1];
211
218
  export const DEFAULT_TREND_CHART_TITLE_FONT_SIZE = 16;
212
219
  export const DEFAULT_CHART_TITLE_FONT_SIZE = 18;
213
- export const DEFAULT_CHART_TITLE_FONT_COLOR = '#212529';
220
+ export const DEFAULT_CHART_TITLE_FONT_COLOR_LIGHT = '#212529';
221
+ export const DEFAULT_CHART_TITLE_FONT_COLOR_DARK = '#FFFFFF';
222
+ export const TITLE_FONT_COLOR_MAP = {
223
+ [THEME_NAME_MAP.LIGHT]: DEFAULT_CHART_TITLE_FONT_COLOR_LIGHT,
224
+ [THEME_NAME_MAP.DARK]: DEFAULT_CHART_TITLE_FONT_COLOR_DARK
225
+ };
226
+ export const DEFAULT_CARD_LABEL_FONT_COLOR_LIGHT = '#999999';
227
+ export const DEFAULT_CARD_LABEL_FONT_COLOR_DARK = '#FFFFFF';
228
+ export const LABEL_FONT_COLOR_MAP = {
229
+ [THEME_NAME_MAP.LIGHT]: DEFAULT_CARD_LABEL_FONT_COLOR_LIGHT,
230
+ [THEME_NAME_MAP.DARK]: DEFAULT_CARD_LABEL_FONT_COLOR_DARK
231
+ };
214
232
  export const CHART_SETTINGS_TYPE = {
215
233
  DATA: 'data',
216
234
  CHART_STYLE: 'style',
package/dist/context.js CHANGED
@@ -112,9 +112,9 @@ class Context {
112
112
  server,
113
113
  mediaUrl
114
114
  } = this.settings;
115
- return "".concat(server).concat(mediaUrl, "dtable-statistic/img/").concat(name);
115
+ return "".concat(server).concat(mediaUrl, "dtable-statistic/img/").concat(name, "?v=0.0.1");
116
116
  }
117
- return "".concat(DEFAULT_MEDIAURL, "dtable-statistic/img/").concat(name);
117
+ return "".concat(DEFAULT_MEDIAURL, "dtable-statistic/img/").concat(name, "?v=0.0.1");
118
118
  };
119
119
  this.api = null;
120
120
  this.settings = {};
@@ -144,6 +144,7 @@ const de = {
144
144
  "Internal_server_error": "Interner Serverfehler",
145
145
  "Network_error": "Netzwerkfehler",
146
146
  "Permission_denied": "Zugriff verweigert",
147
+ "Execution_time_of_the_query_exceeds_the_limit": "Execution time of the query exceeds the limit. Data cannot be loaded.",
147
148
  "There_are_some_problems_with_the_filters": "Die Filterbedingungen sind abnormal. Bitte setzen sie die Filterbedingungen in den Ansichtseinstellungen zurück.",
148
149
  "Please_complete_the_chart_configuration_first": "Schließen Sie die Konfiguration des Diagramms ab.",
149
150
  "Not_used": "Nicht verwendet",
@@ -251,8 +252,8 @@ const de = {
251
252
  "Use_default_color": "Standardfarbe verwenden",
252
253
  "Use_colors_in_single_select_solumn": "Verwenden Sie Farben in einer einzelnen Auswahlspalte",
253
254
  "Search_records": "Einträge suchen",
254
- "Please_select_a_grouping_column": "Bitte Gruppierungsspalte auswählen",
255
- "View": "Sicht",
255
+ "Please_select_a_grouping_column": "Please select grouping column",
256
+ "View": "View",
256
257
  "All_charts": "All charts"
257
258
  };
258
259
  export default de;
@@ -144,6 +144,7 @@ const en = {
144
144
  "Internal_server_error": "Internal server error",
145
145
  "Network_error": "Network error",
146
146
  "Permission_denied": "Permission denied",
147
+ "Execution_time_of_the_query_exceeds_the_limit": "Execution time of the query exceeds the limit. Data cannot be loaded.",
147
148
  "There_are_some_problems_with_the_filters": "There are some problems with the filters.",
148
149
  "Please_complete_the_chart_configuration_first": "Please complete the chart configuration first",
149
150
  "Not_used": "Not used",
@@ -144,6 +144,7 @@ const es = {
144
144
  "Internal_server_error": "Internal server error",
145
145
  "Network_error": "Network error",
146
146
  "Permission_denied": "Permission denied",
147
+ "Execution_time_of_the_query_exceeds_the_limit": "Execution time of the query exceeds the limit. Data cannot be loaded.",
147
148
  "There_are_some_problems_with_the_filters": "There are some problems with the filters.",
148
149
  "Please_complete_the_chart_configuration_first": "Please complete the chart configuration first",
149
150
  "Not_used": "Not used",
@@ -144,6 +144,7 @@ const fr = {
144
144
  "Internal_server_error": "Erreur interne du serveur",
145
145
  "Network_error": "Erreur réseau",
146
146
  "Permission_denied": "Permission refusée",
147
+ "Execution_time_of_the_query_exceeds_the_limit": "Execution time of the query exceeds the limit. Data cannot be loaded.",
147
148
  "There_are_some_problems_with_the_filters": "Les conditions de filtrage sont anormales. Veuillez réinitialiser les conditions de filtrage dans les paramètres de vue.",
148
149
  "Please_complete_the_chart_configuration_first": "Compléter la configuration du diagramme",
149
150
  "Not_used": "Ne pas utilisé",
@@ -251,8 +252,8 @@ const fr = {
251
252
  "Use_default_color": "Utiliser la couleur par défaut",
252
253
  "Use_colors_in_single_select_solumn": "Utiliser les couleurs dans une colonne de sélection unique",
253
254
  "Search_records": "Rechercher des enregistrements",
254
- "Please_select_a_grouping_column": "Veuillez sélectionner la colonne de regroupement",
255
- "View": "Voir",
255
+ "Please_select_a_grouping_column": "Please select grouping column",
256
+ "View": "View",
256
257
  "All_charts": "All charts"
257
258
  };
258
259
  export default fr;
@@ -144,6 +144,7 @@ const pt = {
144
144
  "Internal_server_error": "Internal server error",
145
145
  "Network_error": "Network error",
146
146
  "Permission_denied": "Permission denied",
147
+ "Execution_time_of_the_query_exceeds_the_limit": "Execution time of the query exceeds the limit. Data cannot be loaded.",
147
148
  "There_are_some_problems_with_the_filters": "There are some problems with the filters.",
148
149
  "Please_complete_the_chart_configuration_first": "Please complete the chart configuration first",
149
150
  "Not_used": "Not used",
@@ -144,6 +144,7 @@ const ru = {
144
144
  "Internal_server_error": "Internal server error",
145
145
  "Network_error": "Network error",
146
146
  "Permission_denied": "Permission denied",
147
+ "Execution_time_of_the_query_exceeds_the_limit": "Execution time of the query exceeds the limit. Data cannot be loaded.",
147
148
  "There_are_some_problems_with_the_filters": "There are some problems with the filters.",
148
149
  "Please_complete_the_chart_configuration_first": "Please complete the chart configuration first",
149
150
  "Not_used": "Not used",
@@ -144,6 +144,7 @@ const zh_CN = {
144
144
  "Internal_server_error": "服务端错误",
145
145
  "Network_error": "网络错误",
146
146
  "Permission_denied": "权限错误",
147
+ "Execution_time_of_the_query_exceeds_the_limit": "查询的执行时间超出限制。无法加载数据。",
147
148
  "There_are_some_problems_with_the_filters": "过滤器有一些问题。",
148
149
  "Please_complete_the_chart_configuration_first": "请先完成图表配置",
149
150
  "Not_used": "不使用",
@@ -21,12 +21,12 @@ class Trend extends BaseModel {
21
21
  this.summary_column_key = options.y_axis_summary_column_key;
22
22
  this.summary_method = options.y_axis_summary_method;
23
23
  this.num_font_size = options.num_font_size || 34;
24
- this.num_font_color = options.num_font_color || '#212529';
24
+ this.num_font_color = options.num_font_color;
25
25
  this.num_text_align = options.num_text_align || HORIZONTAL_ALIGN.LEFT;
26
26
  this.num_font_weight = options.num_font_weight || 700;
27
27
  this.label = options.label || '';
28
28
  this.card_label_font_size = options.card_label_font_size || 14;
29
- this.label_font_color = options.label_font_color || '#999999';
29
+ this.label_font_color = options.label_font_color;
30
30
  this.label_text_align = options.label_text_align || HORIZONTAL_ALIGN.LEFT;
31
31
  this.label_font_weight = options.label_font_weight || 400;
32
32
  }
@@ -11,7 +11,7 @@ import { X_LABEL_POSITIONS, Y_LABEL_POSITIONS, LABEL_POSITION_TYPE_SHOW, SUPPORT
11
11
  import intl from '../../intl';
12
12
  import SelectLineType from '../widgets/select-line-type';
13
13
  import ColorSelector from '../../components/chart-color-selector/color-selector';
14
- import { STACK_AND_PIE_CHART_THEMES_OPTIONS } from '../../constants/color-rules';
14
+ import { SUPPORT_SINGLE_SELECT_THEMES_OPTIONS } from '../../constants/color-rules';
15
15
  import { getColumnByKey } from '../../utils';
16
16
  const StyleSettings = _ref => {
17
17
  let {
@@ -45,7 +45,7 @@ const StyleSettings = _ref => {
45
45
  const table = tables.find(table => table._id === table_id);
46
46
  const column = getColumnByKey(column_groupby_column_key, table.columns);
47
47
  const isGroupBySingleSelectColumn = (column === null || column === void 0 ? void 0 : column.type) === CellType.SINGLE_SELECT;
48
- const defaultColorTheme = STACK_AND_PIE_CHART_THEMES_OPTIONS.DEFAULT;
48
+ const defaultColorTheme = SUPPORT_SINGLE_SELECT_THEMES_OPTIONS.DEFAULT;
49
49
  const [currYaxisTitle, setCurrYaxisTitle] = useState(title_name || '');
50
50
  const xAxisLabelOptions = useMemo(() => {
51
51
  if (xLabel === 'Vertical_axis') {
@@ -1,13 +1,18 @@
1
1
  import _CollapsibleSettingLayout from "dtable-ui-component/lib/CollapsibleSettingLayout";
2
- import React from 'react';
2
+ import React, { useContext } from 'react';
3
3
  import intl from '../../intl';
4
4
  import Divider from '../widgets/divider';
5
5
  import GeneralFontSetting from '../../components/font-settings';
6
+ import { GlobalThemeContext } from '../../utils/contexts';
7
+ import { DEFAULT_CARD_LABEL_FONT_COLOR_LIGHT, DEFAULT_CHART_TITLE_FONT_COLOR_LIGHT, LABEL_FONT_COLOR_MAP, TITLE_FONT_COLOR_MAP } from '../../constants';
6
8
  export default function StyleSettings(_ref) {
7
9
  let {
8
10
  chart,
9
11
  onChange
10
12
  } = _ref;
13
+ const {
14
+ globalTheme
15
+ } = useContext(GlobalThemeContext);
11
16
  const {
12
17
  config
13
18
  } = chart;
@@ -30,7 +35,7 @@ export default function StyleSettings(_ref) {
30
35
  };
31
36
  const defaultNumConfig = {
32
37
  font_size: 34,
33
- font_color: '#212529',
38
+ font_color: TITLE_FONT_COLOR_MAP[globalTheme] || DEFAULT_CHART_TITLE_FONT_COLOR_LIGHT,
34
39
  text_align: 'left',
35
40
  font_weight: 700
36
41
  };
@@ -43,7 +48,7 @@ export default function StyleSettings(_ref) {
43
48
  };
44
49
  const defaultLabelConfig = {
45
50
  font_size: 14,
46
- font_color: '#999999',
51
+ font_color: LABEL_FONT_COLOR_MAP[globalTheme] || DEFAULT_CARD_LABEL_FONT_COLOR_LIGHT,
47
52
  text_align: 'left',
48
53
  font_weight: 400
49
54
  };
@@ -57,7 +57,9 @@ export function CompletenessStyleSettings(_ref) {
57
57
  modifyFontSize: value => onChange({
58
58
  label_font_size: value
59
59
  })
60
- }), /*#__PURE__*/React.createElement(_DTableSwitch, {
60
+ })), /*#__PURE__*/React.createElement(FormGroup, {
61
+ className: "sea-chart-parameter-item"
62
+ }, /*#__PURE__*/React.createElement(_DTableSwitch, {
61
63
  checked: y_axis_auto_range,
62
64
  placeholder: intl.get('Auto_range'),
63
65
  onChange: handleSetRangeChange
@@ -2,7 +2,7 @@ import React, { useCallback, useMemo, useState, useEffect } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import classnames from 'classnames';
4
4
  import intl from '../intl';
5
- import { settingsContext, DepartmentsContext } from '../utils/contexts';
5
+ import { settingsContext, DepartmentsContext, GlobalThemeContext } from '../utils/contexts';
6
6
  import { eventStopPropagation } from '../utils';
7
7
  import { BaseUtils } from '../utils';
8
8
  import { CHART_SETTINGS_TYPE, CHART_SETTINGS } from '../constants';
@@ -19,7 +19,8 @@ const Settings = _ref => {
19
19
  tables,
20
20
  onChange,
21
21
  children,
22
- departments
22
+ departments,
23
+ globalTheme
23
24
  } = _ref;
24
25
  const [type, setType] = useState(CHART_SETTINGS_TYPE.DATA);
25
26
  const [labelColorConfigs, setLabelColorConfigs] = useState([]);
@@ -61,7 +62,11 @@ const Settings = _ref => {
61
62
  const validTitle = useMemo(() => {
62
63
  return title || {};
63
64
  }, [title]);
64
- return /*#__PURE__*/React.createElement(settingsContext.Provider, {
65
+ return /*#__PURE__*/React.createElement(GlobalThemeContext.Provider, {
66
+ value: {
67
+ globalTheme
68
+ }
69
+ }, /*#__PURE__*/React.createElement(settingsContext.Provider, {
65
70
  value: {
66
71
  hideTitleStyleSetting
67
72
  }
@@ -98,7 +103,7 @@ const Settings = _ref => {
98
103
  tables: tables,
99
104
  labelColorConfigs: labelColorConfigs,
100
105
  onChange: modifyStyle
101
- }), children && type === CHART_SETTINGS_TYPE.GENERAL_STYLE && /*#__PURE__*/React.createElement(React.Fragment, null, children)))));
106
+ }), children && type === CHART_SETTINGS_TYPE.GENERAL_STYLE && /*#__PURE__*/React.createElement(React.Fragment, null, children))))));
102
107
  };
103
108
  const settingsDefaultProps = {
104
109
  dataSources: 'filter'
@@ -10,7 +10,7 @@ import { FontSizeSettings } from '../widgets/font-settings';
10
10
  import { eventStopPropagation, getColumnByKey } from '../../utils';
11
11
  import { CHART_LABEL_POSITIONS, CHART_LABEL_POSITION_SHOW, CHART_LABEL_FORMATS, CHART_LABEL_FORMAT_SHOW } from '../../constants';
12
12
  import intl from '../../intl';
13
- import { STACK_AND_PIE_CHART_THEMES_OPTIONS } from '../../constants/color-rules';
13
+ import { SUPPORT_SINGLE_SELECT_THEMES_OPTIONS } from '../../constants/color-rules';
14
14
  import ColorSelector from '../../components/chart-color-selector/color-selector';
15
15
  const StyleSettings = _ref => {
16
16
  let {
@@ -115,7 +115,7 @@ const StyleSettings = _ref => {
115
115
  const table = tables.find(table => table._id === table_id);
116
116
  const column = getColumnByKey(groupby_column_key, table.columns);
117
117
  const isGroupBySingleSelectColumn = (column === null || column === void 0 ? void 0 : column.type) === CellType.SINGLE_SELECT;
118
- const defaultColorTheme = STACK_AND_PIE_CHART_THEMES_OPTIONS.DEFAULT;
118
+ const defaultColorTheme = SUPPORT_SINGLE_SELECT_THEMES_OPTIONS.DEFAULT;
119
119
  const selectedLabelOption = labelPositionOptions.find(item => item.value === label_position);
120
120
  const selectedLabelFormat = labelFormatOptions.find(item => item.value === label_format) || labelFormatOptions[0];
121
121
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormGroup, {
@@ -1,13 +1,18 @@
1
1
  import _CollapsibleSettingLayout from "dtable-ui-component/lib/CollapsibleSettingLayout";
2
- import React from 'react';
2
+ import React, { useContext } from 'react';
3
3
  import intl from '../../intl';
4
4
  import Divider from '../widgets/divider';
5
5
  import GeneralFontSetting from '../../components/font-settings';
6
+ import { GlobalThemeContext } from '../../utils/contexts';
7
+ import { DEFAULT_CARD_LABEL_FONT_COLOR_LIGHT, DEFAULT_CHART_TITLE_FONT_COLOR_LIGHT, LABEL_FONT_COLOR_MAP, TITLE_FONT_COLOR_MAP } from '../../constants';
6
8
  export default function StyleSettings(_ref) {
7
9
  let {
8
10
  chart,
9
11
  onChange
10
12
  } = _ref;
13
+ const {
14
+ globalTheme
15
+ } = useContext(GlobalThemeContext);
11
16
  const {
12
17
  config
13
18
  } = chart;
@@ -29,7 +34,7 @@ export default function StyleSettings(_ref) {
29
34
  };
30
35
  const defaultNumConfig = {
31
36
  font_size: 34,
32
- font_color: '#212529',
37
+ font_color: TITLE_FONT_COLOR_MAP[globalTheme] || DEFAULT_CHART_TITLE_FONT_COLOR_LIGHT,
33
38
  text_align: 'left',
34
39
  font_weight: 700
35
40
  };
@@ -41,7 +46,7 @@ export default function StyleSettings(_ref) {
41
46
  };
42
47
  const defaultLabelConfig = {
43
48
  font_size: 14,
44
- font_color: '#999999',
49
+ font_color: LABEL_FONT_COLOR_MAP[globalTheme] || DEFAULT_CARD_LABEL_FONT_COLOR_LIGHT,
45
50
  text_align: 'left',
46
51
  font_weight: 400
47
52
  };
@@ -56,9 +56,12 @@ class ColorUseTypeSelector extends Component {
56
56
  {
57
57
  return [TYPE_COLOR_USING.USE_DEFAULT, TYPE_COLOR_USING.USE_COLUMN_COLORS];
58
58
  }
59
- case CHART_TYPE.BAR:
60
59
  case CHART_TYPE.AREA:
61
60
  case CHART_TYPE.LINE:
61
+ {
62
+ return [TYPE_COLOR_USING.USE_DEFAULT, TYPE_COLOR_USING.USE_SPECIFIC_COLORS];
63
+ }
64
+ case CHART_TYPE.BAR:
62
65
  case CHART_TYPE.HORIZONTAL_BAR:
63
66
  {
64
67
  return [TYPE_COLOR_USING.USE_DEFAULT, TYPE_COLOR_USING.USE_SPECIFIC_COLORS, TYPE_COLOR_USING.USE_RULES];
@@ -164,9 +167,14 @@ class ColorUseTypeSelector extends Component {
164
167
  color_option
165
168
  };
166
169
  if (color_option === TYPE_COLOR_USING.USE_SPECIFIC_COLORS) {
170
+ this.setState({
171
+ specificColor: updatedChart.y_axis_label_color || labelColorConfigs[0].color
172
+ });
167
173
  switch (chart.type) {
168
174
  case CHART_TYPE.HORIZONTAL_BAR:
169
175
  case CHART_TYPE.BAR:
176
+ case CHART_TYPE.LINE:
177
+ case CHART_TYPE.AREA:
170
178
  {
171
179
  updatedChart.y_axis_label_color = updatedChart.y_axis_label_color || labelColorConfigs[0].color;
172
180
  break;
@@ -140,7 +140,7 @@ class TimePicker extends Component {
140
140
  onClickRightPanelTime: this.onClickRightPanelTime
141
141
  });
142
142
  return /*#__PURE__*/React.createElement("div", {
143
- className: "date-picker-container",
143
+ className: "sea-chart-date-picker-container",
144
144
  ref: ref => this.datePicker = ref
145
145
  }, /*#__PURE__*/React.createElement(DatePicker, {
146
146
  calendar: calendar,
@@ -1,16 +1,19 @@
1
1
  import _CollapsibleSettingLayout from "dtable-ui-component/lib/CollapsibleSettingLayout";
2
2
  import React, { useMemo, useContext } from 'react';
3
3
  import { Label } from 'reactstrap';
4
- import { settingsContext } from '../../../utils/contexts';
4
+ import { GlobalThemeContext, settingsContext } from '../../../utils/contexts';
5
5
  import { FontSizeSettings, FontWeightSettings, FontColorSettings } from '../font-settings';
6
6
  import TextHorizontalSettings from '../text-horizontal-settings';
7
- import { DEFAULT_CHART_FONT_WEIGHT, DEFAULT_CHART_TITLE_FONT_SIZE, CHART_SUPPORT_FONT_WEIGHTS, HORIZONTAL_ALIGN, DEFAULT_CHART_TITLE_FONT_COLOR, DEFAULT_TREND_CHART_TITLE_FONT_SIZE, CHART_TYPE } from '../../../constants';
7
+ import { DEFAULT_CHART_FONT_WEIGHT, DEFAULT_CHART_TITLE_FONT_SIZE, CHART_SUPPORT_FONT_WEIGHTS, HORIZONTAL_ALIGN, DEFAULT_TREND_CHART_TITLE_FONT_SIZE, CHART_TYPE, TITLE_FONT_COLOR_MAP, DEFAULT_CHART_TITLE_FONT_COLOR_LIGHT } from '../../../constants';
8
8
  import intl from '../../../intl';
9
9
  import TitleText from './title-text';
10
10
  const TitleSetting = props => {
11
11
  const {
12
12
  hideTitleStyleSetting
13
13
  } = useContext(settingsContext);
14
+ const {
15
+ globalTheme
16
+ } = useContext(GlobalThemeContext);
14
17
  const initialTitle = useMemo(() => {
15
18
  return props.title || {};
16
19
  }, [props.title]);
@@ -76,7 +79,7 @@ const TitleSetting = props => {
76
79
  }), /*#__PURE__*/React.createElement(FontColorSettings, {
77
80
  className: 'mt-3',
78
81
  fontColor: initialTitle.font_color,
79
- defaultFontColor: DEFAULT_CHART_TITLE_FONT_COLOR,
82
+ defaultFontColor: TITLE_FONT_COLOR_MAP[globalTheme] || DEFAULT_CHART_TITLE_FONT_COLOR_LIGHT,
80
83
  modifyFontColor: modifyFontColor
81
84
  }), /*#__PURE__*/React.createElement(TextHorizontalSettings, {
82
85
  className: 'mt-3',
@@ -1,3 +1,4 @@
1
1
  import React from 'react';
2
2
  export const settingsContext = React.createContext('');
3
- export const DepartmentsContext = React.createContext([]);
3
+ export const DepartmentsContext = React.createContext([]);
4
+ export const GlobalThemeContext = React.createContext({});
@@ -1,5 +1,6 @@
1
1
  import { GENERIC_KEY_2_SIMILAR_KEYS, GEOLOCATION_GRANULARITY, MAP_LEVEL, MUNICIPALITIES, regions } from '../constants';
2
2
  import intl from '../intl';
3
+ import { SERVER_ERROR_DISPLAY_KEY, SERVER_ERROR_MSG } from '../constants/error';
3
4
  import ObjectUtils from './object-utils';
4
5
  import { BaseUtils, ChartUtils } from './chart-utils';
5
6
  import { ChartDataSQL, chartColumn2SqlColumn, summaryMethodColumn2SqlColumn } from './sql';
@@ -44,8 +45,14 @@ export const getErrorMessage = err => {
44
45
  }
45
46
  const {
46
47
  status,
47
- error_msg
48
+ data
48
49
  } = err.response;
50
+ const error_msg = data ? data.error_msg : '';
51
+ if (status === 400) {
52
+ if (error_msg === SERVER_ERROR_MSG.EXECUTION_COST_EXCEEDED) {
53
+ return intl.get(SERVER_ERROR_DISPLAY_KEY[SERVER_ERROR_MSG.EXECUTION_COST_EXCEEDED]);
54
+ }
55
+ }
49
56
  if (status === 403) {
50
57
  return intl.get('Permission_denied');
51
58
  }
@@ -60,6 +60,11 @@
60
60
  padding: 20px;
61
61
  }
62
62
 
63
+ .sea-chart-formatter .sea-chart-trend-formatter-container.big_screen_plugin,
64
+ .sea-chart-formatter .sea-chart-basic_number_card-formatter-container.big_screen_plugin {
65
+ padding-bottom: 0;
66
+ }
67
+
63
68
  .sea-chart-formatter .sea-chart-container.show-x-axis-label,
64
69
  .sea-chart-formatter .sea-chart-container.show-horizontal-axis-label {
65
70
  padding-bottom: 20px;