sea-chart 0.0.59 → 0.0.60

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 CHANGED
@@ -28,6 +28,8 @@
28
28
 
29
29
  **注意**:自定义API 的demo,目前不支持修改参数同步更新视图
30
30
 
31
+ **注意**:默认 webpack-dev-server 会打开 127.0.0.1:9001 并出错,需要手动改成 127.0.0.1:9000 才能正常访问
32
+
31
33
  ## 使用
32
34
  1. 安装 sea-chart
33
35
  ```
@@ -17,14 +17,13 @@ const DataSettings = _ref => {
17
17
  xLabel,
18
18
  yLabel
19
19
  } = _ref;
20
- const onXAxisColumnChange = useCallback(option => {
20
+ const onXAxisColumnChange = useCallback(column => {
21
21
  const {
22
22
  config
23
23
  } = chart;
24
24
  const {
25
25
  x_axis_column_key
26
26
  } = config;
27
- const column = option.value;
28
27
  const {
29
28
  key: newXAxisColumnKey,
30
29
  type
@@ -18,14 +18,13 @@ const DataSettings = _ref => {
18
18
  yLabel,
19
19
  onChange
20
20
  } = _ref;
21
- const onXAxisColumnChange = useCallback(option => {
21
+ const onXAxisColumnChange = useCallback(column => {
22
22
  const {
23
23
  config
24
24
  } = chart;
25
25
  const {
26
26
  x_axis_column_key
27
27
  } = config;
28
- const column = option.value;
29
28
  const {
30
29
  key: newXAxisColumnKey,
31
30
  type
@@ -16,14 +16,13 @@ const DataSettings = _ref => {
16
16
  xLabel,
17
17
  onChange
18
18
  } = _ref;
19
- const onXAxisColumnChange = useCallback(option => {
19
+ const onXAxisColumnChange = useCallback(column => {
20
20
  const {
21
21
  config
22
22
  } = chart;
23
23
  const {
24
24
  x_axis_column_key
25
25
  } = config;
26
- const column = option.value;
27
26
  const {
28
27
  key: newXAxisColumnKey,
29
28
  type
@@ -1,12 +1,11 @@
1
1
  import { CellType, DATE_COLUMN_OPTIONS } from 'dtable-utils';
2
2
  import { CHART_SUMMARY_TYPE, GEOLOCATION_FORMAT_CITY, GEOLOCATION_FORMAT_MAP } from '../../../constants';
3
3
  import { eventStopPropagation } from '../../../utils';
4
- const getNewUpdate = (option, chart, fieldKey) => {
4
+ const getNewUpdate = (column, chart, fieldKey) => {
5
5
  const {
6
6
  config
7
7
  } = chart;
8
8
  const fieldValue = config[fieldKey];
9
- const column = option.value;
10
9
  const {
11
10
  key
12
11
  } = column;
@@ -16,17 +15,16 @@ const getNewUpdate = (option, chart, fieldKey) => {
16
15
  };
17
16
  return update;
18
17
  };
19
- export const onGroupbyColumnChange = (option, chart, onChange) => {
20
- const update = getNewUpdate(option, chart, 'groupby_column_key');
18
+ export const onGroupbyColumnChange = (column, chart, onChange) => {
19
+ const update = getNewUpdate(column, chart, 'groupby_column_key');
21
20
  if (!update) return;
22
21
  onChange && onChange(update);
23
22
  };
24
23
 
25
24
  // select at bottom of the setting panel
26
- export const onColumnGroupByColumnChange = (option, chart, onChange) => {
27
- const column = option.value;
25
+ export const onColumnGroupByColumnChange = (column, chart, onChange) => {
28
26
  const type = column.type;
29
- const update = getNewUpdate(option, chart, 'column_groupby_column_key');
27
+ const update = getNewUpdate(column, chart, 'column_groupby_column_key');
30
28
  if (!update) return;
31
29
  if (!update['column_groupby_column_key']) {
32
30
  update['date_granularity'] = null;
@@ -36,7 +36,7 @@ export default function CompletenessDataSettings(_ref) {
36
36
  label: intl.get('Name_field'),
37
37
  selectedTableId: table_id,
38
38
  selectedColumnKey: x_axis_column_key,
39
- onGroupByChange: e => onGroupbyColumnChange(e, chart, onChange)
39
+ onGroupByChange: column => onGroupbyColumnChange(column, chart, onChange)
40
40
  }), /*#__PURE__*/React.createElement(Switch, {
41
41
  key: "x_axis_include_empty_cells",
42
42
  checked: x_axis_include_empty_cells,
@@ -53,7 +53,7 @@ export default function CompletenessDataSettings(_ref) {
53
53
  label: intl.get('Group_by'),
54
54
  selectedTableId: table_id,
55
55
  selectedColumnKey: column_groupby_column_key,
56
- onGroupByChange: e => onColumnGroupByColumnChange(e, chart, onChange),
56
+ onGroupByChange: column => onColumnGroupByColumnChange(column, chart, onChange),
57
57
  selectedDateGranularity: date_granularity,
58
58
  selectedGeolocationGranularity: geolocation_granularity,
59
59
  onGroupbyDateGranularityChange: e => onGroupbyDateGranularityChange(e, chart, onChange),
@@ -13,14 +13,13 @@ const DataSettings = _ref => {
13
13
  tables,
14
14
  onChange
15
15
  } = _ref;
16
- const onXAxisColumnChange = useCallback(option => {
16
+ const onXAxisColumnChange = useCallback(column => {
17
17
  const {
18
18
  config
19
19
  } = chart;
20
20
  const {
21
21
  time_column_key
22
22
  } = config;
23
- const column = option.value;
24
23
  const {
25
24
  key: newXAxisColumnKey
26
25
  } = column;
@@ -14,14 +14,13 @@ const DataSettings = _ref => {
14
14
  tables,
15
15
  onChange
16
16
  } = _ref;
17
- const onXAxisColumnChange = useCallback(option => {
17
+ const onXAxisColumnChange = useCallback(column => {
18
18
  const {
19
19
  config
20
20
  } = chart;
21
21
  const {
22
22
  column_key
23
23
  } = config;
24
- const column = option.value;
25
24
  const {
26
25
  key: newXAxisColumnKey
27
26
  } = column;
@@ -32,14 +31,13 @@ const DataSettings = _ref => {
32
31
  };
33
32
  onChange && onChange(update);
34
33
  }, [chart, onChange]);
35
- const onYAxisColumnChange = useCallback(option => {
34
+ const onYAxisColumnChange = useCallback(column => {
36
35
  const {
37
36
  config
38
37
  } = chart;
39
38
  const {
40
39
  group_column_key
41
40
  } = config;
42
- const column = option.value;
43
41
  const {
44
42
  key: newXAxisColumnKey
45
43
  } = column;
@@ -16,14 +16,13 @@ const DataSettings = _ref => {
16
16
  tables,
17
17
  onChange
18
18
  } = _ref;
19
- const onGroupByChange = useCallback(option => {
19
+ const onGroupByChange = useCallback(column => {
20
20
  const {
21
21
  config
22
22
  } = chart;
23
23
  const {
24
24
  groupby_column_key
25
25
  } = config;
26
- const column = option.value;
27
26
  const {
28
27
  key: newColumnKey,
29
28
  type
@@ -25,12 +25,11 @@ export default function ScatterDataSettings(_ref) {
25
25
  date_granularity,
26
26
  geolocation_granularity
27
27
  } = config;
28
- const getNewUpdate = (option, fieldKey) => {
28
+ const getNewUpdate = (column, fieldKey) => {
29
29
  const {
30
30
  config
31
31
  } = chart;
32
32
  const fieldValue = config[fieldKey];
33
- const column = option.value;
34
33
  const {
35
34
  key
36
35
  } = column;
@@ -41,12 +40,12 @@ export default function ScatterDataSettings(_ref) {
41
40
  return update;
42
41
  };
43
42
  const onXAxisColumnChange = e => {
44
- const update = getNewUpdate(e, 'x_axis_column_key');
43
+ const update = getNewUpdate(column, 'x_axis_column_key');
45
44
  if (!update) return;
46
45
  onChange && onChange(update);
47
46
  };
48
47
  const onYAxisColumnChange = e => {
49
- const update = getNewUpdate(e, 'y_axis_column_key');
48
+ const update = getNewUpdate(column, 'y_axis_column_key');
50
49
  if (!update) return;
51
50
  onChange && onChange(update);
52
51
  };
@@ -57,7 +56,7 @@ export default function ScatterDataSettings(_ref) {
57
56
  });
58
57
  };
59
58
  const onColumnGroupbyColumnChange = e => {
60
- const update = getNewUpdate(e, 'column_groupby_column_key');
59
+ const update = getNewUpdate(column, 'column_groupby_column_key');
61
60
  if (!update) return;
62
61
  if (!update['column_groupby_column_key']) {
63
62
  update['date_granularity'] = null;
@@ -71,14 +71,13 @@ const DataSettings = _ref => {
71
71
  }];
72
72
  return options;
73
73
  }, []);
74
- const onGroupByColumnChange = useCallback(option => {
74
+ const onGroupByColumnChange = useCallback(column => {
75
75
  const {
76
76
  config
77
77
  } = chart;
78
78
  const {
79
79
  groupby_column_key
80
80
  } = config;
81
- const column = option.value;
82
81
  const {
83
82
  key: newColumnKey,
84
83
  type
@@ -139,14 +138,13 @@ const DataSettings = _ref => {
139
138
  groupby_geolocation_granularity: value
140
139
  });
141
140
  }, [chart, onChange]);
142
- const onColumnGroupByColumnChange = useCallback(option => {
141
+ const onColumnGroupByColumnChange = useCallback(column => {
143
142
  const {
144
143
  config
145
144
  } = chart;
146
145
  const {
147
146
  column_groupby_column_key
148
147
  } = config;
149
- const column = option.value;
150
148
  const {
151
149
  key: newColumnKey,
152
150
  type
@@ -18,14 +18,13 @@ const DataSettings = _ref => {
18
18
  tables,
19
19
  onChange
20
20
  } = _ref;
21
- const onXAxisColumnChange = useCallback(option => {
21
+ const onXAxisColumnChange = useCallback(column => {
22
22
  const {
23
23
  config
24
24
  } = chart;
25
25
  const {
26
26
  x_axis_column_key
27
27
  } = config;
28
- const column = option.value;
29
28
  const {
30
29
  key: newXAxisColumnKey,
31
30
  type
@@ -35,14 +35,13 @@ const DataSettings = _ref => {
35
35
  };
36
36
  });
37
37
  }, []);
38
- const onXAxisColumnChange = useCallback(option => {
38
+ const onXAxisColumnChange = useCallback(column => {
39
39
  const {
40
40
  config
41
41
  } = chart;
42
42
  const {
43
43
  date_column_key
44
44
  } = config;
45
- const column = option.value;
46
45
  const {
47
46
  key: newXAxisColumnKey
48
47
  } = column;
@@ -1,4 +1,5 @@
1
1
  import _DTableSelect from "dtable-ui-component/lib/DTableSelect";
2
+ import _DTableCustomizeSelect from "dtable-ui-component/lib/DTableCustomizeSelect";
2
3
  import React, { Component } from 'react';
3
4
  import classnames from 'classnames';
4
5
  import { Label, FormGroup } from 'reactstrap';
@@ -89,11 +90,11 @@ class GroupBy extends Component {
89
90
  return {
90
91
  value: column,
91
92
  label: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
92
- className: "sea-chart-column-icon"
93
+ className: "header-icon"
93
94
  }, /*#__PURE__*/React.createElement("i", {
94
95
  className: COLUMNS_ICON_CONFIG[column.type]
95
96
  })), /*#__PURE__*/React.createElement("span", {
96
- className: 'select-module select-module-name ml-0'
97
+ className: 'select-option-name'
97
98
  }, column.name))
98
99
  };
99
100
  });
@@ -124,16 +125,15 @@ class GroupBy extends Component {
124
125
  const options = this.columnOptions.find(option => option.value.key === selectedColumnKey);
125
126
  selectedOption = options ? options : null;
126
127
  }
127
- return /*#__PURE__*/React.createElement(_DTableSelect, {
128
- menuPortalTarget: "#sea-chart-settings-content",
128
+ return /*#__PURE__*/React.createElement(_DTableCustomizeSelect, {
129
+ isLocked: false,
129
130
  value: selectedOption,
130
- classNamePrefix: "select-column",
131
131
  options: this.columnOptions,
132
- onChange: this.props.onGroupByChange,
133
- placeholder: intl.get('Select_field'),
134
- noOptionsMessage: () => {
135
- return /*#__PURE__*/React.createElement("span", null, intl.get('No_column'));
136
- }
132
+ onSelectOption: this.props.onGroupByChange,
133
+ isInModal: true,
134
+ searchable: true,
135
+ searchPlaceholder: intl.get('Select_field'),
136
+ noOptionsPlaceholder: intl.get('No_column')
137
137
  });
138
138
  };
139
139
  this.renderGroupbyDateGranulates = () => {
@@ -278,8 +278,7 @@ class YAxisGroupSettings extends Component {
278
278
  summary_columns: [...summary_columns]
279
279
  });
280
280
  };
281
- this.onGroupByChange = option => {
282
- const column = option.value;
281
+ this.onGroupByChange = column => {
283
282
  const {
284
283
  chart
285
284
  } = this.props;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sea-chart",
3
- "version": "0.0.59",
3
+ "version": "0.0.60",
4
4
  "main": "./dist/index.js",
5
5
  "dependencies": {
6
6
  "@antv/data-set": "0.11.8",