dtable-statistic 5.0.8-alpha.7 → 5.0.9

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.
@@ -10,7 +10,6 @@ var _react = _interopRequireWildcard(require("react"));
10
10
  var _reactIntlUniversal = _interopRequireDefault(require("react-intl-universal"));
11
11
  var _seaChart = require("sea-chart");
12
12
  var _reactstrap = require("reactstrap");
13
- var _constants = require("../../constants");
14
13
  class ChartEditDialog extends _react.Component {
15
14
  constructor(props) {
16
15
  super(props);
@@ -55,8 +54,7 @@ class ChartEditDialog extends _react.Component {
55
54
  const {
56
55
  api,
57
56
  colorThemeName,
58
- theme,
59
- eventBus
57
+ theme
60
58
  } = this.props;
61
59
  const {
62
60
  chart
@@ -82,15 +80,12 @@ class ChartEditDialog extends _react.Component {
82
80
  chart: chart,
83
81
  config: window.dtable,
84
82
  api: api,
85
- dtableStoreValue: this.value,
86
83
  tables: this.value.tables,
87
84
  collaborators: this.value.collaborators,
88
85
  dataSources: "view",
89
86
  theme: theme,
90
87
  chartColorTheme: colorThemeName,
91
88
  isCalculateByView: true,
92
- integratedEventTypes: _constants.CommonEventTypes,
93
- integratedEventBus: eventBus,
94
89
  onChange: this.onSettingChange
95
90
  })))));
96
91
  }
@@ -148,9 +148,9 @@ class StatisticRecordDialog extends _react.default.Component {
148
148
  return rowsIds.map(rowId => idRowMap[rowId]).filter(Boolean);
149
149
  };
150
150
  this.toggle = () => {
151
- // if (this.valueChanged) {
152
- // this.props.eventBus.dispatch(CommonEventTypes.REFRESH_CHARTS);
153
- // }
151
+ if (this.valueChanged) {
152
+ this.props.eventBus.dispatch(_constants.CommonEventTypes.REFRESH_CHARTS);
153
+ }
154
154
  this.props.toggleStatisticRecordsDialog();
155
155
  };
156
156
  this.expandRowUpdated = _ref => {
package/es/dashboard.js CHANGED
@@ -66,6 +66,11 @@ class DashBoard extends _react.Component {
66
66
  selectedDashboardIdx
67
67
  });
68
68
  };
69
+ this.refreshCharts = () => {
70
+ this.setState({
71
+ dtableChangedTime: Date.now()
72
+ });
73
+ };
69
74
  this.initDashboard = () => {
70
75
  const value = this.value;
71
76
  this.dashboardService = new _dashboardService.default({
@@ -358,7 +363,8 @@ class DashBoard extends _react.Component {
358
363
  } = this.initDashboard();
359
364
  this.state = {
360
365
  statistics: _statistics,
361
- selectedDashboardIdx: _selectedDashboardIdx
366
+ selectedDashboardIdx: _selectedDashboardIdx,
367
+ dtableChangedTime: null
362
368
  };
363
369
  this.isInitDashboard = true;
364
370
  this.updatingLocalStatistics = false;
@@ -371,10 +377,12 @@ class DashBoard extends _react.Component {
371
377
  } = this.props;
372
378
  this.unsubscribeLocalDtableChanged = eventBus.subscribe('local-dtable-changed', this.onLocalDTableChanged);
373
379
  this.unsubscribeRemoteDtableChange = eventBus.subscribe('remote-dtable-changed', this.onServerDTableChanged);
380
+ this.unsubscribeRefreshCharts = eventBus.subscribe(_constants.CommonEventTypes.REFRESH_CHARTS, this.refreshCharts);
374
381
  }
375
382
  componentWillUnmount() {
376
383
  this.unsubscribeLocalDtableChanged();
377
384
  this.unsubscribeRemoteDtableChange();
385
+ this.unsubscribeRefreshCharts();
378
386
  }
379
387
  render() {
380
388
  const {
@@ -382,13 +390,15 @@ class DashBoard extends _react.Component {
382
390
  } = this.props;
383
391
  const {
384
392
  statistics,
385
- selectedDashboardIdx
393
+ selectedDashboardIdx,
394
+ dtableChangedTime
386
395
  } = this.state;
387
396
  const isTableReadOnly = this.isTableReadOnly();
388
397
  const colorThemeName = this.dashboardService.getColorThemeName();
389
398
  return _utils.isMobile ? /*#__PURE__*/_react.default.createElement(_mobileDashboard.default, {
390
399
  isTableReadOnly: isTableReadOnly,
391
400
  colorThemeName: colorThemeName,
401
+ dtableChangedTime: dtableChangedTime,
392
402
  statistics: statistics,
393
403
  selectedDashboardIdx: selectedDashboardIdx,
394
404
  eventBus: eventBus,
@@ -403,6 +413,7 @@ class DashBoard extends _react.Component {
403
413
  }) : /*#__PURE__*/_react.default.createElement(_desktopDashboard.default, {
404
414
  isTableReadOnly: isTableReadOnly,
405
415
  colorThemeName: colorThemeName,
416
+ dtableChangedTime: dtableChangedTime,
406
417
  statistics: statistics,
407
418
  selectedDashboardIdx: selectedDashboardIdx,
408
419
  eventBus: eventBus,
@@ -168,6 +168,7 @@ class DesktopDashboard extends _react.Component {
168
168
  getTableById,
169
169
  getValue,
170
170
  isTableReadOnly,
171
+ dtableChangedTime,
171
172
  colorThemeName,
172
173
  statistics,
173
174
  selectedDashboardIdx,
@@ -259,6 +260,7 @@ class DesktopDashboard extends _react.Component {
259
260
  className: "statistic-main"
260
261
  }, /*#__PURE__*/_react.default.createElement(_statList.default, {
261
262
  isTableReadOnly: isTableReadOnly,
263
+ dtableChangedTime: dtableChangedTime,
262
264
  theme: theme,
263
265
  colorThemeName: colorThemeName,
264
266
  statItems: statItems,
@@ -279,7 +281,6 @@ class DesktopDashboard extends _react.Component {
279
281
  theme: theme,
280
282
  colorThemeName: colorThemeName,
281
283
  editingChart: editingChart,
282
- eventBus: eventBus,
283
284
  api: this.api,
284
285
  getValue: getValue,
285
286
  statistics: statistics,
@@ -75,7 +75,6 @@ class ChartPreview extends _react.Component {
75
75
  colorThemeName,
76
76
  api,
77
77
  value,
78
- eventBus,
79
78
  getTableById,
80
79
  toggleStatisticRecordsDialog
81
80
  } = this.props;
@@ -86,7 +85,6 @@ class ChartPreview extends _react.Component {
86
85
  statItem: statItem,
87
86
  api: api,
88
87
  value: value,
89
- eventBus: eventBus,
90
88
  getTableById: getTableById,
91
89
  toggleStatisticRecordsDialog: toggleStatisticRecordsDialog
92
90
  });
@@ -132,7 +132,7 @@ class StatList extends _react.Component {
132
132
 
133
133
  // refresh charts if has updates
134
134
  if (Array.isArray(rowIds) && rowIds.length > 0 || Array.isArray(newRows) && newRows.length > 0) {
135
- _seaChart.EventBus.dispatch(_constants.CommonEventTypes.REFRESH_CHARTS);
135
+ this.props.eventBus.dispatch(_constants.CommonEventTypes.REFRESH_CHARTS);
136
136
  }
137
137
  }
138
138
  this.statisticalResult4Update = null;
@@ -168,8 +168,7 @@ class StatList extends _react.Component {
168
168
  theme,
169
169
  colorThemeName,
170
170
  statItems,
171
- api,
172
- eventBus
171
+ api
173
172
  } = this.props;
174
173
  const {
175
174
  layout,
@@ -207,7 +206,6 @@ class StatList extends _react.Component {
207
206
  colorThemeName: colorThemeName,
208
207
  statItem: item,
209
208
  api: api,
210
- eventBus: eventBus,
211
209
  value: this.value,
212
210
  getOtherStatistics: this.props.getOtherStatistics,
213
211
  getTableById: this.props.getTableById,
@@ -8,7 +8,6 @@ exports.default = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _seaChart = require("sea-chart");
10
10
  var _dtableUtils = require("dtable-utils");
11
- var _constants = require("../constants");
12
11
  class StatView extends _react.default.Component {
13
12
  constructor(props) {
14
13
  super(props);
@@ -46,8 +45,7 @@ class StatView extends _react.default.Component {
46
45
  api,
47
46
  value,
48
47
  theme,
49
- colorThemeName,
50
- eventBus
48
+ colorThemeName
51
49
  } = this.props;
52
50
  return /*#__PURE__*/_react.default.createElement("div", {
53
51
  className: "statistic-chart-container"
@@ -55,15 +53,12 @@ class StatView extends _react.default.Component {
55
53
  chart: statItem,
56
54
  api: api,
57
55
  config: window.dtable,
58
- dtableStoreValue: value,
59
56
  tables: value.tables,
60
57
  collaborators: value.collaborators,
61
58
  hideTitle: true,
62
59
  globalTheme: theme,
63
60
  chartColorTheme: colorThemeName,
64
61
  isCalculateByView: true,
65
- integratedEventTypes: _constants.CommonEventTypes,
66
- integratedEventBus: eventBus,
67
62
  onViewRef: this.getViewRef
68
63
  }));
69
64
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dtable-statistic",
3
- "version": "5.0.8-alpha.7",
3
+ "version": "5.0.9",
4
4
  "description": "statistics",
5
5
  "main": "dist/dtable-statistic.js",
6
6
  "author": "seafile",
@@ -18,7 +18,7 @@
18
18
  "react-grid-layout": "^1.2.5",
19
19
  "react-intl-universal": "^2.4.8",
20
20
  "reactstrap": "8.9.0",
21
- "sea-chart": "0.0.55-alpha.0"
21
+ "sea-chart": "^0.0.53"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "dtable-ui-component": "~5.0.*",
@@ -53,7 +53,7 @@
53
53
  "dotenv": "^10.0.0",
54
54
  "dotenv-expand": "^5.1.0",
55
55
  "dtable-store": "4.3.6",
56
- "dtable-ui-component": "5.0.5",
56
+ "dtable-ui-component": "^5.0.7",
57
57
  "dtable-utils": "4.4.0",
58
58
  "eslint": "^8.3.0",
59
59
  "eslint-config-react-app": "^7.0.1",