diff --git a/packages/plugins/@nocobase/plugin-data-visualization/src/client/chart/antd/components/Statistic.tsx b/packages/plugins/@nocobase/plugin-data-visualization/src/client/chart/antd/components/Statistic.tsx new file mode 100644 index 0000000000..f0ef40929f --- /dev/null +++ b/packages/plugins/@nocobase/plugin-data-visualization/src/client/chart/antd/components/Statistic.tsx @@ -0,0 +1,29 @@ +/** + * This file is part of the NocoBase (R) project. + * Copyright (c) 2020-2024 NocoBase Co., Ltd. + * Authors: NocoBase Team. + * + * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License. + * For more information, please refer to: https://www.nocobase.com/agreement. + */ + +import React from 'react'; +import { Statistic as AntdStatistic } from 'antd'; + +export const Statistic: React.FC = (props: any) => { + const { link, ...options } = props; + return ( +
{ + if (link) { + window.open(link, '__blank'); + } + }} + style={{ + cursor: link ? 'pointer' : 'auto', + }} + > + +
+ ); +}; diff --git a/packages/plugins/@nocobase/plugin-data-visualization/src/client/chart/antd/statistic.ts b/packages/plugins/@nocobase/plugin-data-visualization/src/client/chart/antd/statistic.ts index 0e43338944..12eb95e32c 100644 --- a/packages/plugins/@nocobase/plugin-data-visualization/src/client/chart/antd/statistic.ts +++ b/packages/plugins/@nocobase/plugin-data-visualization/src/client/chart/antd/statistic.ts @@ -8,16 +8,16 @@ */ import { AntdChart } from './antd'; -import { Statistic as AntdStatistic } from 'antd'; import { lang } from '../../locale'; import { ChartType, RenderProps } from '../chart'; +import { Statistic as C } from './components/Statistic'; export class Statistic extends AntdChart { constructor() { super({ name: 'statistic', title: 'Statistic', - Component: AntdStatistic, + Component: C, config: [ { property: 'field', @@ -33,6 +33,14 @@ export class Statistic extends AntdChart { 'x-component': 'Input', }, }, + { + link: { + title: lang('Link'), + type: 'string', + 'x-decorator': 'FormItem', + 'x-component': 'Input', + }, + }, ], }); }