index.js 1.32 KB
Newer Older
1
import React, { Suspense } from 'react';
2 3
import numeral from 'numeral';
import ChartCard from './ChartCard';
Shuai Chen's avatar
Shuai Chen committed
4
import Field from './Field';
5

6 7 8 9 10
const getComponent = Component => props => (
  <Suspense fallback="...">
    <Component {...props} />
  </Suspense>
);
11 12 13 14 15 16 17 18 19 20 21

const Bar = getComponent(React.lazy(() => import('./Bar')));
const Pie = getComponent(React.lazy(() => import('./Pie')));
const Radar = getComponent(React.lazy(() => import('./Radar')));
const Gauge = getComponent(React.lazy(() => import('./Gauge')));
const MiniArea = getComponent(React.lazy(() => import('./MiniArea')));
const MiniBar = getComponent(React.lazy(() => import('./MiniBar')));
const MiniProgress = getComponent(React.lazy(() => import('./MiniProgress')));
const WaterWave = getComponent(React.lazy(() => import('./WaterWave')));
const TagCloud = getComponent(React.lazy(() => import('./TagCloud')));
const TimelineChart = getComponent(React.lazy(() => import('./TimelineChart')));
22

jim's avatar
jim committed
23
const yuan = val => `Β₯ ${numeral(val).format('0,0')}`;
24

ddcat1115's avatar
ddcat1115 committed
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
const Charts = {
  yuan,
  Bar,
  Pie,
  Gauge,
  Radar,
  MiniBar,
  MiniArea,
  MiniProgress,
  ChartCard,
  Field,
  WaterWave,
  TagCloud,
  TimelineChart,
};

41
export {
ddcat1115's avatar
ddcat1115 committed
42
  Charts as default,
43 44 45 46 47 48 49 50 51 52 53
  yuan,
  Bar,
  Pie,
  Gauge,
  Radar,
  MiniBar,
  MiniArea,
  MiniProgress,
  ChartCard,
  Field,
  WaterWave,
niko's avatar
niko committed
54 55
  TagCloud,
  TimelineChart,
56
};