sea-chart 0.0.103 → 1.1.0
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 +8 -2
- package/dist/components/types-dialog/use-force-update.js +9 -0
- package/dist/constants/index.js +1 -0
- package/dist/intl.js +6 -5
- package/dist/locale/lang/de.js +2 -1
- package/dist/locale/lang/en.js +2 -1
- package/dist/locale/lang/es.js +2 -1
- package/dist/locale/lang/fr.js +2 -1
- package/dist/locale/lang/pt.js +2 -1
- package/dist/locale/lang/ru.js +2 -1
- package/dist/locale/lang/zh_CN.js +2 -1
- package/dist/utils/chart-utils/base-utils.js +2 -2
- package/dist/view/index.js +2 -2
- package/package.json +1 -1
|
@@ -6,23 +6,29 @@ import { eventStopPropagation } from '../../utils';
|
|
|
6
6
|
import context from '../../context';
|
|
7
7
|
import intl from '../../intl';
|
|
8
8
|
import Icon from '../icon';
|
|
9
|
+
import useForceUpdate from './use-force-update';
|
|
9
10
|
import './index.css';
|
|
10
11
|
const TypesDialog = _ref => {
|
|
11
12
|
let {
|
|
12
13
|
type,
|
|
14
|
+
lang,
|
|
13
15
|
onToggle: propsOnToggle,
|
|
14
16
|
onChange
|
|
15
17
|
} = _ref;
|
|
16
18
|
const [currentCatIndex, setCurrentCatIndex] = useState(0);
|
|
17
19
|
const [selectedType, setType] = useState(type);
|
|
18
20
|
const seaChartTypeContainerRef = useRef(null);
|
|
21
|
+
const forceUpdate = useForceUpdate();
|
|
19
22
|
const notSupportStatisticTypes = useMemo(() => {
|
|
20
23
|
const lang = context.getSetting('lang');
|
|
21
24
|
return lang !== 'zh-cn' ? ZH_CN_SUPPORT_CHARTS : [];
|
|
22
25
|
}, []);
|
|
23
26
|
useEffect(() => {
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
if (lang) {
|
|
28
|
+
intl.setLang(lang);
|
|
29
|
+
forceUpdate();
|
|
30
|
+
}
|
|
31
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
26
32
|
}, []);
|
|
27
33
|
useEffect(() => {
|
|
28
34
|
const selectStatisticIndex = CHART_TYPES.findIndex(item => item.children.includes(type));
|
package/dist/constants/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import { CHART_TYPE, CHART_TYPE_SHOW, CHART_TYPES } from './type';
|
|
|
6
6
|
import { CHART_TYPE_IMAGE } from './type-image';
|
|
7
7
|
import { regions } from './regions';
|
|
8
8
|
import { TABLE_DIMENSIONS } from './table';
|
|
9
|
+
export const DEFAULT_LANG = 'en';
|
|
9
10
|
export const TREND_TYPES = {
|
|
10
11
|
UP: 'up',
|
|
11
12
|
DOWN: 'down',
|
package/dist/intl.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { setLocale } from 'dtable-ui-component/lib/lang';
|
|
2
2
|
import LOCALES from './locale';
|
|
3
|
+
import { DEFAULT_LANG } from './constants';
|
|
3
4
|
class Intl {
|
|
4
5
|
constructor(_ref) {
|
|
5
6
|
var _this = this;
|
|
6
7
|
let {
|
|
7
|
-
lang: _lang =
|
|
8
|
+
lang: _lang = DEFAULT_LANG
|
|
8
9
|
} = _ref;
|
|
9
10
|
this.setLang = function () {
|
|
10
|
-
let lang = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] :
|
|
11
|
+
let lang = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_LANG;
|
|
11
12
|
const validLang = lang.toLowerCase();
|
|
12
13
|
setLocale(validLang);
|
|
13
14
|
if (validLang === _this.lang) return;
|
|
14
15
|
_this.lang = validLang;
|
|
15
|
-
_this.translation = LOCALES[_this.lang]
|
|
16
|
+
_this.translation = LOCALES[_this.lang];
|
|
16
17
|
};
|
|
17
18
|
this.get = function (key) {
|
|
18
19
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
@@ -30,10 +31,10 @@ class Intl {
|
|
|
30
31
|
}) || key;
|
|
31
32
|
};
|
|
32
33
|
this.lang = _lang.toLowerCase();
|
|
33
|
-
this.translation = LOCALES[this.lang]
|
|
34
|
+
this.translation = LOCALES[this.lang];
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
const intl = new Intl({
|
|
37
|
-
lang:
|
|
38
|
+
lang: DEFAULT_LANG
|
|
38
39
|
});
|
|
39
40
|
export default intl;
|
package/dist/locale/lang/de.js
CHANGED
|
@@ -252,6 +252,7 @@ const de = {
|
|
|
252
252
|
"Use_colors_in_single_select_solumn": "Verwenden Sie Farben in einer einzelnen Auswahlspalte",
|
|
253
253
|
"Search_records": "Einträge suchen",
|
|
254
254
|
"Please_select_a_grouping_column": "Bitte Gruppierungsspalte auswählen",
|
|
255
|
-
"View": "Sicht"
|
|
255
|
+
"View": "Sicht",
|
|
256
|
+
"All_charts": "All charts"
|
|
256
257
|
};
|
|
257
258
|
export default de;
|
package/dist/locale/lang/en.js
CHANGED
|
@@ -252,6 +252,7 @@ const en = {
|
|
|
252
252
|
"Use_colors_in_single_select_solumn": "Use colors in single select column",
|
|
253
253
|
"Search_records": "Search records",
|
|
254
254
|
"Please_select_a_grouping_column": "Please select grouping column",
|
|
255
|
-
"View": "View"
|
|
255
|
+
"View": "View",
|
|
256
|
+
"All_charts": "All charts"
|
|
256
257
|
};
|
|
257
258
|
export default en;
|
package/dist/locale/lang/es.js
CHANGED
|
@@ -252,6 +252,7 @@ const es = {
|
|
|
252
252
|
"Use_colors_in_single_select_solumn": "Use colors in single select column",
|
|
253
253
|
"Search_records": "Search records",
|
|
254
254
|
"Please_select_a_grouping_column": "Please select grouping column",
|
|
255
|
-
"View": "View"
|
|
255
|
+
"View": "View",
|
|
256
|
+
"All_charts": "All charts"
|
|
256
257
|
};
|
|
257
258
|
export default es;
|
package/dist/locale/lang/fr.js
CHANGED
|
@@ -252,6 +252,7 @@ const fr = {
|
|
|
252
252
|
"Use_colors_in_single_select_solumn": "Utiliser les couleurs dans une colonne de sélection unique",
|
|
253
253
|
"Search_records": "Rechercher des enregistrements",
|
|
254
254
|
"Please_select_a_grouping_column": "Veuillez sélectionner la colonne de regroupement",
|
|
255
|
-
"View": "Voir"
|
|
255
|
+
"View": "Voir",
|
|
256
|
+
"All_charts": "All charts"
|
|
256
257
|
};
|
|
257
258
|
export default fr;
|
package/dist/locale/lang/pt.js
CHANGED
|
@@ -252,6 +252,7 @@ const pt = {
|
|
|
252
252
|
"Use_colors_in_single_select_solumn": "Use colors in single select column",
|
|
253
253
|
"Search_records": "Search records",
|
|
254
254
|
"Please_select_a_grouping_column": "Please select grouping column",
|
|
255
|
-
"View": "View"
|
|
255
|
+
"View": "View",
|
|
256
|
+
"All_charts": "All charts"
|
|
256
257
|
};
|
|
257
258
|
export default pt;
|
package/dist/locale/lang/ru.js
CHANGED
|
@@ -252,6 +252,7 @@ const ru = {
|
|
|
252
252
|
"Use_colors_in_single_select_solumn": "Use colors in single select column",
|
|
253
253
|
"Search_records": "Search records",
|
|
254
254
|
"Please_select_a_grouping_column": "Please select grouping column",
|
|
255
|
-
"View": "View"
|
|
255
|
+
"View": "View",
|
|
256
|
+
"All_charts": "All charts"
|
|
256
257
|
};
|
|
257
258
|
export default ru;
|
|
@@ -662,9 +662,9 @@ BaseUtils.updateTableViewListItemNameAndColor = (result, column, nameKey, colorK
|
|
|
662
662
|
}
|
|
663
663
|
}
|
|
664
664
|
};
|
|
665
|
-
BaseUtils.updateTableViewList = (result, column, nameKey, colorKey,
|
|
665
|
+
BaseUtils.updateTableViewList = (result, column, nameKey, colorKey, isScatterChart) => {
|
|
666
666
|
result.forEach(result => {
|
|
667
|
-
_BaseUtils.updateTableViewListItemNameAndColor(result, column, nameKey, colorKey,
|
|
667
|
+
_BaseUtils.updateTableViewListItemNameAndColor(result, column, nameKey, colorKey, isScatterChart);
|
|
668
668
|
});
|
|
669
669
|
};
|
|
670
670
|
// sort chart
|
package/dist/view/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import intl from '../intl';
|
|
|
7
7
|
import eventBus from '../utils/event-bus';
|
|
8
8
|
import { Loading } from '../components';
|
|
9
9
|
import { ChartUtils, BaseUtils } from '../utils/chart-utils';
|
|
10
|
-
import { THEME_NAME_MAP } from '../constants';
|
|
10
|
+
import { DEFAULT_LANG, THEME_NAME_MAP } from '../constants';
|
|
11
11
|
import { CommonEventTypes } from '../constants/common-constants';
|
|
12
12
|
import Wrapper from './wrapper';
|
|
13
13
|
import Title from './title';
|
|
@@ -107,7 +107,7 @@ class View extends React.PureComponent {
|
|
|
107
107
|
};
|
|
108
108
|
context.init(props);
|
|
109
109
|
props.onViewRef && props.onViewRef(this);
|
|
110
|
-
const lang = context.getSetting('lang') ||
|
|
110
|
+
const lang = context.getSetting('lang') || DEFAULT_LANG;
|
|
111
111
|
intl.setLang(lang);
|
|
112
112
|
}
|
|
113
113
|
componentDidMount() {
|