x-next 1.7.0 → 1.8.1

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.
Files changed (88) hide show
  1. package/AI_USAGE.md +129 -4
  2. package/CHANGELOG.md +47 -0
  3. package/dist/_hooks/use-chart-size.d.ts +25 -0
  4. package/dist/_utils/chart/index.d.ts +6 -0
  5. package/dist/_utils/chart/padding.d.ts +15 -0
  6. package/dist/_utils/chart/path.d.ts +34 -0
  7. package/dist/_utils/chart/scale.d.ts +55 -0
  8. package/dist/components/_components/chart/ChartAxis.d.ts +85 -0
  9. package/dist/components/_components/chart/ChartLegend.d.ts +26 -0
  10. package/dist/components/_components/chart/ChartTooltip.d.ts +76 -0
  11. package/dist/components/_components/chart/colors.d.ts +10 -0
  12. package/dist/components/_components/chart/interface.d.ts +38 -0
  13. package/dist/components/bar-chart/BarChart.d.ts +278 -0
  14. package/dist/components/bar-chart/helpers/layout.d.ts +55 -0
  15. package/dist/components/bar-chart/index.d.ts +600 -0
  16. package/dist/components/bar-chart/interface.d.ts +74 -0
  17. package/dist/components/bar-chart/props.d.ts +145 -0
  18. package/dist/components/heatmap/Heatmap.d.ts +10 -1
  19. package/dist/components/heatmap/index.d.ts +30 -3
  20. package/dist/components/index.d.ts +3 -0
  21. package/dist/components/line-chart/LineChart.d.ts +295 -0
  22. package/dist/components/line-chart/helpers/layout.d.ts +74 -0
  23. package/dist/components/line-chart/index.d.ts +614 -0
  24. package/dist/components/line-chart/interface.d.ts +76 -0
  25. package/dist/components/line-chart/props.d.ts +173 -0
  26. package/dist/components/pie-chart/PieChart.d.ts +219 -0
  27. package/dist/components/pie-chart/index.d.ts +470 -0
  28. package/dist/components/pie-chart/interface.d.ts +58 -0
  29. package/dist/components/pie-chart/props.d.ts +107 -0
  30. package/dist/components/trend-chart/components/TrendChart.d.ts +19 -96
  31. package/dist/components/trend-chart/index.d.ts +33 -187
  32. package/dist/components/trend-chart/props.d.ts +9 -78
  33. package/dist/components/trend-chart/themes.d.ts +0 -1
  34. package/dist/es/_hooks/use-chart-size.js +25 -0
  35. package/dist/es/_styles/palette-aliases.js +5 -0
  36. package/dist/es/_utils/chart/padding.js +22 -0
  37. package/dist/es/_utils/chart/path.js +69 -0
  38. package/dist/es/_utils/chart/scale.js +77 -0
  39. package/dist/es/components/_components/chart/ChartAxis.js +79 -0
  40. package/dist/es/components/_components/chart/ChartLegend.js +53 -0
  41. package/dist/es/components/_components/chart/ChartTooltip.js +64 -0
  42. package/dist/es/components/_components/chart/colors.js +12 -0
  43. package/dist/es/components/bar-chart/BarChart.js +470 -0
  44. package/dist/es/components/bar-chart/helpers/layout.js +53 -0
  45. package/dist/es/components/bar-chart/index.js +8 -0
  46. package/dist/es/components/bar-chart/props.js +148 -0
  47. package/dist/es/components/heatmap/Heatmap.js +249 -172
  48. package/dist/es/components/index.js +132 -126
  49. package/dist/es/components/line-chart/LineChart.js +532 -0
  50. package/dist/es/components/line-chart/helpers/layout.js +80 -0
  51. package/dist/es/components/line-chart/index.js +8 -0
  52. package/dist/es/components/line-chart/props.js +178 -0
  53. package/dist/es/components/pie-chart/PieChart.js +397 -0
  54. package/dist/es/components/pie-chart/index.js +8 -0
  55. package/dist/es/components/pie-chart/props.js +104 -0
  56. package/dist/es/components/trend-chart/components/TrendChart.js +143 -183
  57. package/dist/es/components/trend-chart/components/trend-chart-curve.js +85 -81
  58. package/dist/es/components/trend-chart/props.js +28 -74
  59. package/dist/es/components/trend-chart/themes.js +30 -31
  60. package/dist/es/index.js +193 -187
  61. package/dist/es/locale/en-US.js +8 -1
  62. package/dist/es/locale/zh-CN.js +8 -1
  63. package/dist/es/style.css +1 -1
  64. package/dist/index.cjs +4 -4
  65. package/dist/index.umd.js +4 -4
  66. package/dist/locale/interface.d.ts +13 -0
  67. package/dist/style/bar-chart.css +1 -0
  68. package/dist/style/bar-chart.js +2 -0
  69. package/dist/style/base.css +1 -1
  70. package/dist/style/heatmap.css +1 -1
  71. package/dist/style/line-chart.css +1 -0
  72. package/dist/style/line-chart.js +2 -0
  73. package/dist/style/pie-chart.css +1 -0
  74. package/dist/style/pie-chart.js +2 -0
  75. package/dist/style.css +1 -1
  76. package/dist/types.d.ts +3 -0
  77. package/package.json +1 -1
  78. package/volar.d.ts +3 -0
  79. package/dist/components/trend-chart/components/trend-chart-grid.d.ts +0 -55
  80. package/dist/components/trend-chart/components/trend-chart-labels.d.ts +0 -26
  81. package/dist/components/trend-chart/helpers/genPath.d.ts +0 -8
  82. package/dist/components/trend-chart/helpers/getPadding.d.ts +0 -8
  83. package/dist/components/trend-chart/helpers/validatePadding.d.ts +0 -2
  84. package/dist/es/components/trend-chart/components/trend-chart-grid.js +0 -62
  85. package/dist/es/components/trend-chart/components/trend-chart-labels.js +0 -75
  86. package/dist/es/components/trend-chart/helpers/genPath.js +0 -22
  87. package/dist/es/components/trend-chart/helpers/getPadding.js +0 -21
  88. package/dist/es/components/trend-chart/helpers/validatePadding.js +0 -7
@@ -0,0 +1,173 @@
1
+ import { ExtractPropTypes, PropType } from 'vue';
2
+ import { LineChartGridOptions, LineChartLabelsOptions, LineChartSeries } from './interface';
3
+ export declare const lineChartProps: {
4
+ /**
5
+ * @zh 类目轴标签,与每个系列 data 的下标一一对应;缺省时按 1、2、3… 显示
6
+ * @en Category axis labels, aligned by index with each series data
7
+ */
8
+ categories: {
9
+ type: PropType<Array<string | number>>;
10
+ default: () => never[];
11
+ };
12
+ /**
13
+ * @zh 数据系列;单系列为普通折线,多系列可叠放或堆叠
14
+ * @en Data series; a single series renders a plain line, multiple series can
15
+ * overlap or stack
16
+ */
17
+ series: {
18
+ required: boolean;
19
+ type: PropType<LineChartSeries[]>;
20
+ default: () => never[];
21
+ };
22
+ /**
23
+ * @zh 堆叠多系列;折线按值累加,面积按下界与上界填充(堆叠面积)
24
+ * @en Stack multiple series; lines accumulate and areas fill between the
25
+ * lower and upper bounds
26
+ * @defaultValue false
27
+ */
28
+ stack: {
29
+ type: BooleanConstructor;
30
+ default: boolean;
31
+ };
32
+ /**
33
+ * @zh 是否绘制面积填充
34
+ * @en Whether to fill the area under the line
35
+ * @defaultValue false
36
+ */
37
+ area: {
38
+ type: BooleanConstructor;
39
+ default: boolean;
40
+ };
41
+ /**
42
+ * @zh 平滑曲线
43
+ * @en Smooth curve
44
+ * @defaultValue true
45
+ */
46
+ smooth: {
47
+ type: BooleanConstructor;
48
+ default: boolean;
49
+ };
50
+ /**
51
+ * @zh 缺测点(null)是否跨过连接;默认断开,避免「没有数据」被画成跌到 0
52
+ * @en Whether null points are connected; by default the line breaks so that
53
+ * missing data is not drawn as a drop to zero
54
+ * @defaultValue false
55
+ */
56
+ connectNulls: {
57
+ type: BooleanConstructor;
58
+ default: boolean;
59
+ };
60
+ /**
61
+ * @zh 数据点显示策略:true 常显、false 不显示、auto 时点数少时常显
62
+ * @en Data point strategy: true always, false never, auto shows points when
63
+ * there are few of them
64
+ * @defaultValue 'auto'
65
+ */
66
+ showPoints: {
67
+ type: PropType<boolean | "auto">;
68
+ default: string;
69
+ validator: (value: boolean | "auto") => boolean;
70
+ };
71
+ /**
72
+ * @zh 图表高度,数字按 px 处理
73
+ * @en Chart height; numbers are treated as px
74
+ * @defaultValue 280
75
+ */
76
+ height: {
77
+ type: PropType<number | string>;
78
+ default: number;
79
+ };
80
+ /**
81
+ * @zh 图表宽度,数字按 px 处理,默认撑满父容器
82
+ * @en Chart width; numbers are treated as px, defaults to filling the parent
83
+ * @defaultValue '100%'
84
+ */
85
+ width: {
86
+ type: PropType<number | string>;
87
+ default: string;
88
+ };
89
+ /**
90
+ * @zh 数值轴上界;传入后不再自动计算「好看」的刻度
91
+ * @en Upper bound of the value axis; disables nice-tick calculation
92
+ */
93
+ max: {
94
+ type: NumberConstructor;
95
+ };
96
+ /**
97
+ * @zh 数值轴下界;数据含负值时自动扩展,也可手动锁定
98
+ * @en Lower bound of the value axis; expands automatically for negative data
99
+ */
100
+ min: {
101
+ type: NumberConstructor;
102
+ };
103
+ /**
104
+ * @zh 绘制边距,支持 1-4 个非负数字字符串或单个非负数字
105
+ * @en Plot padding; supports a single non-negative number or CSS-like 1-4 values
106
+ * @defaultValue '8'
107
+ */
108
+ padding: {
109
+ default: string;
110
+ type: PropType<string | number>;
111
+ validator(val: string | number): boolean;
112
+ };
113
+ /**
114
+ * @zh 横向网格线配置
115
+ * @en Horizontal grid line options
116
+ */
117
+ grid: {
118
+ default: null;
119
+ type: PropType<LineChartGridOptions>;
120
+ };
121
+ /**
122
+ * @zh 坐标轴标签配置
123
+ * @en Axis label options
124
+ */
125
+ labels: {
126
+ default: null;
127
+ type: PropType<LineChartLabelsOptions>;
128
+ };
129
+ /**
130
+ * @zh 悬浮提示
131
+ * @en Hover tooltip
132
+ * @defaultValue true
133
+ */
134
+ tooltip: {
135
+ type: BooleanConstructor;
136
+ default: boolean;
137
+ };
138
+ /**
139
+ * @zh 图例;多系列时建议开启,点击图例项可临时隐藏/显示对应系列
140
+ * @en Legend; recommended for multiple series, clicking an item toggles the
141
+ * series visibility
142
+ * @defaultValue false
143
+ */
144
+ legend: {
145
+ type: BooleanConstructor;
146
+ default: boolean;
147
+ };
148
+ /**
149
+ * @zh 数值格式化函数,用于提示、图例与数值轴
150
+ * @en Value formatter used by tooltip, legend and the value axis
151
+ */
152
+ valueFormatter: {
153
+ type: PropType<(value: number) => string>;
154
+ default: (value: number) => string;
155
+ };
156
+ /**
157
+ * @zh 加载中
158
+ * @en Loading state
159
+ * @defaultValue false
160
+ */
161
+ loading: {
162
+ type: PropType<boolean | Record<string, unknown>>;
163
+ default: boolean;
164
+ };
165
+ /**
166
+ * @zh 无障碍名称;设置后画布带 role="img"
167
+ * @en Accessible name; adds role="img" to the canvas when set
168
+ */
169
+ ariaLabel: {
170
+ type: StringConstructor;
171
+ };
172
+ };
173
+ export type LineChartProps = ExtractPropTypes<typeof lineChartProps>;
@@ -0,0 +1,219 @@
1
+ import { SlotsType } from 'vue';
2
+ import { PieChartActiveData, PieChartClickData, PieChartItem, PieChartSegment } from './interface';
3
+ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
4
+ data: {
5
+ required: boolean;
6
+ type: import('vue').PropType<PieChartItem[]>;
7
+ default: () => never[];
8
+ };
9
+ innerRadius: {
10
+ type: import('vue').PropType<number | string>;
11
+ default: number;
12
+ };
13
+ height: {
14
+ type: import('vue').PropType<number | string>;
15
+ default: number;
16
+ };
17
+ width: {
18
+ type: import('vue').PropType<number | string>;
19
+ default: string;
20
+ };
21
+ labels: {
22
+ type: import('vue').PropType<boolean | {
23
+ fontSize?: number;
24
+ color?: string;
25
+ }>;
26
+ default: boolean;
27
+ };
28
+ center: {
29
+ type: import('vue').PropType<boolean | {
30
+ fontSize?: number;
31
+ }>;
32
+ default: boolean;
33
+ };
34
+ tooltip: {
35
+ type: BooleanConstructor;
36
+ default: boolean;
37
+ };
38
+ legend: {
39
+ type: BooleanConstructor;
40
+ default: boolean;
41
+ };
42
+ valueFormatter: {
43
+ type: import('vue').PropType<(value: number) => string>;
44
+ default: (value: number) => string;
45
+ };
46
+ loading: {
47
+ type: import('vue').PropType<boolean | Record<string, unknown>>;
48
+ default: boolean;
49
+ };
50
+ ariaLabel: {
51
+ type: StringConstructor;
52
+ };
53
+ }>, {
54
+ className: {
55
+ block: string;
56
+ element: (className: string) => string;
57
+ modifier: (className: string) => string;
58
+ is: (className: string) => string;
59
+ };
60
+ state: {
61
+ activeIndex: number | null;
62
+ hiddenIndexes: number[];
63
+ keyboardActive: boolean;
64
+ pointer: {
65
+ x: number;
66
+ y: number;
67
+ };
68
+ tooltipWidth: number;
69
+ };
70
+ size: {
71
+ width: number;
72
+ height: number;
73
+ };
74
+ refs: {
75
+ root: import('vue').Ref<HTMLDivElement | null, HTMLDivElement | null>;
76
+ canvas: import('vue').Ref<HTMLDivElement | null, HTMLDivElement | null>;
77
+ tooltip: import('vue').Ref<HTMLDivElement | null, HTMLDivElement | null>;
78
+ };
79
+ slots: Readonly<{
80
+ center?: ((props: {
81
+ total: number;
82
+ formatValue: (value: number) => string;
83
+ }) => unknown) | undefined;
84
+ tooltip?: ((props: PieChartActiveData) => unknown) | undefined;
85
+ label?: ((props: PieChartActiveData) => unknown) | undefined;
86
+ legend?: ((props: {
87
+ items: PieChartItem[];
88
+ hiddenIndexes: number[];
89
+ }) => unknown) | undefined;
90
+ empty?: (() => unknown) | undefined;
91
+ }>;
92
+ t: (key: import('../..').LocaleKey | (string & {}), params?: Record<string, string | number>) => string;
93
+ items: import('vue').ComputedRef<PieChartItem[]>;
94
+ visibleIndexes: import('vue').ComputedRef<number[]>;
95
+ total: import('vue').ComputedRef<number>;
96
+ hasData: import('vue').ComputedRef<boolean>;
97
+ geometry: import('vue').ComputedRef<{
98
+ cx: number;
99
+ cy: number;
100
+ radius: number;
101
+ inner: number;
102
+ }>;
103
+ segments: import('vue').ComputedRef<PieChartSegment[]>;
104
+ activeData: import('vue').ComputedRef<PieChartActiveData | null>;
105
+ legendItems: import('vue').ComputedRef<{
106
+ key: number;
107
+ name: string;
108
+ color: string;
109
+ hidden: boolean;
110
+ value: string;
111
+ }[]>;
112
+ centerVisible: import('vue').ComputedRef<boolean>;
113
+ labelFontSize: import('vue').ComputedRef<number>;
114
+ labelColor: import('vue').ComputedRef<string>;
115
+ centerFontSize: import('vue').ComputedRef<number>;
116
+ formatValue: import('vue').ComputedRef<(value: number) => string>;
117
+ tooltipStyle: import('vue').ComputedRef<Record<string, string>>;
118
+ handleSegmentEnter: (index: number) => void;
119
+ handleClick: (index: number, ev: MouseEvent) => void;
120
+ handleKeydown: (ev: KeyboardEvent) => void;
121
+ clearActive: () => void;
122
+ toggleItem: (index: number) => void;
123
+ liveText: import('vue').ComputedRef<string>;
124
+ setTooltipElement: (el: HTMLDivElement | null) => void;
125
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
126
+ /**
127
+ * @zh 点击分片时触发
128
+ * @en Emitted when a slice is clicked
129
+ */
130
+ 'item-click': (data: PieChartClickData) => boolean;
131
+ /**
132
+ * @zh 图例切换后触发,参数为当前可见的分片下标
133
+ * @en Emitted after a legend toggle, with the visible item indexes
134
+ */
135
+ 'legend-change': (visibleIndexes: number[]) => boolean;
136
+ }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
137
+ data: {
138
+ required: boolean;
139
+ type: import('vue').PropType<PieChartItem[]>;
140
+ default: () => never[];
141
+ };
142
+ innerRadius: {
143
+ type: import('vue').PropType<number | string>;
144
+ default: number;
145
+ };
146
+ height: {
147
+ type: import('vue').PropType<number | string>;
148
+ default: number;
149
+ };
150
+ width: {
151
+ type: import('vue').PropType<number | string>;
152
+ default: string;
153
+ };
154
+ labels: {
155
+ type: import('vue').PropType<boolean | {
156
+ fontSize?: number;
157
+ color?: string;
158
+ }>;
159
+ default: boolean;
160
+ };
161
+ center: {
162
+ type: import('vue').PropType<boolean | {
163
+ fontSize?: number;
164
+ }>;
165
+ default: boolean;
166
+ };
167
+ tooltip: {
168
+ type: BooleanConstructor;
169
+ default: boolean;
170
+ };
171
+ legend: {
172
+ type: BooleanConstructor;
173
+ default: boolean;
174
+ };
175
+ valueFormatter: {
176
+ type: import('vue').PropType<(value: number) => string>;
177
+ default: (value: number) => string;
178
+ };
179
+ loading: {
180
+ type: import('vue').PropType<boolean | Record<string, unknown>>;
181
+ default: boolean;
182
+ };
183
+ ariaLabel: {
184
+ type: StringConstructor;
185
+ };
186
+ }>> & Readonly<{
187
+ "onLegend-change"?: ((visibleIndexes: number[]) => any) | undefined;
188
+ "onItem-click"?: ((data: PieChartClickData) => any) | undefined;
189
+ }>, {
190
+ center: boolean | {
191
+ fontSize?: number;
192
+ };
193
+ loading: boolean | Record<string, unknown>;
194
+ data: PieChartItem[];
195
+ legend: boolean;
196
+ height: string | number;
197
+ width: string | number;
198
+ tooltip: boolean;
199
+ labels: boolean | {
200
+ fontSize?: number;
201
+ color?: string;
202
+ };
203
+ valueFormatter: (value: number) => string;
204
+ innerRadius: string | number;
205
+ }, SlotsType<{
206
+ /** 圆环中心内容;默认展示合计 */
207
+ center?: (props: {
208
+ total: number;
209
+ formatValue: (value: number) => string;
210
+ }) => unknown;
211
+ tooltip?: (props: PieChartActiveData) => unknown;
212
+ label?: (props: PieChartActiveData) => unknown;
213
+ legend?: (props: {
214
+ items: PieChartItem[];
215
+ hiddenIndexes: number[];
216
+ }) => unknown;
217
+ empty?: () => unknown;
218
+ }>, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
219
+ export default _default;