@gravity-ui/chartkit 0.7.2 → 0.9.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/CHANGELOG.md +19 -0
- package/README.md +1 -1
- package/build/components/ChartKit.css +4 -0
- package/build/components/ChartKit.d.ts +1 -0
- package/build/components/ChartKit.js +2 -2
- package/build/i18n/index.d.ts +1 -1
- package/build/i18n/index.js +1 -1
- package/build/index.d.ts +1 -1
- package/build/libs/settings/__tests__/settings.test.js +17 -0
- package/build/types/index.d.ts +1 -0
- package/package.json +3 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.9.0](https://github.com/gravity-ui/chartkit/compare/v0.8.0...v0.9.0) (2022-11-08)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add isMobile property ([#57](https://github.com/gravity-ui/chartkit/issues/57)) ([a2e87ed](https://github.com/gravity-ui/chartkit/commit/a2e87edf1d05705fb92c2571b5a71496c48d9215))
|
|
9
|
+
|
|
10
|
+
## [0.8.0](https://github.com/gravity-ui/chartkit/compare/v0.7.2...v0.8.0) (2022-10-04)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* move to @gravity-ui/i18n ([#45](https://github.com/gravity-ui/chartkit/issues/45)) ([ad401d8](https://github.com/gravity-ui/chartkit/commit/ad401d85bf50ab4ceb0ae8a837c4b11cd36a4acd))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* add ChartKitOnError type export ([#54](https://github.com/gravity-ui/chartkit/issues/54)) ([7660be7](https://github.com/gravity-ui/chartkit/commit/7660be756cd3ec1057aa9fd4bb45226c9632e80f))
|
|
21
|
+
|
|
3
22
|
## [0.7.2](https://github.com/gravity-ui/chartkit/compare/v0.7.1...v0.7.2) (2022-10-03)
|
|
4
23
|
|
|
5
24
|
|
package/README.md
CHANGED
|
@@ -10,6 +10,7 @@ export declare const ChartKit: <T extends keyof import("../types").ChartkitWidge
|
|
|
10
10
|
type: T;
|
|
11
11
|
data: import("../types").ChartkitWidget[T]["data"];
|
|
12
12
|
id?: string | undefined;
|
|
13
|
+
isMobile?: boolean | undefined;
|
|
13
14
|
onLoad?: ((data?: import("../types").ChartKitOnLoadData<T> | undefined) => void) | undefined;
|
|
14
15
|
onError?: import("../types").ChartKitOnError | undefined;
|
|
15
16
|
formatNumber?: import("../types").ChartKitFormatNumber | undefined;
|
|
@@ -11,7 +11,7 @@ import './ChartKit.css';
|
|
|
11
11
|
const b = block('chartkit');
|
|
12
12
|
const ChartKitComponent = (props) => {
|
|
13
13
|
const widgetRef = React.useRef();
|
|
14
|
-
const { instanceRef, id = getRandomCKId(), type, data, onLoad } = props, restProps = __rest(props, ["instanceRef", "id", "type", "data", "onLoad"]);
|
|
14
|
+
const { instanceRef, id = getRandomCKId(), type, data, onLoad, isMobile } = props, restProps = __rest(props, ["instanceRef", "id", "type", "data", "onLoad", "isMobile"]);
|
|
15
15
|
const lang = settings.get('lang');
|
|
16
16
|
const plugins = settings.get('plugins');
|
|
17
17
|
const plugin = plugins.find((iteratedPlugin) => iteratedPlugin.type === type);
|
|
@@ -31,7 +31,7 @@ const ChartKitComponent = (props) => {
|
|
|
31
31
|
},
|
|
32
32
|
}), []);
|
|
33
33
|
return (React.createElement(React.Suspense, { fallback: React.createElement(Loader, null) },
|
|
34
|
-
React.createElement("div", { className: b() },
|
|
34
|
+
React.createElement("div", { className: b({ mobile: isMobile }) },
|
|
35
35
|
React.createElement(ChartComponent, Object.assign({ ref: widgetRef, id: id, lang: lang, data: data, onLoad: onLoad }, restProps)))));
|
|
36
36
|
};
|
|
37
37
|
const ChartKitComponentWithErrorBoundary = React.forwardRef((props, ref) => {
|
package/build/i18n/index.d.ts
CHANGED
package/build/i18n/index.js
CHANGED
package/build/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ChartKit } from './components/ChartKit';
|
|
2
2
|
import { settings } from './libs';
|
|
3
|
-
export type { ChartKitLang, ChartKitOnLoadData, ChartKitPlugin, ChartKitProps, ChartKitRef, ChartKitWidgetRef, ChartkitType, ChartkitWidget, } from './types';
|
|
3
|
+
export type { ChartKitLang, ChartKitOnLoadData, ChartKitOnError, ChartKitPlugin, ChartKitProps, ChartKitRef, ChartKitWidgetRef, ChartkitType, ChartkitWidget, } from './types';
|
|
4
4
|
export { settings };
|
|
5
5
|
export default ChartKit;
|
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
import { DEFAULT_LOCALE_SPECIFICATION, settings } from '../settings';
|
|
2
|
+
const resetSettings = () => settings.set({
|
|
3
|
+
lang: 'en',
|
|
4
|
+
locale: DEFAULT_LOCALE_SPECIFICATION,
|
|
5
|
+
});
|
|
2
6
|
describe('libs/settings', () => {
|
|
3
7
|
it('Default locale should be equal DEFAULT_LOCALE_SPECIFICATION', () => {
|
|
4
8
|
const result = settings.get('locale');
|
|
5
9
|
expect(result).toBe(DEFAULT_LOCALE_SPECIFICATION);
|
|
6
10
|
});
|
|
11
|
+
it('Default lang should be equal to en', () => {
|
|
12
|
+
const result = settings.get('lang');
|
|
13
|
+
expect(result).toBe('en');
|
|
14
|
+
});
|
|
15
|
+
it('Changed lang should be equal to ru', () => {
|
|
16
|
+
settings.set({
|
|
17
|
+
lang: 'ru',
|
|
18
|
+
});
|
|
19
|
+
const result = settings.get('lang');
|
|
20
|
+
expect(result).toBe('ru');
|
|
21
|
+
});
|
|
22
|
+
beforeAll(resetSettings);
|
|
23
|
+
afterEach(resetSettings);
|
|
7
24
|
});
|
package/build/types/index.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export declare type ChartKitProps<T extends ChartkitType> = {
|
|
|
20
20
|
type: T;
|
|
21
21
|
data: ChartkitWidget[T]['data'];
|
|
22
22
|
id?: string;
|
|
23
|
+
isMobile?: boolean;
|
|
23
24
|
onLoad?: (data?: ChartKitOnLoadData<T>) => void;
|
|
24
25
|
onError?: ChartKitOnError;
|
|
25
26
|
formatNumber?: ChartKitFormatNumber;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravity-ui/chartkit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "React component used to render charts based on any sources you need",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "git@github.com:gravity-ui/ChartKit.git",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@gravity-ui/eslint-config": "^1.0.2",
|
|
22
|
+
"@gravity-ui/i18n": "^1.0.0",
|
|
22
23
|
"@gravity-ui/prettier-config": "^1.0.1",
|
|
23
24
|
"@gravity-ui/stylelint-config": "^1.0.1",
|
|
24
25
|
"@gravity-ui/tsconfig": "^1.0.0",
|
|
@@ -33,7 +34,6 @@
|
|
|
33
34
|
"@types/react": "^17.0.48",
|
|
34
35
|
"@types/react-dom": "^17.0.17",
|
|
35
36
|
"@typescript-eslint/eslint-plugin": "^5.31.0",
|
|
36
|
-
"@yandex-cloud/i18n": "^0.5.0",
|
|
37
37
|
"eslint": "^8.11.0",
|
|
38
38
|
"gulp": "^4.0.2",
|
|
39
39
|
"gulp-cli": "^2.3.0",
|
|
@@ -59,8 +59,7 @@
|
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"react": "^16.0.0 || ^17.0.0",
|
|
61
61
|
"moment": "^2.19.3",
|
|
62
|
-
"@gravity-ui/uikit": "^3.0.0"
|
|
63
|
-
"@yandex-cloud/i18n": "^0.5.0"
|
|
62
|
+
"@gravity-ui/uikit": "^3.0.0"
|
|
64
63
|
},
|
|
65
64
|
"scripts": {
|
|
66
65
|
"test": "jest",
|