sea-chart 0.0.41-beta.5 → 0.0.41-beta.7
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/constants/index.js +3 -0
- package/dist/context.js +16 -6
- package/dist/settings/index.js +4 -3
- package/package.json +1 -1
package/dist/constants/index.js
CHANGED
|
@@ -236,6 +236,9 @@ 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/';
|
|
239
242
|
export const MONTH_MIRROR = {
|
|
240
243
|
'0': 'Jan',
|
|
241
244
|
'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 } from './constants';
|
|
4
|
+
import { CHART_TYPE, CHART_TYPE_IMAGE, DEFAULT_MEDIAURL } from './constants';
|
|
5
5
|
class Context {
|
|
6
6
|
constructor() {
|
|
7
7
|
this.queryChartResult = async _ref => {
|
|
@@ -102,12 +102,22 @@ class Context {
|
|
|
102
102
|
return this.api.getTableFormulaResults(table, rows, value);
|
|
103
103
|
};
|
|
104
104
|
this.getChartImageUrl = type => {
|
|
105
|
+
var _this$settings, _this$settings2, _window$dtable;
|
|
105
106
|
const name = CHART_TYPE_IMAGE[type];
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
107
|
+
if (((_this$settings = this.settings) === null || _this$settings === void 0 ? void 0 : _this$settings.server) && ((_this$settings2 = this.settings) === null || _this$settings2 === void 0 ? void 0 : _this$settings2.mediaUrl)) {
|
|
108
|
+
const {
|
|
109
|
+
server,
|
|
110
|
+
mediaUrl
|
|
111
|
+
} = this.settings;
|
|
112
|
+
return "".concat(server).concat(mediaUrl, "dtable-statistic/img/").concat(name);
|
|
113
|
+
}
|
|
114
|
+
if ((_window$dtable = window.dtable) === null || _window$dtable === void 0 ? void 0 : _window$dtable.mediaUrl) {
|
|
115
|
+
const {
|
|
116
|
+
mediaUrl
|
|
117
|
+
} = window.dtable;
|
|
118
|
+
return "".concat(mediaUrl, "dtable-statistic/img/").concat(name);
|
|
119
|
+
}
|
|
120
|
+
return "".concat(DEFAULT_MEDIAURL, "dtable-statistic/img/").concat(name);
|
|
111
121
|
};
|
|
112
122
|
this.api = null;
|
|
113
123
|
this.settings = {};
|
package/dist/settings/index.js
CHANGED
|
@@ -75,8 +75,8 @@ const Settings = _ref => {
|
|
|
75
75
|
}, []);
|
|
76
76
|
const onTypeChange = useCallback(newType => {
|
|
77
77
|
const {
|
|
78
|
-
config
|
|
79
|
-
} = chart;
|
|
78
|
+
config = {}
|
|
79
|
+
} = chart || {};
|
|
80
80
|
const {
|
|
81
81
|
type: oldType
|
|
82
82
|
} = config;
|
|
@@ -89,7 +89,8 @@ const Settings = _ref => {
|
|
|
89
89
|
...chart,
|
|
90
90
|
config: convertedChart
|
|
91
91
|
}, type);
|
|
92
|
-
|
|
92
|
+
closeTypesDialog();
|
|
93
|
+
}, [chart, closeTypesDialog, onChange, tables, type]);
|
|
93
94
|
return /*#__PURE__*/React.createElement(React.Fragment, null, !isHideSettings && /*#__PURE__*/React.createElement("div", {
|
|
94
95
|
className: "sea-chart-settings"
|
|
95
96
|
}, /*#__PURE__*/React.createElement("div", {
|