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 | 6x 90x 90x | import React, { Suspense } from "react"; import { AntdChartWidgetComponentRenderProps, DashboardWidgetComponent, WidgetComponentRenderProps } from "../WidgetComponentsMapping"; const AntdChartWidget = (props: AntdChartWidgetComponentRenderProps): DashboardWidgetComponent => { const { Component, extraProps } = props; return (props: WidgetComponentRenderProps) => { const { dataAndConfigs, widget } = props; const config = JSON.parse(widget.options)?.config ?? {}; //ATTENTION: the merge sequence should be extraProps, config, dataAndConfig //Since the settings on frontend has lowest priority //Then the settings on widget definition //Then the settings returned from widget render core logic const mergedConfigs = { ...extraProps, ...config, ...dataAndConfigs }; return ( <Suspense fallback={<div />}> <Component className="ds-simple-chart" {...mergedConfigs} /> </Suspense> ); }; }; export default AntdChartWidget; |