Skip to content

Commit 462ce81

Browse files
committed
first commit for console-chart
1 parent 0de2f80 commit 462ce81

File tree

100 files changed

+16918
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+16918
-2
lines changed

.babelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": ["@babel/preset-react", "@babel/preset-env"]
3+
}

.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true

.gitignore

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# common
2+
3+
.*
4+
!.*ignore
5+
!.*rc
6+
!.gitattributes
7+
!.aoneci.yml
8+
!.editorconfig
9+
10+
lerna-debug.json
11+
# Logs
12+
logs
13+
*.log*
14+
15+
# Runtime data
16+
pids
17+
*.pid
18+
*.seed
19+
*.pid.lock
20+
21+
# Directory for instrumented libs generated by jscoverage/JSCover
22+
lib-cov
23+
24+
# Coverage directory used by tools like istanbul
25+
coverage
26+
27+
# Dependency directories
28+
bower_components
29+
node_modules/
30+
jspm_packages/
31+
32+
# Compiled binary addons (https://nodejs.org/api/addons.html)
33+
build/Release
34+
lib/
35+
es/
36+
dist/
37+
38+
# TypeScript v1 declaration files
39+
typings/
40+
41+
# Output of 'npm pack'
42+
*.tgz
43+
44+
packages/*/lib/
45+
packages/*/es/
46+
packages/*/dist/

.npmignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.babelrc
2+
.editorconfig
3+
.eslintignore
4+
.eslintrc
5+
.gitignore
6+
lerna.json
7+
rollup.config.js

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Changelog

CONTRIBUTING.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# CONTRIBUTING
2+
3+
## 开发流程
4+
5+
```bash
6+
cd root-package
7+
yarn
8+
npm run build
9+
```

README.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,25 @@
1-
# alibabacloud-console-chart
2-
alibabacloud-console-chart
1+
# Console Chart
2+
3+
> 阿里云控制台业务图表库
4+
5+
旨在提供一款**开箱即用、统一视觉方案**的图表组件库。
6+
7+
## Install
8+
9+
```bash
10+
yarn add @alicloud/console-chart --save
11+
```
12+
13+
## Usage
14+
15+
```js
16+
17+
// 引入组件
18+
import { ConsoleLineChart } from '@alicloud/console-line-chart';
19+
20+
<ConsoleLineChart data={ ...data } config={config} />
21+
```
22+
23+
## Development
24+
25+
代码贡献请参考 [CONTRIBUTING.md](CONTRIBUTING.md)

lerna.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"lerna": "2.11.0",
3+
"useWorkspaces": true,
4+
"npmClient": "yarn",
5+
"packages": [
6+
"packages/console-bar-chart",
7+
"packages/console-chart",
8+
"packages/console-combo-chart",
9+
"packages/console-dot-chart",
10+
"packages/console-funnel-chart",
11+
"packages/console-line-chart",
12+
"packages/console-miniline-chart",
13+
"packages/console-pie-chart",
14+
"packages/console-radar-chart",
15+
"packages/console-rose-chart",
16+
"packages/console-shared-utils"
17+
],
18+
"version": "0.0.1"
19+
}

package.json

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"scripts": {
3+
"clear": "rm -rf node_modules",
4+
"clean": "lerna clean",
5+
"reinstall": "yarn run clear && yarn install",
6+
"lint": "lerna run lint",
7+
"build": "lerna run build",
8+
"dev": "start-storybook -p 9001 -c .storybook ",
9+
"bootstrap": "lerna bootstrap"
10+
},
11+
"husky": {
12+
"hooks": {
13+
"pre-commit": ""
14+
}
15+
},
16+
"private": true,
17+
"workspaces": [
18+
"packages/*"
19+
],
20+
"devDependencies": {
21+
"@babel/cli": "^7.6.4",
22+
"@babel/core": "^7.6.4",
23+
"@babel/preset-env": "^7.6.3",
24+
"@babel/preset-react": "^7.6.3",
25+
"@storybook/react": "^5.2.5",
26+
"@types/react": "^16.9.0",
27+
"@types/react-dom": "^16.8.5",
28+
"babel-loader": "^8.0.6",
29+
"husky": "^1.0.0-rc.13",
30+
"lint-staged": "^8.1.5",
31+
"prettier": "^1.14.0",
32+
"react": "^16.8.6",
33+
"react-dom": "^16.8.6",
34+
"rollup": "1.19.4",
35+
"rollup-plugin-auto-external": "^2.0.0",
36+
"rollup-plugin-babel": "^4.3.3",
37+
"rollup-plugin-commonjs": "^10.0.2",
38+
"rollup-plugin-copy": "^3.1.0",
39+
"rollup-plugin-json": "^4.0.0",
40+
"rollup-plugin-node-resolve": "^5.2.0",
41+
"rollup-plugin-postcss": "^2.0.3",
42+
"rollup-plugin-scss": "^1.0.2",
43+
"rollup-plugin-typescript2": "^0.22.1",
44+
"ts-jest": "^23.10.5",
45+
"tslint": "^5.8.0",
46+
"typescript": "^3.6.2",
47+
"uglifyjs-webpack-plugin": "^2.1.3"
48+
},
49+
"dependencies": {
50+
"tslib": "^1.10.0"
51+
}
52+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import React from 'react';
2+
import { storiesOf } from '@storybook/react';
3+
import Chart from '../es/index.js';
4+
5+
const data = [
6+
{
7+
name: 'Students of course',
8+
data: [['Chinese', 20], ['English', 10], ['Math', 15]],
9+
},
10+
];
11+
const config = {
12+
padding: 20,
13+
};
14+
15+
class A extends React.Component {
16+
state = {
17+
config,
18+
};
19+
20+
componentDidMount() {
21+
setInterval(() => {
22+
const newConfig = { ...config, padding: Math.floor(Math.random() * 100) };
23+
this.setState({ config: newConfig });
24+
}, 2000);
25+
}
26+
render() {
27+
return <Chart data={data} config={this.state.config} height={300} />;
28+
}
29+
}
30+
storiesOf('ConsoleBarChart', module).add('基本用法', () => <A />);
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import React from 'react';
2+
import { storiesOf } from '@storybook/react';
3+
import Chart from '../es/index.js';
4+
5+
const data = [
6+
{
7+
name: '北大',
8+
data: [['语文', 20], ['高数', 10], ['商务英语', 15]],
9+
},
10+
{
11+
name: '清华',
12+
data: [['语文', 18], ['高数', 20], ['商务英语', 16]],
13+
},
14+
];
15+
16+
const config = {
17+
stack: true,
18+
};
19+
storiesOf('ConsoleBarChart', module).add('堆叠柱状图', () => (
20+
<Chart data={data} config={config} height={300} />
21+
));
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "@alicloud/console-bar-chart",
3+
"version": "0.2.2",
4+
"main": "lib/index.js",
5+
"module": "es/index.js",
6+
"files": [
7+
"lib",
8+
"es",
9+
"dist"
10+
],
11+
"scripts": {
12+
"clean-rpt": "rm -rf .rpt2_cache",
13+
"lint": "tslint --project .",
14+
"clean": "rm -rf lib es dist",
15+
"build": "npm run clean && rollup -c",
16+
"prepare": "npm run build",
17+
"watch": "rollup -c -w"
18+
},
19+
"dependencies": {
20+
"@alicloud/console-shared-utils": "^0.2.2",
21+
"tslib": "^1.10.0"
22+
}
23+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import generateRollupConfig, { plugins } from '../../rollup.config';
2+
3+
const { typescript, commonjs, resolve, autoExternal } = plugins;
4+
5+
const pluginsCb = ({ fmt }) => {
6+
if (fmt === 'umd') {
7+
return [typescript({}), resolve(), commonjs()];
8+
} else {
9+
return [typescript({}), resolve(), commonjs(), autoExternal()];
10+
}
11+
};
12+
13+
export default generateRollupConfig({
14+
formatArr: ['es', 'cjs', 'umd'],
15+
input: 'src/index.ts',
16+
plugins: pluginsCb,
17+
});

0 commit comments

Comments
 (0)