mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 13:39:24 +08:00
chore(data-vi): adjust api (#4116)
This commit is contained in:
parent
c43a6e98d5
commit
b12fe0981f
@ -1,9 +1,9 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { FieldOption } from '../hooks';
|
import { FieldOption } from '../hooks';
|
||||||
import { QueryProps } from '../renderer';
|
import { DimensionProps, MeasureProps, QueryProps } from '../renderer';
|
||||||
import { parseField } from '../utils';
|
import { parseField } from '../utils';
|
||||||
import { ISchema } from '@formily/react';
|
import { ISchema } from '@formily/react';
|
||||||
import configs, { AnySchemaProperties, Config } from './configs';
|
import configs, { AnySchemaProperties, Config, FieldConfigProps } from './configs';
|
||||||
import { Transformer } from '../transformers';
|
import { Transformer } from '../transformers';
|
||||||
|
|
||||||
export type RenderProps = {
|
export type RenderProps = {
|
||||||
@ -27,8 +27,8 @@ export interface ChartType {
|
|||||||
init?: (
|
init?: (
|
||||||
fields: FieldOption[],
|
fields: FieldOption[],
|
||||||
query: {
|
query: {
|
||||||
measures?: QueryProps['measures'];
|
measures?: MeasureProps[];
|
||||||
dimensions?: QueryProps['dimensions'];
|
dimensions?: DimensionProps[];
|
||||||
},
|
},
|
||||||
) => {
|
) => {
|
||||||
general?: any;
|
general?: any;
|
||||||
@ -102,7 +102,7 @@ export class Chart implements ChartType {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
addConfigs(configs: { [key: string]: Function }) {
|
addConfigs(configs: { [key: string]: (props: FieldConfigProps) => AnySchemaProperties }) {
|
||||||
Object.entries(configs).forEach(([key, func]) => {
|
Object.entries(configs).forEach(([key, func]) => {
|
||||||
this.configs.set(key, func);
|
this.configs.set(key, func);
|
||||||
});
|
});
|
||||||
@ -114,8 +114,8 @@ export class Chart implements ChartType {
|
|||||||
measures,
|
measures,
|
||||||
dimensions,
|
dimensions,
|
||||||
}: {
|
}: {
|
||||||
measures?: QueryProps['measures'];
|
measures?: MeasureProps[];
|
||||||
dimensions?: QueryProps['dimensions'];
|
dimensions?: DimensionProps[];
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
let xField: FieldOption;
|
let xField: FieldOption;
|
||||||
|
@ -206,7 +206,16 @@ const transformers: {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
Exponential: (val: number | string) => (+val)?.toExponential(),
|
Exponential: (val: number | string) => (+val)?.toExponential(),
|
||||||
Abbreviation: (val: number, locale = 'en-US') => new Intl.NumberFormat(locale, { notation: 'compact' }).format(val),
|
Abbreviation: {
|
||||||
|
schema: {
|
||||||
|
'x-component': 'Select',
|
||||||
|
enum: [
|
||||||
|
{ label: 'en-US', value: 'en-US' },
|
||||||
|
{ label: 'zh-CN', value: 'zh-CN' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
fn: (val: number, locale = 'en-US') => new Intl.NumberFormat(locale, { notation: 'compact' }).format(val),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
string: {
|
string: {
|
||||||
'Type conversion': {
|
'Type conversion': {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user