Skip to content

Commit 0f89064

Browse files
committed
sync with react-script-antd
1 parent afc0223 commit 0f89064

Some content is hidden

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

64 files changed

+2334
-1901
lines changed

config-overrides.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@ module.exports = function override(config, env) {
66
config = injectBabelPlugin('transform-decorators-legacy', config);
77
config = injectBabelPlugin(['import', { libraryName: 'antd', style: true }], config);
88

9-
config.externals = {
10-
"g2": "G2",
11-
"g-cloud": "Cloud",
12-
"g2-plugin-slider": "G2.Plugin.slider"
13-
}
14-
159
return rewireLess.withLoaderOptions(
1610
`${env === 'production' ? 'app' : '[local]'}-[hash:base64:8]`,
1711
{

package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,21 @@
33
"version": "0.3.1",
44
"private": true,
55
"dependencies": {
6+
"@antv/data-set": "^0.8.3",
67
"antd": "^3.0.3",
8+
"bizcharts": "^3.1.0-beta.6",
9+
"bizcharts-plugin-slider": "^2.0.1",
710
"classnames": "^2.2.5",
811
"dva": "^2.1.0",
912
"enquire-js": "^0.1.1",
13+
"fastclick": "^1.0.6",
1014
"history": "^4.7.2",
1115
"less": "^2.7.3",
1216
"lodash": "^4.17.4",
1317
"lodash-decorators": "^4.5.0",
14-
"lodash.clonedeep": "^4.5.0",
1518
"moment": "^2.20.1",
1619
"numeral": "^2.0.6",
20+
"omit.js": "^1.0.0",
1721
"postcss-less": "^1.1.3",
1822
"prop-types": "^15.6.0",
1923
"qs": "^6.5.1",
@@ -23,8 +27,7 @@
2327
"react-document-title": "^2.0.3",
2428
"react-dom": "^16.2.0",
2529
"react-fittext": "^1.0.0",
26-
"react-scripts": "1.0.17",
27-
"redbox-react": "^1.5.0"
30+
"react-scripts": "1.0.17"
2831
},
2932
"scripts": {
3033
"start": "react-app-rewired start",

public/index.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,5 @@
3737
To begin the development, run `npm start` or `yarn start`.
3838
To create a production bundle, use `npm run build` or `yarn build`.
3939
-->
40-
<script src="https://gw.alipayobjects.com/as/g/??datavis/g2/2.3.12/index.js,datavis/g-cloud/1.0.2/index.js,datavis/g2-plugin-slider/1.2.1/slider.js"></script>
4140
</body>
4241
</html>

src/__mocks__/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export default {
6969
'GET /api/tags': () => {
7070
return Mock.mock({
7171
'list|100': [{ name: '@city', 'value|1-100': 150, 'type|0-2': 1 }]
72-
}).list;
72+
});
7373
},
7474
'GET /api/fake_list': getFakeList,
7575
'GET /api/fake_chart_data': () => getFakeChartData,

src/common/menu.js

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -115,22 +115,16 @@ const menuData = [{
115115
}];
116116

117117
function formatter(data, parentPath = '') {
118-
const list = [];
119-
data.forEach((item) => {
118+
return data.map((item) => {
119+
const result = {
120+
...item,
121+
path: `${parentPath}${item.path}`,
122+
};
120123
if (item.children) {
121-
list.push({
122-
...item,
123-
path: `${parentPath}${item.path}`,
124-
children: formatter(item.children, `${parentPath}${item.path}/`),
125-
});
126-
} else {
127-
list.push({
128-
...item,
129-
path: `${parentPath}${item.path}`,
130-
});
124+
result.children = formatter(item.children, `${parentPath}${item.path}/`);
131125
}
126+
return result;
132127
});
133-
return list;
134128
}
135129

136130
export const getMenuData = () => formatter(menuData);

src/common/router.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,10 @@ const dynamicWrapper = (app, models, component) => dynamic({
99
models: () => models.filter(m => !app._models.some(({ namespace }) => namespace === m)).map(m => import(`../models/${m}.js`)),
1010
// add routerData prop
1111
component: () => {
12-
const p = component();
13-
return new Promise((resolve, reject) => {
14-
p.then((raw) => {
15-
const Comp = raw.default || raw;
16-
resolve(props => <Comp {...props} routerData={getRouterData(app)} />);
17-
}).catch(err => reject(err));
12+
const routerData = getRouterData(app);
13+
return component().then((raw) => {
14+
const Component = raw.default || raw;
15+
return props => <Component {...props} routerData={routerData} />;
1816
});
1917
},
2018
});
@@ -54,6 +52,9 @@ export const getRouterData = (app) => {
5452
'/form/step-form': {
5553
component: dynamicWrapper(app, ['form'], () => import('../routes/Forms/StepForm')),
5654
},
55+
'/form/step-form/info': {
56+
component: dynamicWrapper(app, ['form'], () => import('../routes/Forms/StepForm/Step1')),
57+
},
5758
'/form/step-form/confirm': {
5859
component: dynamicWrapper(app, ['form'], () => import('../routes/Forms/StepForm/Step2')),
5960
},

src/components/ActiveChart/index.js

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { PureComponent } from 'react';
1+
import React, { Component } from 'react';
22

33
import { MiniArea } from '../Charts';
44
import NumberInfo from '../NumberInfo';
@@ -14,16 +14,16 @@ function getActiveData() {
1414
for (let i = 0; i < 24; i += 1) {
1515
activeData.push({
1616
x: `${fixedZero(i)}:00`,
17-
y: (i * 50) + (Math.floor(Math.random() * 200)),
17+
y: Math.floor(Math.random() * 200) + (i * 50),
1818
});
1919
}
2020
return activeData;
2121
}
2222

23-
export default class ActiveChart extends PureComponent {
23+
export default class ActiveChart extends Component {
2424
state = {
2525
activeData: getActiveData(),
26-
}
26+
};
2727

2828
componentDidMount() {
2929
this.timer = setInterval(() => {
@@ -42,43 +42,40 @@ export default class ActiveChart extends PureComponent {
4242

4343
return (
4444
<div className={styles.activeChart}>
45-
<NumberInfo
46-
subTitle="目标评估"
47-
total="有望达到预期"
48-
/>
45+
<NumberInfo subTitle="目标评估" total="有望达到预期" />
4946
<div style={{ marginTop: 32 }}>
5047
<MiniArea
5148
animate={false}
5249
line
5350
borderWidth={2}
5451
height={84}
52+
scale={{
53+
y: {
54+
tickCount: 3,
55+
},
56+
}}
5557
yAxis={{
56-
tickCount: 3,
5758
tickLine: false,
58-
labels: false,
59+
label: false,
5960
title: false,
6061
line: false,
6162
}}
6263
data={activeData}
6364
/>
6465
</div>
65-
{
66-
activeData && (
67-
<div className={styles.activeChartGrid}>
68-
<p>{[...activeData].sort()[activeData.length - 1].y + 200} 亿元</p>
69-
<p>{[...activeData].sort()[Math.floor(activeData.length / 2)].y} 亿元</p>
70-
</div>
71-
)
72-
}
73-
{
74-
activeData && (
75-
<div className={styles.activeChartLegend}>
76-
<span>00:00</span>
77-
<span>{activeData[Math.floor(activeData.length / 2)].x}</span>
78-
<span>{activeData[activeData.length - 1].x}</span>
79-
</div>
80-
)
81-
}
66+
{activeData && (
67+
<div className={styles.activeChartGrid}>
68+
<p>{[...activeData].sort()[activeData.length - 1].y + 200} 亿元</p>
69+
<p>{[...activeData].sort()[Math.floor(activeData.length / 2)].y} 亿元</p>
70+
</div>
71+
)}
72+
{activeData && (
73+
<div className={styles.activeChartLegend}>
74+
<span>00:00</span>
75+
<span>{activeData[Math.floor(activeData.length / 2)].x}</span>
76+
<span>{activeData[activeData.length - 1].x}</span>
77+
</div>
78+
)}
8279
</div>
8380
);
8481
}

src/components/Charts/Bar/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as React from "react";
22
export interface BarProps {
33
title: React.ReactNode;
44
color?: string;
5-
margin?: [number, number, number, number];
5+
padding?: [number, number, number, number];
66
height: number;
77
data: Array<{
88
x: string;

0 commit comments

Comments
 (0)