index.js 1.37 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

const getComponent = Component => {
  return props => {
    return (
Shuai Chen's avatar
Shuai Chen committed
9
      <Suspense fallback="...">
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
        <Component {...props} />
      </Suspense>
    );
  };
};

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')));
26

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

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

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