mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-07-01 18:52:20 +08:00
feat(data-vi): allow to set link for statistic chart (#5073)
This commit is contained in:
parent
e245da8f29
commit
b9d1604eb8
@ -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<any> = (props: any) => {
|
||||
const { link, ...options } = props;
|
||||
return (
|
||||
<div
|
||||
onClick={() => {
|
||||
if (link) {
|
||||
window.open(link, '__blank');
|
||||
}
|
||||
}}
|
||||
style={{
|
||||
cursor: link ? 'pointer' : 'auto',
|
||||
}}
|
||||
>
|
||||
<AntdStatistic {...options} />
|
||||
</div>
|
||||
);
|
||||
};
|
@ -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',
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user