Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x | import React from "react"; import { DashboardWidgetType } from "@props/RecordProps"; import { PrimaryColor } from '@config/base'; import { ReactElement } from "react"; import { WidgetComponentRenderProps } from "./WidgetComponentsMapping"; import { AntdChartWidget, DataTableWidget, MarkdownWidget, StatisticWidget, CountdownWidget, HtmlWidget } from "./widgets"; const Bar = React.lazy(() => import('../../components/wrap/BarWrap')); const Area = React.lazy(() => import('../../components/wrap/AreaWrap')); const Line = React.lazy(() => import('../../components/wrap/LineWrap')); const Column = React.lazy(() => import('../../components/wrap/ColumnWrap')); const Pie = React.lazy(() => import('../../components/wrap/PieWrap')); const Gauge = React.lazy(() => import('../../components/wrap/GaugeWrap')); const Liquid = React.lazy(() => import('../../components/wrap/LiquidWrap')); const Bullet = React.lazy(() => import('../../components/wrap/BulletWrap')); const Progress = React.lazy(() => import('../../components/wrap/ProgressWrap')); const RingProgress = React.lazy(() => import('../../components/wrap/RingProgressWrap')); const TinyArea = React.lazy(() => import('../../components/wrap/TinyAreaWrap')); const TinyLine = React.lazy(() => import('../../components/wrap/TinyLineWrap')); const TinyColumn = React.lazy(() => import('../../components/wrap/TinyColumnWrap')); const BidirectionalBar = React.lazy(() => import('../../components/wrap/BidirectionalBarWrap')); const Histogram = React.lazy(() => import('../../components/wrap/HistogramWrap')); export interface WidgetConfigProps { type: DashboardWidgetType; component: (props: WidgetComponentRenderProps) => ReactElement; } // 图表中的默认填充色 const defaultFillColor = "#ECE3F6"; // 图表中的默认坐标轴颜色 const defaultStrokeColor = '#D0D0D0'; // 图表中的默认显示颜色 const defaultExtraProps = { color: PrimaryColor }; export const WidgetConfigures: Array<WidgetConfigProps> = [ { type: "STATISTIC", component: StatisticWidget }, { type: "HTML", component: HtmlWidget}, { type: "MARKDOWN", component: MarkdownWidget }, { type: "DATA_TABLE", component: DataTableWidget }, { type: "COUNTDOWN", component: CountdownWidget }, { type: "GAUGE_CHART", component: AntdChartWidget({ // eslint-disable-next-line @typescript-eslint/ban-ts-comment //@ts-ignore Component: Gauge, extraProps: { range: { color: `l(0) 0:${defaultFillColor} 1:${PrimaryColor}` }, indicator: { pointer: { style: { stroke: defaultStrokeColor } }, pin: { style: { stroke: defaultStrokeColor } }, }, statistic: { content: { style: { fontSize: '18px', lineHeight: '18px', }, }, }, style: { textContent: (target: number, total: number) => `${Math.round((target / total) * 10000) / 100}%`, }, } }) }, // eslint-disable-next-line @typescript-eslint/ban-ts-comment //@ts-ignore { type: "LIQUID_CHART", component: AntdChartWidget({ Component: Liquid, extraProps: { color: "#B8E2FC" } }) }, // eslint-disable-next-line @typescript-eslint/ban-ts-comment //@ts-ignore { type: "LINE_CHART", component: AntdChartWidget({ Component: Line, extraProps: defaultExtraProps }) }, // eslint-disable-next-line @typescript-eslint/ban-ts-comment //@ts-ignore { type: "AREA_CHART", component: AntdChartWidget({ Component: Area, extraProps: defaultExtraProps }) }, // eslint-disable-next-line @typescript-eslint/ban-ts-comment //@ts-ignore { type: "BAR_CHART", component: AntdChartWidget({ Component: Bar }) }, // eslint-disable-next-line @typescript-eslint/ban-ts-comment //@ts-ignore { type: "COLUMN_CHART", component: AntdChartWidget({ Component: Column, extraProps: defaultExtraProps }) }, // eslint-disable-next-line @typescript-eslint/ban-ts-comment //@ts-ignore { type: "PIE_CHART", component: AntdChartWidget({ Component: Pie }) }, { type: "BULLET_CHART", component: AntdChartWidget({ // eslint-disable-next-line @typescript-eslint/ban-ts-comment //@ts-ignore Component: Bullet, extraProps: { color: { range: '#f0efff', measure: PrimaryColor, target: '#3D76DD', }, } }) }, { type: "PROGRESS_CHART", component: AntdChartWidget({ // eslint-disable-next-line @typescript-eslint/ban-ts-comment //@ts-ignore Component: Progress, extraProps: { color: [PrimaryColor, '#E8EDF3'], style: { marginTop: "46%" } } }) }, { type: "RING_PROGRESS_CHART", component: AntdChartWidget({ // eslint-disable-next-line @typescript-eslint/ban-ts-comment //@ts-ignore Component: RingProgress, extraProps: { color: [PrimaryColor, '#E8EDF3'], statistic: { title: { style: { color: PrimaryColor, fontSize: '12px', lineHeight: '14px', }, formatter: function formatter() { return '进度'; }, }, }, } }) }, { type: "TINY_AREA_CHART", component: AntdChartWidget({ // eslint-disable-next-line @typescript-eslint/ban-ts-comment //@ts-ignore Component: TinyArea, extraProps: { autoFit: true, smooth: true, areaStyle: { fill: defaultFillColor }, line: { ...defaultExtraProps }, } }) }, { type: "TINY_LINE_CHART", component: AntdChartWidget({ // eslint-disable-next-line @typescript-eslint/ban-ts-comment //@ts-ignore Component: TinyLine, extraProps: { autoFit: true, smooth: true, ...defaultExtraProps } }) }, { type: "TINY_COLUMN_CHART", component: AntdChartWidget({ // eslint-disable-next-line @typescript-eslint/ban-ts-comment //@ts-ignore Component: TinyColumn, extraProps: { autoFit: true, ...defaultExtraProps, tooltip: { // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any customContent: function customContent(x: number, data: any) { return data?.[0]?.data?.y?.toFixed(2); } }, } }) }, { type: "BI_DIRECTION_BAR", component: AntdChartWidget({ // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore Component: BidirectionalBar, extraProps: { xAxis: { position: 'bottom' }, interactions: [{ type: 'active-region' }], tooltip: { shared: true, showMarkers: true } } }) }, { type: "HISTOGRAM", component: AntdChartWidget({ // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore Component: Histogram, extraProps: { binField: 'value', binWidth: 2, tooltip: { showMarkers: true, position: 'top', }, interactions: [{ type: 'element-highlight' }], color: PrimaryColor, } }) } ]; |