sea-chart 1.1.39 → 1.1.41
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 +2 -1
- package/dist/settings/map-settings/map-data-settings.js +1 -1
- package/dist/utils/chart-utils/base-utils.js +6 -3
- package/dist/utils/column-utils.js +12 -6
- package/dist/view/index.js +12 -2
- package/dist/view/wrapper/chart-component.js +1 -1
- package/package.json +1 -1
package/dist/constants/index.js
CHANGED
|
@@ -121,7 +121,8 @@ export const LABEL_POSITION_TYPE_SHOW = {
|
|
|
121
121
|
[LABEL_POSITION_TYPE.BOTTOM]: 'Bottom',
|
|
122
122
|
[LABEL_POSITION_TYPE.TOP]: 'Top'
|
|
123
123
|
};
|
|
124
|
-
export const CHART_STYLE_SETTING_KEYS = ['x_axis_show_label', 'x_axis_label_position', 'y_axis_show_label', 'y_axis_label_position', 'y_axis_auto_range', 'y_axis_min', 'y_axis_max', 'y_axis_label_color', 'y_axis_show_value', 'label_font_size', 'increase_display_color', 'display_increase', 'display_increase_percentage', 'show_legend', 'minimum_slice_percent', 'label_format', 'label_position', 'display_label', 'horizontal_axis_label_color', 'display_data', 'name', 'y_axis_left_label_position', 'y_axis_right_label_position', 'show_y_axis_left_label', 'show_y_axis_right_label', 'y_axis_auto_range_left', 'y_axis_min_left', 'y_axis_max_left', 'y_axis_auto_range_right', 'y_axis_min_right', 'y_axis_max_right'
|
|
124
|
+
export const CHART_STYLE_SETTING_KEYS = ['x_axis_show_label', 'x_axis_label_position', 'y_axis_show_label', 'y_axis_label_position', 'y_axis_auto_range', 'y_axis_min', 'y_axis_max', 'y_axis_label_color', 'y_axis_show_value', 'label_font_size', 'increase_display_color', 'display_increase', 'display_increase_percentage', 'show_legend', 'minimum_slice_percent', 'label_format', 'label_position', 'display_label', 'horizontal_axis_label_color', 'display_data', 'name', 'y_axis_left_label_position', 'y_axis_right_label_position', 'show_y_axis_left_label', 'show_y_axis_right_label', 'y_axis_auto_range_left', 'y_axis_min_left', 'y_axis_max_left', 'y_axis_auto_range_right', 'y_axis_min_right', 'y_axis_max_right'];
|
|
125
|
+
export const CHART_STYLE_CONFIG_SETTING_KEYS = ['display_goal_line', 'goal_value', 'goal_label'];
|
|
125
126
|
export const DEFAULT_LABEL_FONT_SIZE = 12;
|
|
126
127
|
export const CHART_Y_GROUP_TYPE = {
|
|
127
128
|
COUNT: 'count',
|
|
@@ -30,7 +30,7 @@ const MapDataSettings = _ref => {
|
|
|
30
30
|
} = chart.config;
|
|
31
31
|
const isCountryLevel = map_level === MAP_LEVEL.COUNTRY;
|
|
32
32
|
const selectedTable = getTableById(tables, table_id);
|
|
33
|
-
const locationColumns = (selectedTable === null || selectedTable === void 0 ? void 0 : selectedTable.columns.filter(column => [CHART_TYPE.WORLD_MAP, CHART_TYPE.WORLD_MAP_BUBBLE].includes(type) ? isWorldMapColumn(column) : isMapColumn(column))) || [];
|
|
33
|
+
const locationColumns = (selectedTable === null || selectedTable === void 0 ? void 0 : selectedTable.columns.filter(column => [CHART_TYPE.WORLD_MAP, CHART_TYPE.WORLD_MAP_BUBBLE].includes(type) ? isWorldMapColumn(column) : isMapColumn(column, map_level))) || [];
|
|
34
34
|
function handleYAxisGroupSettingsChange(value) {
|
|
35
35
|
const update = {};
|
|
36
36
|
Object.keys(value).forEach(key => {
|
|
@@ -2,11 +2,10 @@ var _BaseUtils;
|
|
|
2
2
|
import shallowEqual from 'shallowequal';
|
|
3
3
|
import dayjs from 'dayjs';
|
|
4
4
|
import { CellType, COLLABORATOR_COLUMN_TYPES, FORMULA_COLUMN_TYPES_MAP, FORMULA_RESULT_TYPE, getDateDisplayString, getNumberDisplayString, getOption, getPrecisionNumber, getTableById, getTableColumnByKey, isNumber, isNumericColumn, isDateColumn, sortText, sortNumber, sortDate, sortSingleSelect, sortFormula, getColumnOptions, DateUtils, getGeolocationDisplayString, getFormulaDisplayString, isArchiveView, getViewById, MULTIPLE_CELL_VALUE_COLUMN_TYPE_MAP } from 'dtable-utils';
|
|
5
|
-
import { PIE_CHART_COLORS, CHART_SUMMARY_TYPE, CHART_SUPPORT_SORT_COLUMNS, CHART_TYPE, CHART_STYLE_SETTING_KEYS, DEFAULT_LABEL_FONT_SIZE, DEFAULT_NUMBER_FORMAT_OBJECT, X_AXIS_IS_GROUPBY_COLUMN_KEY_CHART_TYPES, STYLE_COLORS, CHART_DATA_SORT_TYPE, CHART_Y_GROUP_TYPE, HORIZONTAL_BAR_CHART_TYPES, COMPLTETELESS_CHART_TYPES } from '../../constants';
|
|
5
|
+
import { PIE_CHART_COLORS, CHART_SUMMARY_TYPE, CHART_SUPPORT_SORT_COLUMNS, CHART_TYPE, CHART_STYLE_SETTING_KEYS, DEFAULT_LABEL_FONT_SIZE, DEFAULT_NUMBER_FORMAT_OBJECT, X_AXIS_IS_GROUPBY_COLUMN_KEY_CHART_TYPES, STYLE_COLORS, CHART_DATA_SORT_TYPE, CHART_Y_GROUP_TYPE, HORIZONTAL_BAR_CHART_TYPES, COMPLTETELESS_CHART_TYPES, CHART_STYLE_CONFIG_SETTING_KEYS } from '../../constants';
|
|
6
6
|
import { getClientFormulaDisplayString } from '../cell-format-utils';
|
|
7
7
|
import { getKnownCollaboratorByEmail, generateDefaultUser, getUsers } from '../collaborator-utils';
|
|
8
8
|
import { getDateColumnFormat, getColumnByKey } from '../column-utils';
|
|
9
|
-
import ObjectUtils from '../object-utils';
|
|
10
9
|
import intl from '../../intl';
|
|
11
10
|
import context from '../../context';
|
|
12
11
|
import { isValidCollaboratorEmail } from '../collaborator';
|
|
@@ -384,7 +383,11 @@ BaseUtils.isChartStyleChange = (preChartElement, curChartElement) => {
|
|
|
384
383
|
if ((preChartElement === null || preChartElement === void 0 ? void 0 : (_preChartElement$heig = preChartElement.height) === null || _preChartElement$heig === void 0 ? void 0 : _preChartElement$heig.value) !== (curChartElement === null || curChartElement === void 0 ? void 0 : (_curChartElement$heig = curChartElement.height) === null || _curChartElement$heig === void 0 ? void 0 : _curChartElement$heig.value)) return true;
|
|
385
384
|
if ((preChartElement === null || preChartElement === void 0 ? void 0 : preChartElement.left_in_unit) !== (curChartElement === null || curChartElement === void 0 ? void 0 : curChartElement.left_in_unit)) return true;
|
|
386
385
|
if ((preChartElement === null || preChartElement === void 0 ? void 0 : preChartElement.width_in_unit) !== (curChartElement === null || curChartElement === void 0 ? void 0 : curChartElement.width_in_unit)) return true;
|
|
387
|
-
|
|
386
|
+
const hasStyleConfig = preChartElement.style_config && curChartElement.style_config;
|
|
387
|
+
if (hasStyleConfig) {
|
|
388
|
+
const chartStyleConfigChanged = CHART_STYLE_CONFIG_SETTING_KEYS.some(key => preChartElement.style_config[key] !== curChartElement.style_config[key]);
|
|
389
|
+
return chartStyleConfigChanged;
|
|
390
|
+
}
|
|
388
391
|
return !CHART_STYLE_SETTING_KEYS.every(key => preChartElement.config[key] === curChartElement.config[key]);
|
|
389
392
|
};
|
|
390
393
|
BaseUtils.isChartTypeChange = (preChartElement, curChartElement) => {
|
|
@@ -4,10 +4,16 @@ import React from 'react';
|
|
|
4
4
|
import { MIRROR_COLUMN_LIST, CHART_SUMMARY_TYPE } from '../constants';
|
|
5
5
|
import { getClientFormulaDisplayString } from './cell-format-utils';
|
|
6
6
|
import { BaseUtils } from './chart-utils';
|
|
7
|
+
const UN_SUPPORTED_MAP_CN_COLUMN_TYPES = ['lng_lat', 'country_region', 'map_selection'];
|
|
8
|
+
const MAPLEVEL_SUPPORTED_COLUMN_TYPES = {
|
|
9
|
+
country: ['province', 'province_city', 'province_city_district', 'geolocation'],
|
|
10
|
+
province: ['province_city', 'province_city_district', 'geolocation'],
|
|
11
|
+
city: ['province_city_district', 'geolocation']
|
|
12
|
+
};
|
|
7
13
|
|
|
8
14
|
// is
|
|
9
|
-
export const isMapColumn = column => {
|
|
10
|
-
if (!column) return false;
|
|
15
|
+
export const isMapColumn = (column, mapLevel) => {
|
|
16
|
+
if (!column || !mapLevel) return false;
|
|
11
17
|
const {
|
|
12
18
|
type,
|
|
13
19
|
data
|
|
@@ -16,10 +22,10 @@ export const isMapColumn = column => {
|
|
|
16
22
|
const {
|
|
17
23
|
geo_format
|
|
18
24
|
} = data || {};
|
|
19
|
-
if (geo_format
|
|
25
|
+
if (UN_SUPPORTED_MAP_CN_COLUMN_TYPES.includes(geo_format)) {
|
|
20
26
|
return false;
|
|
21
27
|
}
|
|
22
|
-
return
|
|
28
|
+
return MAPLEVEL_SUPPORTED_COLUMN_TYPES[mapLevel].includes(geo_format);
|
|
23
29
|
}
|
|
24
30
|
if (FORMULA_COLUMN_TYPES_MAP[type]) {
|
|
25
31
|
const {
|
|
@@ -33,10 +39,10 @@ export const isMapColumn = column => {
|
|
|
33
39
|
const {
|
|
34
40
|
geo_format
|
|
35
41
|
} = array_data || {};
|
|
36
|
-
if (geo_format
|
|
42
|
+
if (UN_SUPPORTED_MAP_CN_COLUMN_TYPES.includes(geo_format)) {
|
|
37
43
|
return false;
|
|
38
44
|
}
|
|
39
|
-
return
|
|
45
|
+
return MAPLEVEL_SUPPORTED_COLUMN_TYPES[mapLevel].includes(geo_format);
|
|
40
46
|
}
|
|
41
47
|
return false;
|
|
42
48
|
};
|
package/dist/view/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import classnames from 'classnames';
|
|
4
|
-
import
|
|
4
|
+
import { isEqual } from 'lodash-es';
|
|
5
5
|
import context from '../context';
|
|
6
6
|
import intl from '../intl';
|
|
7
7
|
import eventBus from '../utils/event-bus';
|
|
@@ -196,7 +196,17 @@ class View extends React.PureComponent {
|
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
// version was used to dectect table change in big screen plugin
|
|
199
|
-
|
|
199
|
+
const {
|
|
200
|
+
config,
|
|
201
|
+
style_config
|
|
202
|
+
} = chart;
|
|
203
|
+
const {
|
|
204
|
+
config: oldConfig,
|
|
205
|
+
style_config: oldStyleConfig
|
|
206
|
+
} = oldChart;
|
|
207
|
+
const isConfigUnchange = isEqual(config, oldConfig) && version === nextVersion;
|
|
208
|
+
const isStyleUnchange = isEqual(style_config, oldStyleConfig);
|
|
209
|
+
if (isConfigUnchange && isStyleUnchange) return;
|
|
200
210
|
this.setState({
|
|
201
211
|
isCalculated: false
|
|
202
212
|
}, () => {
|
|
@@ -235,7 +235,7 @@ export default class ChartComponent extends Component {
|
|
|
235
235
|
this.globalTheme === THEME_NAME_MAP.DARK ? textColor = '#fff' : textColor = '#999';
|
|
236
236
|
const xAxisID = "chart-x-axis-label_".concat(chart.id);
|
|
237
237
|
const chartContainer = this.chart.getCanvas().get('container');
|
|
238
|
-
const xLabel = chartContainer.querySelector("#".concat(xAxisID));
|
|
238
|
+
const xLabel = chartContainer === null || chartContainer === void 0 ? void 0 : chartContainer.querySelector("#".concat(xAxisID));
|
|
239
239
|
if (!xLabel && x_axis_show_label) {
|
|
240
240
|
const div = document.createElement('div');
|
|
241
241
|
div.id = xAxisID;
|