@advt-gpt-chart/package 3.1.8 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,5 @@
1
1
  import { ICartesianAxisSpec, InterpolateType } from '@visactor/vchart';
2
+ import { GenericDataType } from '../../utils/data';
2
3
  import { AxesType } from './utils';
3
4
  type CartesianOptions = {
4
5
  xField: string;
@@ -33,6 +34,7 @@ type CompositeAxisSpec = {
33
34
  export type Tools = {
34
35
  formatValue: (field: string, value: any) => any;
35
36
  getAxesType: (field: string) => 'band' | 'linear';
37
+ getFieldType: (fieldName: string, value?: any) => GenericDataType | undefined;
36
38
  };
37
39
  export declare const getPolarLegendSpec: (seriesField: string | boolean | undefined, categoryField: string, tools?: Tools) => {
38
40
  visible: boolean;
@@ -1,12 +1,5 @@
1
1
  import { AxisType } from '@visactor/vchart/esm/component/axis';
2
- export declare enum GenericDataType {
3
- Number = 0,
4
- String = 1,
5
- Timestamp = 2,
6
- Date = 3,
7
- Boolean = 4,
8
- Other = 5
9
- }
2
+ import { GenericDataType } from '../../utils/data';
10
3
  export declare const getDataType: (val: any, field?: string) => GenericDataType;
11
4
  export type AxesType = {
12
5
  axisType: AxisType;
@@ -1,9 +1,11 @@
1
1
  import type { BaseVChartConfig, BaseVChartProps, DataItem } from '../../types';
2
+ import type { DashSegment } from '../common/types';
2
3
  export type LineDataItem = DataItem & {};
3
4
  export type LineConfig = BaseVChartConfig & {
4
5
  xField?: string;
5
6
  yField?: string;
6
7
  metrics?: string[];
7
8
  dimensions?: string[];
9
+ dashSegments?: DashSegment[];
8
10
  };
9
11
  export type LineProps = BaseVChartProps & Partial<LineConfig>;
@@ -1,10 +1,42 @@
1
1
  import type { BaseChartProps, DataItem } from '../../types';
2
2
  import { CommonGlobalConfig } from '../../types/config';
3
3
  export type TableDataItem = DataItem & {};
4
+ export interface CellMergeConfig {
5
+ /** 列名或列索引 */
6
+ column: string | number;
7
+ /** 合并后显示的内容 */
8
+ content: string;
9
+ /**
10
+ * 合并类型(v3 扩展字段,v1 暂不实现)
11
+ * - 'all': 整列合并(v1 默认)
12
+ * - 'range': 范围合并(v2 支持)
13
+ * - 'group': 分组合并(v3 支持)
14
+ */
15
+ type?: 'all' | 'range' | 'group';
16
+ /**
17
+ * 合并范围(v2 扩展字段,v1 暂不实现)
18
+ * type 为 'range' 时使用
19
+ */
20
+ range?: {
21
+ startRow: number;
22
+ endRow: number;
23
+ };
24
+ /**
25
+ * 分组字段(v3 扩展字段,v1 暂不实现)
26
+ * type 为 'group' 时使用
27
+ */
28
+ groupBy?: string;
29
+ /**
30
+ * 自定义样式(v3 扩展字段,v1 暂不实现)
31
+ */
32
+ style?: any;
33
+ }
4
34
  export type TableConfig = CommonGlobalConfig & {
5
35
  data: TableDataItem[];
6
36
  metrics?: string[];
7
37
  dimensions?: string[];
8
38
  spec?: Record<string, any>;
39
+ /** 单元格合并配置 */
40
+ columnMerge?: CellMergeConfig[];
9
41
  };
10
42
  export type TableProps = BaseChartProps & Partial<TableConfig>;
@@ -1 +1,2 @@
1
1
  export { useChartConfigTools } from './useChartConfigTools';
2
+ export { useDashLine } from './useDashLine';
@@ -0,0 +1,27 @@
1
+ import { GenericDataType } from '../../../utils/data';
2
+ import type { DashSegment } from '../types';
3
+ /**
4
+ * 通用虚线处理 Hook
5
+ *
6
+ * 根据 dashSegments 配置修改原始数据,添加 _isDashLine 标记
7
+ * 并返回完整的样式配置(包含基础样式和虚线逻辑)
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * const { processedData, style } = useDashLine({
12
+ * data,
13
+ * xField: 'time',
14
+ * getFieldType,
15
+ * dashSegments: [{ from: '00:45' }]
16
+ * });
17
+ * ```
18
+ */
19
+ export declare const useDashLine: ({ data, xField, getFieldType, dashSegments, }: {
20
+ data: any[];
21
+ xField?: string;
22
+ getFieldType?: (fieldName: string, value?: any) => GenericDataType | undefined;
23
+ dashSegments?: DashSegment[];
24
+ }) => {
25
+ processedData: any[];
26
+ style: any;
27
+ };
@@ -0,0 +1,21 @@
1
+ /**
2
+ * 虚线段配置
3
+ *
4
+ * @example
5
+ * ```ts
6
+ * // 末尾预测(最常用)
7
+ * [{ from: '00:45' }]
8
+ *
9
+ * // 中间虚线
10
+ * [{ from: '00:30', to: '00:45' }]
11
+ *
12
+ * // 多段虚线
13
+ * [{ from: '00:30', to: '00:45' }, { from: '01:00' }]
14
+ * ```
15
+ */
16
+ export interface DashSegment {
17
+ /** 起始点(x 轴的值,如时间、数值) */
18
+ from: string | number;
19
+ /** 结束点(可选,不填则到末尾) */
20
+ to?: string | number;
21
+ }