sea-chart 0.0.60 → 0.0.61

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.
@@ -1,11 +1,15 @@
1
1
  import React from 'react';
2
2
  import View, { defaultProps, propTypes } from '../view';
3
3
  import Settings from '../settings';
4
+ import { settingsDefaultProps, settingsPropTypes } from '../settings';
4
5
  import './index.css';
5
6
  function Editor(props) {
6
7
  return /*#__PURE__*/React.createElement("div", {
7
8
  className: "sea-chart-editor"
8
9
  }, /*#__PURE__*/React.createElement(View, props), /*#__PURE__*/React.createElement(Settings, props, props.children));
9
10
  }
10
- Editor.defaultProps = defaultProps;
11
+ Editor.defaultProps = {
12
+ ...defaultProps,
13
+ ...settingsDefaultProps
14
+ };
11
15
  export default Editor;
@@ -1,12 +1,11 @@
1
+ import _DTableSwitch from "dtable-ui-component/lib/DTableSwitch";
1
2
  import React, { useCallback } from 'react';
2
3
  import { CellType, DATE_COLUMN_OPTIONS } from 'dtable-utils';
3
4
  import CommonDataSettings from '../widgets/common-data-settings';
4
5
  import Divider from '../widgets/divider';
5
6
  import GroupBy from '../widgets/group-by';
6
- import Switch from '../widgets/switch';
7
7
  import YAxisGroupSettings from '../widgets/y-axis-group-settings';
8
8
  import { CHART_SUMMARY_TYPE, GEOLOCATION_FORMAT_CITY, GEOLOCATION_FORMAT_MAP } from '../../constants';
9
- import { eventStopPropagation } from '../../utils';
10
9
  import intl from '../../intl';
11
10
  const DataSettings = _ref => {
12
11
  let {
@@ -85,7 +84,6 @@ const DataSettings = _ref => {
85
84
  });
86
85
  }, [chart, onChange]);
87
86
  const onIncludeEmptyChange = useCallback(event => {
88
- eventStopPropagation(event);
89
87
  const {
90
88
  config
91
89
  } = chart;
@@ -122,8 +120,7 @@ const DataSettings = _ref => {
122
120
  onGroupByChange: onXAxisColumnChange,
123
121
  onGroupbyDateGranularityChange: onGroupbyDateGranularityChange,
124
122
  onGroupbyGeolocationGranularityChange: onGroupbyGeolocationGranularityChange
125
- }), /*#__PURE__*/React.createElement(Switch, {
126
- key: "x_axis_include_empty_cells",
123
+ }), /*#__PURE__*/React.createElement(_DTableSwitch, {
127
124
  checked: x_axis_include_empty_cells,
128
125
  placeholder: intl.get('Include_empty'),
129
126
  onChange: onIncludeEmptyChange
@@ -1,13 +1,12 @@
1
+ import _DTableSwitch from "dtable-ui-component/lib/DTableSwitch";
1
2
  import React, { useCallback } from 'react';
2
3
  import { CellType, DATE_COLUMN_OPTIONS } from 'dtable-utils';
3
4
  import intl from '../../intl';
4
5
  import CommonDataSettings from '../widgets/common-data-settings';
5
6
  import Divider from '../widgets/divider';
6
7
  import GroupBy from '../widgets/group-by';
7
- import Switch from '../widgets/switch';
8
8
  import BasicSummary from '../widgets/basic-summary';
9
9
  import DataSort from '../widgets/data-sort';
10
- import { eventStopPropagation } from '../../utils';
11
10
  import { CHART_SUMMARY_TYPE, SUPPORT_DATA_SORT_CHART_TYPES, CHART_SUMMARY_TYPES, GEOLOCATION_FORMAT_CITY, GEOLOCATION_FORMAT_MAP, CHART_TYPE } from '../../constants';
12
11
  const DataSettings = _ref => {
13
12
  let {
@@ -86,7 +85,6 @@ const DataSettings = _ref => {
86
85
  });
87
86
  }, [chart, onChange]);
88
87
  const onIncludeEmptyChange = useCallback(event => {
89
- eventStopPropagation(event);
90
88
  const {
91
89
  config
92
90
  } = chart;
@@ -136,8 +134,7 @@ const DataSettings = _ref => {
136
134
  onGroupByChange: onXAxisColumnChange,
137
135
  onGroupbyDateGranularityChange: onGroupbyDateGranularityChange,
138
136
  onGroupbyGeolocationGranularityChange: onGroupbyGeolocationGranularityChange
139
- }), /*#__PURE__*/React.createElement(Switch, {
140
- key: "x_axis_include_empty_cells",
137
+ }), /*#__PURE__*/React.createElement(_DTableSwitch, {
141
138
  checked: x_axis_include_empty_cells,
142
139
  placeholder: intl.get('Include_empty'),
143
140
  onChange: onIncludeEmptyChange
@@ -1,9 +1,9 @@
1
+ import _DTableSwitch from "dtable-ui-component/lib/DTableSwitch";
1
2
  import React, { useCallback } from 'react';
2
3
  import { CellType, DATE_COLUMN_OPTIONS } from 'dtable-utils';
3
4
  import CommonDataSettings from '../widgets/common-data-settings';
4
5
  import Divider from '../widgets/divider';
5
6
  import GroupBy from '../widgets/group-by';
6
- import Switch from '../widgets/switch';
7
7
  import SummarySettings from '../widgets/summary-settings';
8
8
  import { eventStopPropagation } from '../../utils';
9
9
  import { CHART_SUMMARY_TYPE, CHART_Y_GROUP_TYPE, CHART_SUMMARY_CALCULATION_METHOD, GEOLOCATION_FORMAT_CITY, GEOLOCATION_FORMAT_MAP, COMBINATION_POSITION } from '../../constants';
@@ -84,7 +84,6 @@ const DataSettings = _ref => {
84
84
  });
85
85
  }, [chart, onChange]);
86
86
  const onIncludeEmptyChange = useCallback(event => {
87
- eventStopPropagation(event);
88
87
  const {
89
88
  config
90
89
  } = chart;
@@ -238,8 +237,7 @@ const DataSettings = _ref => {
238
237
  onGroupByChange: onXAxisColumnChange,
239
238
  onGroupbyDateGranularityChange: onGroupbyDateGranularityChange,
240
239
  onGroupbyGeolocationGranularityChange: onGroupbyGeolocationGranularityChange
241
- }), /*#__PURE__*/React.createElement(Switch, {
242
- key: "x_axis_include_empty_cells",
240
+ }), /*#__PURE__*/React.createElement(_DTableSwitch, {
243
241
  checked: x_axis_include_empty_cells,
244
242
  placeholder: intl.get('Include_empty'),
245
243
  onChange: onIncludeEmptyChange
@@ -52,7 +52,6 @@ export const onColumnGroupByColumnChange = (column, chart, onChange) => {
52
52
  onChange && onChange(update);
53
53
  };
54
54
  export const onIncludeEmptyChange = (event, chart, onChange) => {
55
- eventStopPropagation(event);
56
55
  const {
57
56
  config
58
57
  } = chart;
@@ -1,8 +1,8 @@
1
+ import _DTableSwitch from "dtable-ui-component/lib/DTableSwitch";
1
2
  import React from 'react';
2
3
  import CommonDataSettings from '../../widgets/common-data-settings';
3
4
  import Divider from '../../widgets/divider';
4
5
  import GroupBy from '../../widgets/group-by';
5
- import Switch from '../../widgets/switch';
6
6
  import intl from '../../../intl';
7
7
  import { onGroupbyColumnChange, onIncludeEmptyChange, onColumnGroupByColumnChange, onGroupbyDateGranularityChange, onGroupbyGeolocationGranularityChange } from '../callbacks/callbacks';
8
8
  import { CHART_TYPE } from '../../../constants';
@@ -37,8 +37,7 @@ export default function CompletenessDataSettings(_ref) {
37
37
  selectedTableId: table_id,
38
38
  selectedColumnKey: x_axis_column_key,
39
39
  onGroupByChange: column => onGroupbyColumnChange(column, chart, onChange)
40
- }), /*#__PURE__*/React.createElement(Switch, {
41
- key: "x_axis_include_empty_cells",
40
+ }), /*#__PURE__*/React.createElement(_DTableSwitch, {
42
41
  checked: x_axis_include_empty_cells,
43
42
  placeholder: intl.get('Include_empty'),
44
43
  onChange: e => onIncludeEmptyChange(e, chart, onChange)
@@ -1,6 +1,6 @@
1
+ import _DTableSwitch from "dtable-ui-component/lib/DTableSwitch";
1
2
  import React from 'react';
2
3
  import { FormGroup, Label } from 'reactstrap';
3
- import Switch from '../widgets/switch';
4
4
  import intl from '../../intl';
5
5
  import { FontSizeSettings } from '../widgets/font-settings';
6
6
  import { PixelEditor } from '../../components';
@@ -44,8 +44,7 @@ export function CompletenessStyleSettings(_ref) {
44
44
  }
45
45
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormGroup, {
46
46
  className: "sea-chart-parameter-item"
47
- }, /*#__PURE__*/React.createElement(Switch, {
48
- key: 'show-percentage',
47
+ }, /*#__PURE__*/React.createElement(_DTableSwitch, {
49
48
  checked: show_percentage,
50
49
  placeholder: intl.get('Show_percentage'),
51
50
  onChange: handleShowPercentageChange
@@ -58,8 +57,7 @@ export function CompletenessStyleSettings(_ref) {
58
57
  modifyFontSize: value => onChange({
59
58
  label_font_size: value
60
59
  })
61
- }), /*#__PURE__*/React.createElement(Switch, {
62
- key: 'set-range-automatic',
60
+ }), /*#__PURE__*/React.createElement(_DTableSwitch, {
63
61
  checked: y_axis_auto_range,
64
62
  placeholder: intl.get('Auto_range'),
65
63
  onChange: handleSetRangeChange
@@ -1,18 +1,21 @@
1
1
  import React, { useCallback, useMemo, useState, useEffect } from 'react';
2
+ import PropTypes from 'prop-types';
2
3
  import classnames from 'classnames';
4
+ import intl from '../intl';
5
+ import { settingsContext } from '../utils/contexts';
3
6
  import { eventStopPropagation } from '../utils';
4
7
  import { BaseUtils } from '../utils';
5
- import intl from '../intl';
6
8
  import { CHART_SETTINGS_TYPE, CHART_SETTINGS } from '../constants';
7
- import StyleSettings from './style-settings';
8
- import DataSettings from './data-settings';
9
9
  import Divider from './widgets/divider';
10
+ import DataSettings from './data-settings';
11
+ import StyleSettings from './style-settings';
10
12
  import './index.css';
11
13
  const Settings = _ref => {
12
14
  let {
13
15
  chart,
14
16
  dataSources,
15
17
  title,
18
+ hideTitleStyleSetting,
16
19
  tables,
17
20
  onChange,
18
21
  children
@@ -57,7 +60,11 @@ const Settings = _ref => {
57
60
  const validTitle = useMemo(() => {
58
61
  return title || {};
59
62
  }, [title]);
60
- return /*#__PURE__*/React.createElement("div", {
63
+ return /*#__PURE__*/React.createElement(settingsContext.Provider, {
64
+ value: {
65
+ hideTitleStyleSetting
66
+ }
67
+ }, /*#__PURE__*/React.createElement("div", {
61
68
  className: "sea-chart-settings"
62
69
  }, /*#__PURE__*/React.createElement("div", {
63
70
  className: "sea-chart-settings-type",
@@ -85,10 +92,20 @@ const Settings = _ref => {
85
92
  chart: chart,
86
93
  labelColorConfigs: labelColorConfigs,
87
94
  onChange: modifyStyle
88
- }), children && type === CHART_SETTINGS_TYPE.GENERAL_STYLE && /*#__PURE__*/React.createElement(React.Fragment, null, children))));
95
+ }), children && type === CHART_SETTINGS_TYPE.GENERAL_STYLE && /*#__PURE__*/React.createElement(React.Fragment, null, children)))));
89
96
  };
90
- Settings.defaultProps = {
97
+ const settingsDefaultProps = {
91
98
  dataSources: 'filter'
92
99
  };
100
+ const settingsPropTypes = {
101
+ chart: PropTypes.object.isRequired,
102
+ tables: PropTypes.array.isRequired,
103
+ dataSources: PropTypes.string,
104
+ title: PropTypes.object,
105
+ hideTitleStyleSetting: PropTypes.bool,
106
+ children: PropTypes.any,
107
+ onChange: PropTypes.func.isRequired
108
+ };
109
+ Settings.defaultProps = settingsDefaultProps;
93
110
  export default Settings;
94
- export { StyleSettings, Divider };
111
+ export { StyleSettings, Divider, settingsDefaultProps, settingsPropTypes };
@@ -1,10 +1,10 @@
1
+ import _DTableSwitch from "dtable-ui-component/lib/DTableSwitch";
1
2
  import React, { useCallback } from 'react';
2
3
  import { CellType } from 'dtable-utils';
3
4
  import intl from '../../intl';
4
5
  import CommonDataSettings from '../widgets/common-data-settings';
5
6
  import Divider from '../widgets/divider';
6
7
  import GroupBy from '../widgets/group-by';
7
- import Switch from '../widgets/switch';
8
8
  import BasicSummary from '../widgets/basic-summary';
9
9
  import { CHART_SUMMARY_TYPES } from '../../constants';
10
10
  const DataSettings = _ref => {
@@ -82,8 +82,7 @@ const DataSettings = _ref => {
82
82
  selectedColumnKey: column_key,
83
83
  isMirror: true,
84
84
  onGroupByChange: onXAxisColumnChange
85
- }), /*#__PURE__*/React.createElement(Switch, {
86
- key: "x_axis_include_empty_cells",
85
+ }), /*#__PURE__*/React.createElement(_DTableSwitch, {
87
86
  checked: is_transpose,
88
87
  placeholder: intl.get('Transpose'),
89
88
  onChange: onTranspose
@@ -1,12 +1,11 @@
1
+ import _DTableSwitch from "dtable-ui-component/lib/DTableSwitch";
1
2
  import React, { useCallback } from 'react';
2
3
  import { CellType, DATE_COLUMN_OPTIONS } from 'dtable-utils';
3
4
  import CommonDataSettings from '../widgets/common-data-settings';
4
5
  import Divider from '../widgets/divider';
5
6
  import GroupBy from '../widgets/group-by';
6
- import Switch from '../widgets/switch';
7
7
  import BasicSummary from '../widgets/basic-summary';
8
8
  import DataSort from '../widgets/data-sort';
9
- import { eventStopPropagation } from '../../utils';
10
9
  import { CHART_SUMMARY_TYPE, GEOLOCATION_FORMAT_CITY, GEOLOCATION_FORMAT_MAP } from '../../constants';
11
10
  import intl from '../../intl';
12
11
  const DataSettings = _ref => {
@@ -84,7 +83,6 @@ const DataSettings = _ref => {
84
83
  });
85
84
  }, [chart, onChange]);
86
85
  const onIncludeEmptyChange = useCallback(event => {
87
- eventStopPropagation(event);
88
86
  const {
89
87
  config
90
88
  } = chart;
@@ -121,8 +119,7 @@ const DataSettings = _ref => {
121
119
  onGroupByChange: onGroupByChange,
122
120
  onGroupbyDateGranularityChange: onGroupbyDateGranularityChange,
123
121
  onGroupbyGeolocationGranularityChange: onGroupbyGeolocationGranularityChange
124
- }), /*#__PURE__*/React.createElement(Switch, {
125
- key: "groupby_include_empty_cells",
122
+ }), /*#__PURE__*/React.createElement(_DTableSwitch, {
126
123
  checked: groupby_include_empty_cells,
127
124
  placeholder: intl.get('Include_empty'),
128
125
  onChange: onIncludeEmptyChange
@@ -3,7 +3,6 @@ import _DTableSelect from "dtable-ui-component/lib/DTableSelect";
3
3
  import _DTableSwitch from "dtable-ui-component/lib/DTableSwitch";
4
4
  import React, { useCallback, useMemo } from 'react';
5
5
  import { Label, FormGroup } from 'reactstrap';
6
- import Switch from '../widgets/switch';
7
6
  import Divider from '../widgets/divider';
8
7
  import MiniNumSlicePercent from '../widgets/mininum-slice-percent';
9
8
  import { FontSizeSettings } from '../widgets/font-settings';
@@ -105,8 +104,7 @@ const StyleSettings = _ref => {
105
104
  const selectedLabelFormat = labelFormatOptions.find(item => item.value === label_format) || labelFormatOptions[0];
106
105
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormGroup, {
107
106
  className: "sea-chart-parameter-item"
108
- }, /*#__PURE__*/React.createElement(Switch, {
109
- key: "show_legend",
107
+ }, /*#__PURE__*/React.createElement(_DTableSwitch, {
110
108
  checked: show_legend || false,
111
109
  placeholder: intl.get('Display_legend'),
112
110
  onChange: onDisplayLegendChange
@@ -1,11 +1,10 @@
1
+ import _DTableSwitch from "dtable-ui-component/lib/DTableSwitch";
1
2
  import React from 'react';
2
3
  import { CellType, DATE_COLUMN_OPTIONS } from 'dtable-utils';
3
4
  import CommonDataSettings from '../widgets/common-data-settings';
4
5
  import Divider from '../widgets/divider';
5
6
  import GroupBy from '../widgets/group-by';
6
- import Switch from '../widgets/switch';
7
7
  import intl from '../../intl';
8
- import { eventStopPropagation } from '../../utils';
9
8
  import { CHART_SUMMARY_TYPE, GEOLOCATION_FORMAT_CITY, GEOLOCATION_FORMAT_MAP } from '../../constants';
10
9
  export default function ScatterDataSettings(_ref) {
11
10
  let {
@@ -50,7 +49,6 @@ export default function ScatterDataSettings(_ref) {
50
49
  onChange && onChange(update);
51
50
  };
52
51
  const onIncludeEmptyChange = e => {
53
- eventStopPropagation(e);
54
52
  onChange && onChange({
55
53
  x_axis_include_empty_cells: !x_axis_include_empty_cells
56
54
  });
@@ -118,8 +116,7 @@ export default function ScatterDataSettings(_ref) {
118
116
  selectedTableId: table_id,
119
117
  selectedColumnKey: x_axis_column_key,
120
118
  onGroupByChange: onXAxisColumnChange
121
- }), /*#__PURE__*/React.createElement(Switch, {
122
- key: "x_axis_include_empty_cells",
119
+ }), /*#__PURE__*/React.createElement(_DTableSwitch, {
123
120
  checked: x_axis_include_empty_cells,
124
121
  placeholder: intl.get('Include_empty'),
125
122
  onChange: onIncludeEmptyChange
@@ -1,15 +1,14 @@
1
- import _DTableSwitch from "dtable-ui-component/lib/DTableSwitch";
2
1
  import _DTableSelect from "dtable-ui-component/lib/DTableSelect";
2
+ import _DTableSwitch from "dtable-ui-component/lib/DTableSwitch";
3
3
  import React, { useCallback, useMemo } from 'react';
4
4
  import { FormGroup, Label } from 'reactstrap';
5
- import { CellType, COLUMNS_ICON_CONFIG, DATE_COLUMN_OPTIONS, getTableById, getTableColumnByKey } from 'dtable-utils';
5
+ import { CellType, COLUMNS_ICON_CONFIG, DATE_COLUMN_OPTIONS, getTableById } from 'dtable-utils';
6
6
  import CommonDataSettings from '../widgets/common-data-settings';
7
7
  import Divider from '../widgets/divider';
8
8
  import GroupBy from '../widgets/group-by';
9
- import Switch from '../widgets/switch';
10
9
  import BasicSummary from '../widgets/basic-summary';
11
10
  import NumericSummaryItem from '../widgets/numeric-summary-item';
12
- import { eventStopPropagation, BaseUtils } from '../../utils';
11
+ import { BaseUtils } from '../../utils';
13
12
  import { CHART_SUMMARY_TYPE, CHART_Y_GROUP_TYPE, CHART_SUMMARY_SHOW, CHART_SUMMARY_CALCULATION_METHOD, CHART_DATE_SUMMARY_CALCULATION_METHOD, GEOLOCATION_FORMAT_CITY, GEOLOCATION_FORMAT_MAP } from '../../constants';
14
13
  import intl from '../../intl';
15
14
  const DataSettings = _ref => {
@@ -207,7 +206,6 @@ const DataSettings = _ref => {
207
206
  });
208
207
  }, [chart, onChange]);
209
208
  const onIncludeEmptyChange = useCallback(event => {
210
- eventStopPropagation(event);
211
209
  const {
212
210
  config
213
211
  } = chart;
@@ -518,8 +516,7 @@ const DataSettings = _ref => {
518
516
  onGroupByChange: onGroupByColumnChange,
519
517
  onGroupbyDateGranularityChange: onGroupbyDateGranularityChange,
520
518
  onGroupbyGeolocationGranularityChange: onGroupbyGeolocationGranularityChange
521
- }), /*#__PURE__*/React.createElement(Switch, {
522
- key: "groupby_include_empty_cells",
519
+ }), /*#__PURE__*/React.createElement(_DTableSwitch, {
523
520
  checked: groupby_include_empty_cells,
524
521
  placeholder: intl.get('Include_empty'),
525
522
  onChange: onIncludeEmptyChange
@@ -1,10 +1,10 @@
1
+ import _DTableSwitch from "dtable-ui-component/lib/DTableSwitch";
1
2
  import React, { useCallback } from 'react';
2
3
  import { FormGroup, Label } from 'reactstrap';
3
4
  import { CellType, DATE_COLUMN_OPTIONS } from 'dtable-utils';
4
5
  import CommonDataSettings from '../widgets/common-data-settings';
5
6
  import Divider from '../widgets/divider';
6
7
  import GroupBy from '../widgets/group-by';
7
- import Switch from '../widgets/switch';
8
8
  import BasicSummary from '../widgets/basic-summary';
9
9
  import TimePicker from '../widgets/time-picker';
10
10
  import { eventStopPropagation } from '../../utils';
@@ -166,7 +166,7 @@ const DataSettings = _ref => {
166
166
  selectedTableId: table_id,
167
167
  tables: tables,
168
168
  onChange: onChange
169
- }), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(Switch, {
169
+ }), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(_DTableSwitch, {
170
170
  checked: display_increase || false,
171
171
  placeholder: intl.get('Display_increase'),
172
172
  onChange: onDisplayIncreaseChange
@@ -3,8 +3,6 @@ import React, { useCallback } from 'react';
3
3
  import { FormGroup } from 'reactstrap';
4
4
  import { FontSizeSettings } from '../font-settings';
5
5
  import intl from '../../../intl';
6
- import { eventStopPropagation } from '../../../utils';
7
- import { X_LABEL_POSITIONS, Y_LABEL_POSITIONS, LABEL_POSITION_TYPE_SHOW } from '../../../constants';
8
6
  import './index.css';
9
7
  const DisplayValuesSettings = _ref => {
10
8
  let {
@@ -1,7 +1,7 @@
1
+ import _DTableSwitch from "dtable-ui-component/lib/DTableSwitch";
1
2
  import React, { Component } from 'react';
2
3
  import { Label, FormGroup } from 'reactstrap';
3
4
  import { getTableById, getTableColumnByKey } from 'dtable-utils';
4
- import Switch from './switch';
5
5
  import { eventStopPropagation } from '../../utils';
6
6
  import intl from '../../intl';
7
7
  class Stack extends Component {
@@ -40,7 +40,7 @@ class Stack extends Component {
40
40
  if (!columnGroupbyColumn) return null;
41
41
  return /*#__PURE__*/React.createElement(FormGroup, {
42
42
  className: "sea-chart-parameter-item"
43
- }, /*#__PURE__*/React.createElement(Label, null, intl.get('Display_mode')), /*#__PURE__*/React.createElement(Switch, {
43
+ }, /*#__PURE__*/React.createElement(Label, null, intl.get('Display_mode')), /*#__PURE__*/React.createElement(_DTableSwitch, {
44
44
  checked: y_axis_use_stack || false,
45
45
  placeholder: intl.get('Stack'),
46
46
  onChange: this.onUseStackChange
@@ -1,11 +1,15 @@
1
1
  import _CollapsibleSettingLayout from "dtable-ui-component/lib/CollapsibleSettingLayout";
2
- import React, { useMemo } from 'react';
2
+ import React, { useMemo, useContext } from 'react';
3
+ import { settingsContext } from '../../../utils/contexts';
3
4
  import { FontSizeSettings, FontWeightSettings, FontColorSettings } from '../font-settings';
4
5
  import TextHorizontalSettings from '../text-horizontal-settings';
5
6
  import { DEFAULT_CHART_FONT_WEIGHT, DEFAULT_CHART_TITLE_FONT_SIZE, CHART_SUPPORT_FONT_WEIGHTS, HORIZONTAL_ALIGN, DEFAULT_CHART_TITLE_FONT_COLOR, DAFAULT_TREND_CHART_TITLE_FONT_SIZE, CHART_TYPE } from '../../../constants';
6
7
  import intl from '../../../intl';
7
8
  import TitleText from './title-text';
8
9
  const TitleSetting = props => {
10
+ const {
11
+ hideTitleStyleSetting
12
+ } = useContext(settingsContext);
9
13
  const initialTitle = useMemo(() => {
10
14
  return props.title || {};
11
15
  }, [props.title]);
@@ -58,7 +62,7 @@ const TitleSetting = props => {
58
62
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TitleText, {
59
63
  text: initialTitle.text,
60
64
  modifyText: modifyText
61
- }), /*#__PURE__*/React.createElement(FontSizeSettings, {
65
+ }), !hideTitleStyleSetting && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FontSizeSettings, {
62
66
  className: 'mt-3',
63
67
  fontSize: initialTitle.font_size,
64
68
  defaultFontSize: isCard ? DAFAULT_TREND_CHART_TITLE_FONT_SIZE : DEFAULT_CHART_TITLE_FONT_SIZE,
@@ -78,7 +82,7 @@ const TitleSetting = props => {
78
82
  value: initialTitle.horizontal_align,
79
83
  defaultValue: HORIZONTAL_ALIGN.LEFT,
80
84
  onChange: modifyHorizontalAlign
81
- }));
85
+ })));
82
86
  };
83
87
  return /*#__PURE__*/React.createElement(_CollapsibleSettingLayout, {
84
88
  title: intl.get('Title'),
@@ -175,7 +175,7 @@ async function calculator(chart, value, _ref) {
175
175
  if (currentValue < targetValue) {
176
176
  result.unshift({
177
177
  name: label,
178
- group_label: groupLabel,
178
+ groupby: groupLabel,
179
179
  value: currentValue,
180
180
  color,
181
181
  type: 'completed',
@@ -184,7 +184,7 @@ async function calculator(chart, value, _ref) {
184
184
  rows
185
185
  }, {
186
186
  name: label,
187
- group_label: groupLabel,
187
+ groupby: groupLabel,
188
188
  value: targetValue - currentValue,
189
189
  color,
190
190
  type: 'uncompleted',
@@ -195,7 +195,7 @@ async function calculator(chart, value, _ref) {
195
195
  } else {
196
196
  result.unshift({
197
197
  name: label,
198
- group_label: groupLabel,
198
+ groupby: groupLabel,
199
199
  value: currentValue,
200
200
  color,
201
201
  type: 'completed',
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export const settingsContext = React.createContext('');
@@ -218,24 +218,29 @@ class View extends React.PureComponent {
218
218
  }
219
219
  }
220
220
  const propTypes = {
221
+ // style
222
+ className: PropTypes.string,
221
223
  canvasStyle: PropTypes.object,
224
+ globalTheme: PropTypes.string,
225
+ // light or dark
226
+ chartColorTheme: PropTypes.string,
227
+ hideTitle: PropTypes.bool,
228
+ render: PropTypes.func,
229
+ // User-defined rendering content
230
+
231
+ // data
222
232
  chart: PropTypes.object.isRequired,
233
+ tables: PropTypes.array.isRequired,
223
234
  api: PropTypes.object.isRequired,
235
+ config: PropTypes.object,
236
+ collaboratorManager: PropTypes.object,
224
237
  collaborators: PropTypes.array,
225
238
  departments: PropTypes.array,
226
239
  dtableStoreValue: PropTypes.object,
227
- tables: PropTypes.array.isRequired,
228
- className: PropTypes.string,
229
- collaboratorManager: PropTypes.object,
230
- hideTitle: PropTypes.bool,
231
- globalTheme: PropTypes.string,
232
- // light or dark
233
- chartColorTheme: PropTypes.string,
240
+ isCalculateByView: PropTypes.bool,
241
+ // event
234
242
  integratedEventTypes: PropTypes.object,
235
243
  integratedEventBus: PropTypes.object,
236
- isCalculateByView: PropTypes.bool,
237
- render: PropTypes.func,
238
- // User-defined rendering content
239
244
  onViewRef: PropTypes.func
240
245
  };
241
246
  const defaultProps = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sea-chart",
3
- "version": "0.0.60",
3
+ "version": "0.0.61",
4
4
  "main": "./dist/index.js",
5
5
  "dependencies": {
6
6
  "@antv/data-set": "0.11.8",