sea-chart 0.0.42-beta.1 → 0.0.42
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/dist/components/types-dialog/index.js +2 -2
- package/dist/constants/common-constants.js +0 -3
- package/dist/constants/index.js +0 -3
- package/dist/context.js +6 -9
- package/dist/index.js +1 -4
- package/dist/locale/lang/en.js +0 -1
- package/dist/locale/lang/zh_CN.js +0 -1
- package/dist/model/chart.js +0 -4
- package/dist/settings/index.js +3 -4
- package/dist/settings/widgets/common-data-settings.js +1 -1
- package/dist/settings/widgets/group-by.js +0 -1
- package/dist/view/index.js +1 -4
- package/package.json +1 -1
- package/dist/utils/event-bus.js +0 -28
|
@@ -45,7 +45,7 @@ const TypesDialog = _ref => {
|
|
|
45
45
|
const onSubmit = useCallback(() => {
|
|
46
46
|
onChange(selectedType);
|
|
47
47
|
onToggle();
|
|
48
|
-
}, [
|
|
48
|
+
}, [selectedType, onToggle, onChange]);
|
|
49
49
|
return /*#__PURE__*/React.createElement(Modal, {
|
|
50
50
|
isOpen: true,
|
|
51
51
|
toggle: onToggle,
|
|
@@ -53,7 +53,7 @@ const TypesDialog = _ref => {
|
|
|
53
53
|
zIndex: 1048
|
|
54
54
|
}, /*#__PURE__*/React.createElement(ModalHeader, {
|
|
55
55
|
toggle: onToggle
|
|
56
|
-
},
|
|
56
|
+
}, intl.get('Edit_type')), /*#__PURE__*/React.createElement(ModalBody, {
|
|
57
57
|
className: "sea-chart-types-body"
|
|
58
58
|
}, /*#__PURE__*/React.createElement("div", {
|
|
59
59
|
className: "sea-chart-types-container d-flex flex-column h-100"
|
package/dist/constants/index.js
CHANGED
|
@@ -236,9 +236,6 @@ export const TYPE_DISPLAY_COLOR_USING = {
|
|
|
236
236
|
// default grid size, grid distance for heat map chart
|
|
237
237
|
export const DEFAULT_GRID_SIZE = 12;
|
|
238
238
|
export const DEFAULT_GRID_DISTANCE = 4;
|
|
239
|
-
|
|
240
|
-
// default mediaUrl
|
|
241
|
-
export const DEFAULT_MEDIAURL = 'https://dev.seatable.cn/media/';
|
|
242
239
|
export const MONTH_MIRROR = {
|
|
243
240
|
'0': 'Jan',
|
|
244
241
|
'1': 'Feb',
|
package/dist/context.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getTableById } from 'dtable-utils';
|
|
2
2
|
import CollaboratorManager from './utils/collaborator-manager';
|
|
3
3
|
import { ChartDataSQL } from './utils';
|
|
4
|
-
import { CHART_TYPE, CHART_TYPE_IMAGE
|
|
4
|
+
import { CHART_TYPE, CHART_TYPE_IMAGE } from './constants';
|
|
5
5
|
class Context {
|
|
6
6
|
constructor() {
|
|
7
7
|
this.queryChartResult = async _ref => {
|
|
@@ -102,15 +102,12 @@ class Context {
|
|
|
102
102
|
return this.api.getTableFormulaResults(table, rows, value);
|
|
103
103
|
};
|
|
104
104
|
this.getChartImageUrl = type => {
|
|
105
|
+
const {
|
|
106
|
+
server,
|
|
107
|
+
mediaUrl
|
|
108
|
+
} = this.settings;
|
|
105
109
|
const name = CHART_TYPE_IMAGE[type];
|
|
106
|
-
|
|
107
|
-
const {
|
|
108
|
-
server,
|
|
109
|
-
mediaUrl
|
|
110
|
-
} = this.settings;
|
|
111
|
-
return "".concat(server).concat(mediaUrl, "dtable-statistic/img/").concat(name);
|
|
112
|
-
}
|
|
113
|
-
return "".concat(DEFAULT_MEDIAURL, "dtable-statistic/img/").concat(name);
|
|
110
|
+
return "".concat(server).concat(mediaUrl, "dtable-statistic/img/").concat(name);
|
|
114
111
|
};
|
|
115
112
|
this.api = null;
|
|
116
113
|
this.settings = {};
|
package/dist/index.js
CHANGED
|
@@ -4,10 +4,7 @@ import { ChartModel } from './model';
|
|
|
4
4
|
import View from './view';
|
|
5
5
|
import Editor from './editor';
|
|
6
6
|
import Settings, { StyleSettings, Divider } from './settings';
|
|
7
|
-
import TypesDialog from './components/types-dialog';
|
|
8
7
|
import { ChartDataSQL } from './utils';
|
|
9
8
|
import Context from './context';
|
|
10
|
-
import EventBus from './utils/event-bus';
|
|
11
|
-
import { EXTERNAL_EVENT } from './constants/common-constants';
|
|
12
9
|
export default View;
|
|
13
|
-
export { SeaChartAPI, CHART_TYPE, CHART_TYPES, View, Editor, Settings, StyleSettings, Divider, Context, ChartModel, ChartDataSQL
|
|
10
|
+
export { SeaChartAPI, CHART_TYPE, CHART_TYPES, View, Editor, Settings, StyleSettings, Divider, Context, ChartModel, ChartDataSQL };
|
package/dist/locale/lang/en.js
CHANGED
|
@@ -129,7 +129,6 @@ const en = {
|
|
|
129
129
|
"Title": "Title",
|
|
130
130
|
"Custom_title": "Custom title",
|
|
131
131
|
"Edit_type": "Edit type",
|
|
132
|
-
"All_charts": "All charts",
|
|
133
132
|
"Cancel": "Cancel",
|
|
134
133
|
"Submit": "Submit",
|
|
135
134
|
"There_are_no_statistic_results_yet": "There are no statistic results yet",
|
package/dist/model/chart.js
CHANGED
|
@@ -2,17 +2,13 @@ import { generateChartConfig } from '../utils';
|
|
|
2
2
|
import { HORIZONTAL_ALIGN, DEFAULT_CHART_FONT_WEIGHT, DEFAULT_CHART_TITLE_FONT_SIZE } from '../constants';
|
|
3
3
|
class ChartModel {
|
|
4
4
|
constructor(options, tables) {
|
|
5
|
-
// id is ChartModel id
|
|
6
|
-
// _id is chart config id
|
|
7
5
|
const {
|
|
8
6
|
id,
|
|
9
|
-
_id,
|
|
10
7
|
style_config
|
|
11
8
|
} = options;
|
|
12
9
|
this.id = id;
|
|
13
10
|
this.type = 'statistic';
|
|
14
11
|
this.config = generateChartConfig(options, tables);
|
|
15
|
-
this.config._id = _id;
|
|
16
12
|
this.style_config = style_config || {};
|
|
17
13
|
this.style_config.title = {
|
|
18
14
|
text: '',
|
package/dist/settings/index.js
CHANGED
|
@@ -2,10 +2,10 @@ import React, { useCallback, useMemo, useState, useEffect } from 'react';
|
|
|
2
2
|
import classnames from 'classnames';
|
|
3
3
|
import { eventStopPropagation } from '../utils';
|
|
4
4
|
import { BaseUtils } from '../utils';
|
|
5
|
-
import intl from '../intl';
|
|
6
|
-
import { CHART_SETTINGS_TYPE, CHART_SETTINGS } from '../constants';
|
|
7
|
-
import StyleSettings from './style-settings';
|
|
8
5
|
import DataSettings from './data-settings';
|
|
6
|
+
import StyleSettings from './style-settings';
|
|
7
|
+
import { CHART_SETTINGS_TYPE, CHART_SETTINGS } from '../constants';
|
|
8
|
+
import intl from '../intl';
|
|
9
9
|
import Divider from './widgets/divider';
|
|
10
10
|
import './index.css';
|
|
11
11
|
const Settings = _ref => {
|
|
@@ -74,7 +74,6 @@ const Settings = _ref => {
|
|
|
74
74
|
})), /*#__PURE__*/React.createElement("div", {
|
|
75
75
|
className: "chart-settings-container position-relative"
|
|
76
76
|
}, /*#__PURE__*/React.createElement("div", {
|
|
77
|
-
id: "sea-chart-settings-content",
|
|
78
77
|
className: "chart-settings-content"
|
|
79
78
|
}, type === CHART_SETTINGS_TYPE.DATA && /*#__PURE__*/React.createElement(DataSettings, {
|
|
80
79
|
dataSources: dataSources,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
|
-
import { generateChartConfig } from '../../utils';
|
|
3
2
|
import StatisticType from './chart-type';
|
|
4
3
|
import SelectTable from './select-table';
|
|
5
4
|
import SelectView from './select-view';
|
|
6
5
|
import DataFilter from './data-filter';
|
|
7
6
|
import Divider from './divider';
|
|
7
|
+
import { generateChartConfig } from '../../utils';
|
|
8
8
|
const CommonDataSettings = _ref => {
|
|
9
9
|
let {
|
|
10
10
|
chart,
|
|
@@ -125,7 +125,6 @@ class GroupBy extends Component {
|
|
|
125
125
|
selectedOption = options ? options : null;
|
|
126
126
|
}
|
|
127
127
|
return /*#__PURE__*/React.createElement(DTableSelect, {
|
|
128
|
-
menuPortalTarget: "#sea-chart-settings-content",
|
|
129
128
|
value: selectedOption,
|
|
130
129
|
classNamePrefix: "select-column",
|
|
131
130
|
options: this.columnOptions,
|
package/dist/view/index.js
CHANGED
|
@@ -78,7 +78,6 @@ class View extends React.PureComponent {
|
|
|
78
78
|
tipMessage: ''
|
|
79
79
|
};
|
|
80
80
|
context.init(props);
|
|
81
|
-
props.onViewRef(this);
|
|
82
81
|
const lang = context.getSetting('lang') || 'zh-cn';
|
|
83
82
|
intl.setLang(lang);
|
|
84
83
|
}
|
|
@@ -176,9 +175,7 @@ const propTypes = {
|
|
|
176
175
|
tables: PropTypes.array.isRequired,
|
|
177
176
|
className: PropTypes.string,
|
|
178
177
|
collaboratorManager: PropTypes.object,
|
|
179
|
-
render: PropTypes.func
|
|
180
|
-
// User-defined rendering content
|
|
181
|
-
onViewRef: PropTypes.func
|
|
178
|
+
render: PropTypes.func // User-defined rendering content
|
|
182
179
|
};
|
|
183
180
|
const defaultProps = {
|
|
184
181
|
canvasStyle: {},
|
package/package.json
CHANGED
package/dist/utils/event-bus.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
class EventBus {
|
|
2
|
-
constructor() {
|
|
3
|
-
this.subscribers = {};
|
|
4
|
-
}
|
|
5
|
-
subscribe(type, handler) {
|
|
6
|
-
if (!this.subscribers[type]) {
|
|
7
|
-
this.subscribers[type] = [];
|
|
8
|
-
}
|
|
9
|
-
const handlers = this.subscribers[type];
|
|
10
|
-
handlers.push(handler);
|
|
11
|
-
return () => {
|
|
12
|
-
const index = handlers.indexOf(handler);
|
|
13
|
-
if (index > -1) {
|
|
14
|
-
handlers.splice(index, 1);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
dispatch(type) {
|
|
19
|
-
for (var _len = arguments.length, data = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
20
|
-
data[_key - 1] = arguments[_key];
|
|
21
|
-
}
|
|
22
|
-
const handlers = this.subscribers[type];
|
|
23
|
-
if (Array.isArray(handlers)) {
|
|
24
|
-
handlers.forEach(handler => handler(...data));
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
export default new EventBus();
|