sea-chart 1.1.58 → 1.1.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.
@@ -7,10 +7,6 @@ class ColorPicker extends React.PureComponent {
7
7
  this.onPickColorToggle = () => {
8
8
  this.setState({
9
9
  isShowColorPicker: !this.state.isShowColorPicker
10
- }, () => {
11
- if (this.state.isShowColorPicker) {
12
- this.getPopoverStyle();
13
- }
14
10
  });
15
11
  };
16
12
  this.onInputChanged = event => {
@@ -18,38 +14,8 @@ class ColorPicker extends React.PureComponent {
18
14
  if (value === this.props.activeColor) return;
19
15
  this.props.onColorChanged(value);
20
16
  };
21
- this.getPopoverStyle = () => {
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
38
- };
39
- if (clientHeight - selectTop < colorPickerHeight) {
40
- style = {
41
- ...style,
42
- bottom: '2.375rem'
43
- };
44
- }
45
- this.setState({
46
- popoverStyle: style
47
- });
48
- }, 10);
49
- };
50
17
  this.state = {
51
- isShowColorPicker: false,
52
- popoverStyle: {}
18
+ isShowColorPicker: false
53
19
  };
54
20
  this.colorPickerContainerRef = null;
55
21
  this.colorPickerRef = React.createRef();
@@ -58,9 +24,6 @@ class ColorPicker extends React.PureComponent {
58
24
  const {
59
25
  activeColor
60
26
  } = this.props;
61
- const {
62
- popoverStyle
63
- } = this.state;
64
27
  const isWhiteColor = activeColor && activeColor.toUpperCase() === '#FFFFFF';
65
28
  return /*#__PURE__*/React.createElement("div", {
66
29
  className: "color-picker-container",
@@ -83,7 +46,9 @@ class ColorPicker extends React.PureComponent {
83
46
  color: activeColor,
84
47
  onSubmit: this.props.onColorChanged,
85
48
  onToggle: this.onPickColorToggle,
86
- popoverStyle: popoverStyle
49
+ useProtal: true,
50
+ target: this.colorPickerContainerRef,
51
+ scrollContainerId: "sea-chart-settings-container"
87
52
  }));
88
53
  }
89
54
  }
@@ -95,7 +95,8 @@ const Settings = _ref => {
95
95
  data: setting.type
96
96
  }, name || intl.get(setting.name));
97
97
  })), /*#__PURE__*/React.createElement("div", {
98
- className: "chart-settings-container position-relative"
98
+ className: "chart-settings-container position-relative",
99
+ id: "sea-chart-settings-container"
99
100
  }, /*#__PURE__*/React.createElement("div", {
100
101
  id: "sea-chart-settings-content",
101
102
  className: "chart-settings-content"
@@ -11,7 +11,8 @@ export default function TableElementDataSetting(_ref) {
11
11
  let {
12
12
  tables,
13
13
  chart,
14
- onChange
14
+ onChange,
15
+ dataSources
15
16
  } = _ref;
16
17
  const {
17
18
  config
@@ -78,7 +79,8 @@ export default function TableElementDataSetting(_ref) {
78
79
  }, /*#__PURE__*/React.createElement(StatisticType, {
79
80
  chart: chart,
80
81
  generateChartConfig: generateConfig,
81
- onChange: onTypeChange
82
+ onChange: onTypeChange,
83
+ dataSources: dataSources
82
84
  }), /*#__PURE__*/React.createElement(SelectTable, {
83
85
  tables: tables,
84
86
  selectedTableId: table_id,
@@ -3,51 +3,15 @@ import _DTableColorPicker from "dtable-ui-component/lib/DTableColorPicker";
3
3
  import React, { Component } from 'react';
4
4
  import classnames from 'classnames';
5
5
  import { Input, FormGroup, Label } from 'reactstrap';
6
- import ReactColor from 'react-color';
7
6
  import intl from '../../../intl';
8
7
  import ColorRulesPopover from '../../../components/color-popover/color-rules-popover';
9
8
  import { getValidColorRules } from '../../../utils/color-utils';
10
9
  import { CHART_TYPE, TYPE_COLOR_USING, TYPE_DISPLAY_COLOR_USING } from '../../../constants';
11
10
  import { COLOR_RULE_FILTER_TYPE_MAP } from '../../../constants/color-rules';
12
11
  import './index.css';
13
- const COVER = {
14
- top: '0px',
15
- right: '0px',
16
- bottom: '0px',
17
- left: '0px'
18
- };
19
12
  class ColorUseTypeSelector extends Component {
20
13
  constructor(props) {
21
14
  super(props);
22
- this.getPopoverStyle = () => {
23
- if (!this.colorSpecialContainerRef || !this.colorPickerRef) return {};
24
- setTimeout(() => {
25
- const {
26
- top,
27
- height
28
- } = this.colorSpecialContainerRef.getBoundingClientRect();
29
- const {
30
- clientHeight
31
- } = document.body;
32
- const selectTop = top + height;
33
- let colorPickerHeight = 0;
34
- if (this.colorPickerRef.current) {
35
- colorPickerHeight = this.colorPickerRef.current.getHeight();
36
- }
37
- let style = {
38
- left: 0
39
- };
40
- if (clientHeight - selectTop < colorPickerHeight) {
41
- style = {
42
- ...style,
43
- bottom: '2.375rem'
44
- };
45
- }
46
- this.setState({
47
- popoverStyle: style
48
- });
49
- }, 10);
50
- };
51
15
  this.getUsableColorTypes = chartType => {
52
16
  switch (chartType) {
53
17
  case CHART_TYPE.BAR_GROUP:
@@ -201,8 +165,6 @@ class ColorUseTypeSelector extends Component {
201
165
  }, () => {
202
166
  if (!this.state.isShowColorSelector) {
203
167
  this.modifySpecificColor(this.state.specificColor);
204
- } else {
205
- this.getPopoverStyle();
206
168
  }
207
169
  });
208
170
  };
@@ -274,8 +236,7 @@ class ColorUseTypeSelector extends Component {
274
236
  };
275
237
  this.renderSpecificColorSelector = () => {
276
238
  const {
277
- specificColor,
278
- popoverStyle
239
+ specificColor
279
240
  } = this.state;
280
241
  const id = 'statistic_selected_specific_color';
281
242
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
@@ -300,7 +261,9 @@ class ColorUseTypeSelector extends Component {
300
261
  color: specificColor,
301
262
  onSubmit: this.modifyHex,
302
263
  onToggle: this.onToggleColorSelector,
303
- popoverStyle: popoverStyle
264
+ useProtal: true,
265
+ target: this.colorSpecialContainerRef,
266
+ scrollContainerId: "sea-chart-settings-container"
304
267
  }))));
305
268
  };
306
269
  this.renderColorRulesEditor = () => {
@@ -344,8 +307,7 @@ class ColorUseTypeSelector extends Component {
344
307
  this.state = {
345
308
  isShowColorSelector: false,
346
309
  isShowColorRulesEditor: false,
347
- specificColor: this.getSelectedSpecificColor(),
348
- popoverStyle: {}
310
+ specificColor: this.getSelectedSpecificColor()
349
311
  };
350
312
  this.colorOptions = this.initColorTypeOptions();
351
313
  this.isToggleColorRulesEditor = false;
@@ -34,10 +34,14 @@
34
34
  height: calc(100% - 41px);
35
35
  }
36
36
 
37
- .sea-chart-formatter .sea-chart-table-formatter-container {
37
+ .sea-chart-formatter .sea-chart-table-formatter-container:hover {
38
38
  overflow: auto;
39
39
  }
40
40
 
41
+ .sea-chart-formatter .sea-chart-table-formatter-container {
42
+ overflow: hidden;
43
+ }
44
+
41
45
  .sea-chart-formatter .sea-chart-heat_map-formatter-container {
42
46
  overflow: auto;
43
47
  }
@@ -49,9 +49,13 @@ class RecordsBody extends Component {
49
49
  }
50
50
  setVerticalScrollbarTop(scrollTop);
51
51
  };
52
- this.onScroll = () => {
52
+ this.onScroll = e => {
53
+ e.stopPropagation();
53
54
  this.recalculate();
54
55
  };
56
+ this.onWheel = e => {
57
+ this.props.setHorizontalScroll(e.deltaX);
58
+ };
55
59
  this.setContentScrollTop = scrollTop => {
56
60
  this.tableElementResultContentRef.scrollTop = scrollTop;
57
61
  };
@@ -98,6 +102,7 @@ class RecordsBody extends Component {
98
102
  color: globalTheme === 'light' ? '#212529' : '#ffffff'
99
103
  },
100
104
  onScroll: this.onScroll,
105
+ onWheel: this.onWheel,
101
106
  ref: ref => this.tableElementResultContentRef = ref
102
107
  }, /*#__PURE__*/React.createElement("div", {
103
108
  className: "table-element-result-table",
@@ -122,6 +122,9 @@ class Records extends Component {
122
122
  this.onVerticalScrollbarScroll = scrollTop => {
123
123
  this.recordsBody.setContentScrollTop(scrollTop);
124
124
  };
125
+ this.setHorizontalScroll = deltaX => {
126
+ this.resultRef.scrollLeft += deltaX;
127
+ };
125
128
  this.state = {
126
129
  scrollLeft: 0
127
130
  };
@@ -156,7 +159,8 @@ class Records extends Component {
156
159
  ref: ref => this.resultContainerRef = ref
157
160
  }, /*#__PURE__*/React.createElement("div", {
158
161
  id: "sea-chart-table-element-result-container",
159
- className: "table-element-result-container"
162
+ className: "table-element-result-container",
163
+ ref: ref => this.resultRef = ref
160
164
  }, /*#__PURE__*/React.createElement("div", {
161
165
  id: "sea-chart-table-element-result-content",
162
166
  className: "table-element-result-content",
@@ -175,7 +179,8 @@ class Records extends Component {
175
179
  collaborators: collaborators,
176
180
  queryUsers: this.props.queryUsers,
177
181
  setVerticalScrollbarTop: this.setVerticalScrollbarTop,
178
- globalTheme: this.props.globalTheme
182
+ globalTheme: this.props.globalTheme,
183
+ setHorizontalScroll: this.setHorizontalScroll
179
184
  }))), /*#__PURE__*/React.createElement(VerticalScrollbar, {
180
185
  contentHeight: 33 * records.length,
181
186
  ref: ref => this.verticalScrollbar = ref,
@@ -105,6 +105,7 @@ export default class TableElement extends React.Component {
105
105
  shownColumns,
106
106
  selectedTable
107
107
  } = this.state;
108
+ const records = Array.isArray(result) ? result : [];
108
109
  return /*#__PURE__*/React.createElement("div", {
109
110
  className: "table-element-result",
110
111
  ref: ref => this.wrapperRef = ref
@@ -112,7 +113,7 @@ export default class TableElement extends React.Component {
112
113
  chart: chart,
113
114
  selectedTable: selectedTable,
114
115
  shownColumns: shownColumns,
115
- records: result,
116
+ records: records,
116
117
  collaborators: relatedUserList,
117
118
  queryUsers: this.queryUsers,
118
119
  globalTheme: globalTheme
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sea-chart",
3
- "version": "1.1.58",
3
+ "version": "1.1.60",
4
4
  "main": "./dist/index.js",
5
5
  "dependencies": {
6
6
  "@antv/data-set": "0.11.8",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "peerDependencies": {
29
29
  "@antv/scale": "0.3.14",
30
- "dtable-ui-component": "^5.2.17",
30
+ "dtable-ui-component": "^5.2.19",
31
31
  "dtable-utils": "~5.0.*",
32
32
  "prop-types": "15.8.1",
33
33
  "react": "^17.0.0",