Skip to content

Commit

Permalink
fix: father build error
Browse files Browse the repository at this point in the history
  • Loading branch information
hang319 committed Mar 30, 2021
1 parent a726731 commit 78248a7
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 18 deletions.
5 changes: 3 additions & 2 deletions .fatherrc.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export default {
esm: 'rollup',
cjs: 'rollup',
esm: 'babel',
cjs: 'babel',
disableTypeCheck: true,
cssModules: false,
};
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
# production
/dist
/docs-dist
/es
/lib

# misc
.DS_Store
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"test:coverage": "umi-test --coverage",
"newc": "node scripts/createPlusTemplate.js"
},
"main": "dist/index.js",
"module": "dist/index.esm.js",
"main": "lib/index.js",
"module": "es/index.esm.js",
"typings": "dist/index.d.ts",
"gitHooks": {
"pre-commit": "lint-staged",
Expand All @@ -38,7 +38,7 @@
"react": "^16.12.0"
},
"dependencies": {
"@alitajs/f2": "^0.0.5",
"@alitajs/f2": "0.0.5",
"@alitajs/theme": "^0.0.5",
"@alitajs/tracker": "^0.0.3",
"sitemap": "^6.3.3"
Expand Down
22 changes: 9 additions & 13 deletions src/Column/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,8 @@ import {
Geometry,
Tooltip,
Legend,
Coordinate,
Axis,
Guide,
px2hd,
PieLabel,
getPercentage,
Interaction,
} from '@alitajs/f2';
import { ChartProps } from '@alitajs/f2/dist/Chart';
Expand Down Expand Up @@ -70,7 +66,7 @@ const Donut: React.FC<ColumnProps> = props => {
let checked = data[0][xName];
let attributeIndex = 0;
const findAttributeTemp = data[0][x];
const chartRef = useRef();
const chartRef = useRef<any>();

data.map(cur => {
if (cur[x] === findAttributeTemp) attributeIndex += 1;
Expand Down Expand Up @@ -149,7 +145,7 @@ const Donut: React.FC<ColumnProps> = props => {
position={`${x}*${y}`}
color={[
color[0],
(attribute, xName) => {
(attribute: any, xName: any) => {
for (let i = 0; i < attributeIndex; i++) {
if (attribute === data[i][yName]) {
if (xName !== checked) {
Expand All @@ -168,7 +164,7 @@ const Donut: React.FC<ColumnProps> = props => {
style={[
yName,
{
radius: at => {
radius: (at: any) => {
const { chart } = chartRef.current;
const data = chart.get('geoms')[0]._attrs.data;
return at === data[data.length - 1].attribute
Expand Down Expand Up @@ -239,7 +235,7 @@ const Donut: React.FC<ColumnProps> = props => {
alwaysShow={true}
custom={true} // 自定义 tooltip 内容框
showTooltipMarker={false}
onChange={obj => {
onChange={(obj: any) => {
const { chart } = chartRef.current;

const legend = chart.get('legendController').legends.bottom[0];
Expand All @@ -251,15 +247,15 @@ const Donut: React.FC<ColumnProps> = props => {
checked = tooltipItems[0].origin.city;

const map: any = {};
legendItems.forEach(function(item) {
legendItems.forEach(function(item: any) {
map[item.name] = _.clone(item);
});
let count = 0;
tooltipItems.forEach(function(item) {
tooltipItems.forEach(function(item: any) {
const value = item.value * 1;
count += value;
});
tooltipItems.forEach(function(item) {
tooltipItems.forEach(function(item: any) {
const name = item.name;
const value = item.value;
const percent = ((value / count) * 100).toFixed(0);
Expand All @@ -278,7 +274,7 @@ const Donut: React.FC<ColumnProps> = props => {

<Axis
field="index"
label={text => {
label={(text: any) => {
return {
fontSize: px2hd(30),
fill: '#AAAAAA',
Expand Down Expand Up @@ -306,7 +302,7 @@ const Donut: React.FC<ColumnProps> = props => {
cancelable={false}
unSelectStyle={false}
selectStyle={false}
onEnd={ev => {
onEnd={() => {
setTimeout(() => {
const { chart } = chartRef.current;
chart.repaint();
Expand Down

0 comments on commit 78248a7

Please sign in to comment.