sea-chart 1.1.29 → 1.1.31

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.
@@ -42,7 +42,7 @@
42
42
  color: #666;
43
43
  }
44
44
 
45
- table td {
45
+ .drill-down-fields-popover table td {
46
46
  padding: 0.5rem 0.1875rem;
47
47
  border-bottom: 1px solid #eee;
48
48
  font-size: 0.875rem;
@@ -6,6 +6,7 @@ import { settingsContext, DepartmentsContext, GlobalThemeContext } from '../util
6
6
  import { eventStopPropagation } from '../utils';
7
7
  import { BaseUtils } from '../utils';
8
8
  import { CHART_SETTINGS_TYPE, CHART_SETTINGS } from '../constants';
9
+ import useForceUpdate from '../components/types-dialog/use-force-update';
9
10
  import Divider from './widgets/divider';
10
11
  import DataSettings from './data-settings';
11
12
  import StyleSettings from './style-settings';
@@ -20,10 +21,19 @@ const Settings = _ref => {
20
21
  onChange,
21
22
  children,
22
23
  departments,
23
- globalTheme
24
+ globalTheme,
25
+ lang
24
26
  } = _ref;
25
27
  const [type, setType] = useState(CHART_SETTINGS_TYPE.DATA);
26
28
  const [labelColorConfigs, setLabelColorConfigs] = useState([]);
29
+ const forceUpdate = useForceUpdate();
30
+ useEffect(() => {
31
+ if (lang) {
32
+ intl.setLang(lang);
33
+ forceUpdate();
34
+ }
35
+ // eslint-disable-next-line react-hooks/exhaustive-deps
36
+ }, []);
27
37
  useEffect(() => {
28
38
  var _window$dtable;
29
39
  const systemCustomColors = ((_window$dtable = window.dtable) === null || _window$dtable === void 0 ? void 0 : _window$dtable.customColors) || [];
@@ -132,13 +132,22 @@ class View extends React.PureComponent {
132
132
  componentDidMount() {
133
133
  var _window$app;
134
134
  const {
135
- isCalculateByView
135
+ isCalculateByView,
136
+ autoRefresh,
137
+ refreshInterval
136
138
  } = this.props;
137
139
  this.unsubscribeReFreshChart = eventBus.subscribe(CommonEventTypes.REFRESH_CHARTS, this.refreshChart);
138
140
  if (((_window$app = window.app) === null || _window$app === void 0 ? void 0 : _window$app.eventBus) && isCalculateByView) {
139
141
  window.app.eventBus.subscribe(CommonEventTypes.EXPAND_ROW_UPDATED, this.handleModifyRecord);
140
142
  window.app.eventBus.subscribe(CommonEventTypes.EXPAND_ROW_DELETED, this.handleDeleteRecord);
141
143
  }
144
+
145
+ // refreshInterval is minutes
146
+ if (autoRefresh && refreshInterval) {
147
+ this.refreshTimer = setInterval(() => {
148
+ this.calculateStatistic();
149
+ }, refreshInterval * 60000);
150
+ }
142
151
  const {
143
152
  hasUnSaved
144
153
  } = this.props;
@@ -148,19 +157,34 @@ class View extends React.PureComponent {
148
157
  }
149
158
  componentWillUnmount() {
150
159
  this.unsubscribeReFreshChart();
160
+ this.refreshTimer && clearInterval(this.refreshTimer);
151
161
  }
152
162
  UNSAFE_componentWillReceiveProps(nextProps) {
153
163
  const {
154
164
  chart: oldChart,
155
- hasUnSaved
165
+ hasUnSaved,
166
+ version
156
167
  } = this.props;
157
168
  const {
158
169
  chart,
159
- hasUnSaved: nextUnSaved
170
+ hasUnSaved: nextUnSaved,
171
+ version: nextVersion,
172
+ autoRefresh,
173
+ refreshInterval
160
174
  } = nextProps;
161
175
  const {
162
176
  data
163
177
  } = this.state;
178
+
179
+ // after auto_refresh config changed, reset the timer
180
+ if (autoRefresh && refreshInterval) {
181
+ this.refreshTimer && clearInterval(this.refreshTimer);
182
+ this.refreshTimer = setInterval(() => {
183
+ this.calculateStatistic();
184
+ }, refreshInterval * 60000);
185
+ } else {
186
+ this.refreshTimer && clearInterval(this.refreshTimer);
187
+ }
164
188
  context.api = this.props.api;
165
189
 
166
190
  // universal-apps will not trigger calculation of the chart before the chart config saved
@@ -170,7 +194,9 @@ class View extends React.PureComponent {
170
194
  this.calculateStatistic();
171
195
  return;
172
196
  }
173
- if (shallowEqual(chart, oldChart)) return;
197
+
198
+ // version was used to dectect table change in big screen plugin
199
+ if (shallowEqual(chart, oldChart) && version === nextVersion) return;
174
200
  this.setState({
175
201
  isCalculated: false
176
202
  }, () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sea-chart",
3
- "version": "1.1.29",
3
+ "version": "1.1.31",
4
4
  "main": "./dist/index.js",
5
5
  "dependencies": {
6
6
  "@antv/data-set": "0.11.8",