@univerjs-pro/sheets-chart 1.0.0-alpha.2 → 1.0.0-alpha.3
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.
- package/README.md +8 -2
- package/lib/cjs/facade.js +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/locale/ar-SA.js +1 -1
- package/lib/cjs/locale/ca-ES.js +1 -1
- package/lib/cjs/locale/de-DE.js +1 -1
- package/lib/cjs/locale/en-US.js +1 -1
- package/lib/cjs/locale/es-ES.js +1 -1
- package/lib/cjs/locale/fa-IR.js +1 -1
- package/lib/cjs/locale/fr-FR.js +1 -1
- package/lib/cjs/locale/id-ID.js +1 -1
- package/lib/cjs/locale/it-IT.js +1 -1
- package/lib/cjs/locale/ja-JP.js +1 -1
- package/lib/cjs/locale/ko-KR.js +1 -1
- package/lib/cjs/locale/pl-PL.js +1 -1
- package/lib/cjs/locale/pt-BR.js +1 -1
- package/lib/cjs/locale/ru-RU.js +1 -1
- package/lib/cjs/locale/sk-SK.js +1 -1
- package/lib/cjs/locale/vi-VN.js +1 -1
- package/lib/cjs/locale/zh-CN.js +1 -1
- package/lib/cjs/locale/zh-HK.js +1 -1
- package/lib/cjs/locale/zh-TW.js +1 -1
- package/lib/es/facade.js +1 -1
- package/lib/es/index.js +1 -1
- package/lib/es/locale/ar-SA.js +1 -1
- package/lib/es/locale/ca-ES.js +1 -1
- package/lib/es/locale/de-DE.js +1 -1
- package/lib/es/locale/en-US.js +1 -1
- package/lib/es/locale/es-ES.js +1 -1
- package/lib/es/locale/fa-IR.js +1 -1
- package/lib/es/locale/fr-FR.js +1 -1
- package/lib/es/locale/id-ID.js +1 -1
- package/lib/es/locale/it-IT.js +1 -1
- package/lib/es/locale/ja-JP.js +1 -1
- package/lib/es/locale/ko-KR.js +1 -1
- package/lib/es/locale/pl-PL.js +1 -1
- package/lib/es/locale/pt-BR.js +1 -1
- package/lib/es/locale/ru-RU.js +1 -1
- package/lib/es/locale/sk-SK.js +1 -1
- package/lib/es/locale/vi-VN.js +1 -1
- package/lib/es/locale/zh-CN.js +1 -1
- package/lib/es/locale/zh-HK.js +1 -1
- package/lib/es/locale/zh-TW.js +1 -1
- package/lib/facade.js +1 -1
- package/lib/index.js +1 -1
- package/lib/locale/ar-SA.js +1 -1
- package/lib/locale/ca-ES.js +1 -1
- package/lib/locale/de-DE.js +1 -1
- package/lib/locale/en-US.js +1 -1
- package/lib/locale/es-ES.js +1 -1
- package/lib/locale/fa-IR.js +1 -1
- package/lib/locale/fr-FR.js +1 -1
- package/lib/locale/id-ID.js +1 -1
- package/lib/locale/it-IT.js +1 -1
- package/lib/locale/ja-JP.js +1 -1
- package/lib/locale/ko-KR.js +1 -1
- package/lib/locale/pl-PL.js +1 -1
- package/lib/locale/pt-BR.js +1 -1
- package/lib/locale/ru-RU.js +1 -1
- package/lib/locale/sk-SK.js +1 -1
- package/lib/locale/vi-VN.js +1 -1
- package/lib/locale/zh-CN.js +1 -1
- package/lib/locale/zh-HK.js +1 -1
- package/lib/locale/zh-TW.js +1 -1
- package/lib/types/chart-source/chart-source.d.ts +0 -1
- package/lib/types/commands/commands/sheets-chart.command.d.ts +3 -4
- package/lib/types/commands/mutations/sheets-chart.mutation.d.ts +15 -5
- package/lib/types/common/util.d.ts +1 -1
- package/lib/types/facade/chart-facade-adapter.d.ts +30 -20
- package/lib/types/facade/chart-facade-builders.d.ts +6 -1
- package/lib/types/facade/chart-facade-types.d.ts +109 -290
- package/lib/types/facade/f-chart.d.ts +26 -3
- package/lib/types/facade/f-worksheet-charts.d.ts +66 -1
- package/lib/types/facade/f-worksheet.d.ts +3 -0
- package/lib/types/facade/index.d.ts +1 -0
- package/lib/types/index.d.ts +5 -6
- package/lib/types/models/chart-model.d.ts +3 -3
- package/lib/types/models/types.d.ts +4 -1
- package/lib/types/plugin.d.ts +1 -0
- package/lib/types/services/chart-model.service.d.ts +2 -0
- package/lib/types/services/sheet-chart-range-watcher.d.ts +22 -0
- package/lib/types/services/sheets-chart.service.d.ts +8 -8
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -1
- package/lib/umd/locale/ar-SA.js +1 -1
- package/lib/umd/locale/ca-ES.js +1 -1
- package/lib/umd/locale/de-DE.js +1 -1
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/es-ES.js +1 -1
- package/lib/umd/locale/fa-IR.js +1 -1
- package/lib/umd/locale/fr-FR.js +1 -1
- package/lib/umd/locale/id-ID.js +1 -1
- package/lib/umd/locale/it-IT.js +1 -1
- package/lib/umd/locale/ja-JP.js +1 -1
- package/lib/umd/locale/ko-KR.js +1 -1
- package/lib/umd/locale/pl-PL.js +1 -1
- package/lib/umd/locale/pt-BR.js +1 -1
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/sk-SK.js +1 -1
- package/lib/umd/locale/vi-VN.js +1 -1
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-HK.js +1 -1
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +10 -10
|
@@ -1,23 +1,64 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ChartKnownTypeName, ChartModelCapabilities, ChartModelChangedGroup, ChartModelCreateSpec, ChartModelDescription, ChartModelPatch, ChartModelPatchGroup, ChartTypeName, DeepReadonly, FChartDescription, FChartUpdateResult, IChartRenderModelImageExportOptions, IChartRenderModelImageExportResult, IEchartTheme } from '@univerjs-pro/engine-chart';
|
|
2
2
|
import type { IRange } from '@univerjs/core';
|
|
3
3
|
import type { FChart } from './f-chart';
|
|
4
|
-
export
|
|
5
|
-
readonly
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
export declare const ChartSourceOrientation: {
|
|
5
|
+
readonly Auto: "auto";
|
|
6
|
+
readonly Row: "row";
|
|
7
|
+
readonly Column: "column";
|
|
8
|
+
readonly Rows: "rows";
|
|
9
|
+
readonly Columns: "columns";
|
|
10
|
+
readonly RowsAsSeries: "rowsAsSeries";
|
|
11
|
+
readonly ColumnsAsSeries: "columnsAsSeries";
|
|
12
|
+
};
|
|
13
|
+
export type ChartSourceOrientation = typeof ChartSourceOrientation[keyof typeof ChartSourceOrientation];
|
|
14
|
+
export declare enum ChartSourceKind {
|
|
15
|
+
Range = "range",
|
|
16
|
+
Ranges = "ranges"
|
|
17
|
+
}
|
|
13
18
|
export type ChartRangeSpec = string | IRange;
|
|
14
|
-
export
|
|
19
|
+
export interface IChartSourceVectorSpec {
|
|
20
|
+
/** One row or one column of values. All vectors are aligned by position. */
|
|
15
21
|
range: ChartRangeSpec;
|
|
22
|
+
/** Optional single-cell display name. It never consumes a value from `range`. */
|
|
23
|
+
header?: ChartRangeSpec;
|
|
24
|
+
}
|
|
25
|
+
export type ChartSourceVectorSpec = IChartSourceVectorSpec;
|
|
26
|
+
interface IChartSourceLocationSpec {
|
|
16
27
|
sheetName?: string;
|
|
17
28
|
sheetId?: string;
|
|
18
29
|
unitId?: string;
|
|
19
30
|
orientation?: ChartSourceOrientation;
|
|
20
|
-
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Chart data from either one rectangular table or explicit positional vectors.
|
|
34
|
+
* Exactly one of `range` and `ranges` may be provided.
|
|
35
|
+
*
|
|
36
|
+
* @example Single rectangular table
|
|
37
|
+
* ```ts
|
|
38
|
+
* { sheetName: 'Sales', range: 'A1:C7', orientation: 'columns' }
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @example Equal-length positional vectors with optional single-cell headers
|
|
42
|
+
* ```ts
|
|
43
|
+
* {
|
|
44
|
+
* sheetName: 'Sales',
|
|
45
|
+
* orientation: 'columns',
|
|
46
|
+
* ranges: [
|
|
47
|
+
* { header: 'A1', range: 'A2:A7' },
|
|
48
|
+
* { header: 'C1', range: 'C2:C7' },
|
|
49
|
+
* ],
|
|
50
|
+
* }
|
|
51
|
+
* ```
|
|
52
|
+
* Vector array order defines mapping indexes. Vectors must have equal lengths
|
|
53
|
+
* and a common row-or-column orientation; no join or padding is performed.
|
|
54
|
+
*/
|
|
55
|
+
export type ChartSourceSpec = ChartRangeSpec | (IChartSourceLocationSpec & {
|
|
56
|
+
range: ChartRangeSpec;
|
|
57
|
+
ranges?: never;
|
|
58
|
+
}) | (IChartSourceLocationSpec & {
|
|
59
|
+
range?: never;
|
|
60
|
+
ranges: readonly ChartSourceVectorSpec[];
|
|
61
|
+
});
|
|
21
62
|
export type ChartAnchorSpec = string | {
|
|
22
63
|
row: number;
|
|
23
64
|
column: number;
|
|
@@ -38,197 +79,7 @@ export interface IChartLayoutPatch {
|
|
|
38
79
|
size?: ChartSizeSpec;
|
|
39
80
|
}
|
|
40
81
|
export type ChartLayoutPatch = IChartLayoutPatch;
|
|
41
|
-
export
|
|
42
|
-
text?: string;
|
|
43
|
-
visible?: boolean;
|
|
44
|
-
position?: 'top' | 'bottom' | 'left' | 'right';
|
|
45
|
-
alignment?: 'left' | 'center' | 'right';
|
|
46
|
-
fontSize?: number;
|
|
47
|
-
color?: string;
|
|
48
|
-
bold?: boolean;
|
|
49
|
-
};
|
|
50
|
-
export type ChartLegendSpec = boolean | {
|
|
51
|
-
visible?: boolean;
|
|
52
|
-
position?: 'top' | 'bottom' | 'left' | 'right';
|
|
53
|
-
selectMode?: 'single' | 'multiple' | 'close';
|
|
54
|
-
fontSize?: number;
|
|
55
|
-
color?: string;
|
|
56
|
-
bold?: boolean;
|
|
57
|
-
italic?: boolean;
|
|
58
|
-
};
|
|
59
|
-
export interface IChartAxisSpec {
|
|
60
|
-
title?: string;
|
|
61
|
-
min?: number | null;
|
|
62
|
-
max?: number | null;
|
|
63
|
-
reverse?: boolean;
|
|
64
|
-
line?: {
|
|
65
|
-
visible?: boolean;
|
|
66
|
-
color?: string;
|
|
67
|
-
width?: number;
|
|
68
|
-
};
|
|
69
|
-
tick?: {
|
|
70
|
-
visible?: boolean;
|
|
71
|
-
color?: string;
|
|
72
|
-
width?: number;
|
|
73
|
-
length?: number;
|
|
74
|
-
position?: 'inside' | 'outside';
|
|
75
|
-
};
|
|
76
|
-
format?: string | null;
|
|
77
|
-
titleStyle?: {
|
|
78
|
-
color?: string;
|
|
79
|
-
fontSize?: number;
|
|
80
|
-
bold?: boolean;
|
|
81
|
-
italic?: boolean;
|
|
82
|
-
family?: string;
|
|
83
|
-
};
|
|
84
|
-
label?: {
|
|
85
|
-
visible?: boolean;
|
|
86
|
-
color?: string;
|
|
87
|
-
fontSize?: number;
|
|
88
|
-
rotate?: number;
|
|
89
|
-
};
|
|
90
|
-
gridLine?: {
|
|
91
|
-
visible?: boolean;
|
|
92
|
-
color?: string;
|
|
93
|
-
width?: number;
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
export type ChartAxisSpec = IChartAxisSpec;
|
|
97
|
-
export interface IChartAxesSpec {
|
|
98
|
-
x?: ChartAxisSpec;
|
|
99
|
-
y?: ChartAxisSpec;
|
|
100
|
-
rightY?: Omit<ChartAxisSpec, 'reverse'>;
|
|
101
|
-
}
|
|
102
|
-
export type ChartAxesSpec = IChartAxesSpec;
|
|
103
|
-
export type ChartSeriesSelector = {
|
|
104
|
-
index: number;
|
|
105
|
-
} | {
|
|
106
|
-
name: string;
|
|
107
|
-
};
|
|
108
|
-
export interface IChartSeriesPatch {
|
|
109
|
-
selector: ChartSeriesSelector;
|
|
110
|
-
name?: string;
|
|
111
|
-
type?: 'column' | 'line' | 'area';
|
|
112
|
-
color?: string;
|
|
113
|
-
fillOpacity?: number;
|
|
114
|
-
border?: {
|
|
115
|
-
color?: string | null;
|
|
116
|
-
width?: number;
|
|
117
|
-
opacity?: number;
|
|
118
|
-
dashType?: ChartBorderDashType;
|
|
119
|
-
};
|
|
120
|
-
point?: {
|
|
121
|
-
shape?: LinePointShape;
|
|
122
|
-
size?: number;
|
|
123
|
-
color?: string | null;
|
|
124
|
-
};
|
|
125
|
-
rightAxis?: boolean;
|
|
126
|
-
label?: {
|
|
127
|
-
visible?: boolean;
|
|
128
|
-
position?: 'top' | 'bottom' | 'inside' | 'outside';
|
|
129
|
-
contentType?: LabelContentType;
|
|
130
|
-
color?: string;
|
|
131
|
-
fontSize?: number;
|
|
132
|
-
bold?: boolean;
|
|
133
|
-
italic?: boolean;
|
|
134
|
-
};
|
|
135
|
-
dataPoints?: Record<number, {
|
|
136
|
-
shape?: LinePointShape;
|
|
137
|
-
size?: number;
|
|
138
|
-
color?: string | null;
|
|
139
|
-
fillOpacity?: number;
|
|
140
|
-
}>;
|
|
141
|
-
}
|
|
142
|
-
export type ChartSeriesPatch = IChartSeriesPatch;
|
|
143
|
-
export interface IChartWordCloudSpec {
|
|
144
|
-
shape?: WordCloudShapeEnum;
|
|
145
|
-
/**
|
|
146
|
-
* Stable wordcloud mask resource id/key known to the runtime.
|
|
147
|
-
*
|
|
148
|
-
* The public facade intentionally does not recommend arbitrary URL/data URL
|
|
149
|
-
* input in v1. Legacy URL/data URL values may still appear through rawStyle
|
|
150
|
-
* for expert/debug compatibility, but normal callers should use registered
|
|
151
|
-
* mask resource ids.
|
|
152
|
-
*
|
|
153
|
-
* Patch semantics:
|
|
154
|
-
* - omitted/undefined: keep the current mask image setting.
|
|
155
|
-
* - null: clear the persisted mask image and fall back to shape.
|
|
156
|
-
* - string: set the mask image id; the mask image takes precedence over shape.
|
|
157
|
-
*/
|
|
158
|
-
maskImageId?: string | null;
|
|
159
|
-
repeat?: boolean;
|
|
160
|
-
}
|
|
161
|
-
export type ChartWordCloudSpec = IChartWordCloudSpec;
|
|
162
|
-
export interface IChartWordCloudDescription {
|
|
163
|
-
shape?: WordCloudShapeEnum;
|
|
164
|
-
maskImageId?: string;
|
|
165
|
-
repeat?: boolean;
|
|
166
|
-
effectiveShapeSource: 'shape' | 'maskImage';
|
|
167
|
-
}
|
|
168
|
-
export type ChartWordCloudDescription = IChartWordCloudDescription;
|
|
169
|
-
export interface IChartAppearanceSpec {
|
|
170
|
-
background?: {
|
|
171
|
-
color?: string | null;
|
|
172
|
-
gradient?: boolean;
|
|
173
|
-
};
|
|
174
|
-
border?: {
|
|
175
|
-
color?: string | null;
|
|
176
|
-
width?: number;
|
|
177
|
-
};
|
|
178
|
-
font?: {
|
|
179
|
-
color?: string;
|
|
180
|
-
size?: number;
|
|
181
|
-
family?: string;
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
export type ChartAppearanceSpec = IChartAppearanceSpec;
|
|
185
|
-
export interface IChartMappingSpec {
|
|
186
|
-
categoryIndex?: number | null;
|
|
187
|
-
seriesIndexes?: number[] | null;
|
|
188
|
-
useDateAxis?: boolean | null;
|
|
189
|
-
bubble?: {
|
|
190
|
-
sizeSeriesIndex?: number | null;
|
|
191
|
-
xAxisIndex?: number | null;
|
|
192
|
-
yAxisIndex?: number | null;
|
|
193
|
-
labelIndex?: number | null;
|
|
194
|
-
seriesIndex?: number | null;
|
|
195
|
-
};
|
|
196
|
-
}
|
|
197
|
-
export type ChartMappingSpec = IChartMappingSpec;
|
|
198
|
-
export interface IChartAggregationSpec {
|
|
199
|
-
aggregate?: boolean;
|
|
200
|
-
topN?: number | null;
|
|
201
|
-
}
|
|
202
|
-
export type ChartAggregationSpec = IChartAggregationSpec;
|
|
203
|
-
export interface IChartPieSpec {
|
|
204
|
-
doughnutHole?: number | null;
|
|
205
|
-
borderColor?: string;
|
|
206
|
-
hasPaddingAngle?: boolean;
|
|
207
|
-
isHalfPie?: boolean;
|
|
208
|
-
rosePie?: boolean;
|
|
209
|
-
showLabelLine?: boolean;
|
|
210
|
-
valueScale?: number;
|
|
211
|
-
valueSuffix?: string;
|
|
212
|
-
digitalFixed?: number;
|
|
213
|
-
label?: {
|
|
214
|
-
visible?: boolean;
|
|
215
|
-
position?: 'inside' | 'outside';
|
|
216
|
-
contentType?: LabelContentType;
|
|
217
|
-
color?: string;
|
|
218
|
-
fontSize?: number;
|
|
219
|
-
bold?: boolean;
|
|
220
|
-
italic?: boolean;
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
export type ChartPieSpec = IChartPieSpec;
|
|
224
|
-
export interface IChartRadarSpec {
|
|
225
|
-
shape?: RadarShape;
|
|
226
|
-
fill?: boolean;
|
|
227
|
-
}
|
|
228
|
-
export type ChartRadarSpec = IChartRadarSpec;
|
|
229
|
-
export type ChartAdvancedStylePatch = DeepPartial<Pick<ChartStyle, 'tooltip' | 'area' | 'funnel' | 'relation' | 'waterfall'>>;
|
|
230
|
-
export interface IChartCreateSpec {
|
|
231
|
-
type: ChartKnownTypeName;
|
|
82
|
+
export interface IChartCreateSpec extends ChartModelCreateSpec {
|
|
232
83
|
source: ChartSourceSpec;
|
|
233
84
|
anchor?: ChartAnchorSpec;
|
|
234
85
|
position?: {
|
|
@@ -236,39 +87,40 @@ export interface IChartCreateSpec {
|
|
|
236
87
|
y: number;
|
|
237
88
|
};
|
|
238
89
|
size?: ChartSizeSpec;
|
|
239
|
-
title?: ChartTitleSpec;
|
|
240
|
-
legend?: ChartLegendSpec;
|
|
241
|
-
axes?: ChartAxesSpec;
|
|
242
|
-
series?: ChartSeriesPatch[];
|
|
243
|
-
wordCloud?: ChartWordCloudSpec;
|
|
244
|
-
appearance?: ChartAppearanceSpec;
|
|
245
|
-
mapping?: ChartMappingSpec;
|
|
246
|
-
aggregation?: ChartAggregationSpec;
|
|
247
|
-
pie?: ChartPieSpec;
|
|
248
|
-
radar?: ChartRadarSpec;
|
|
249
|
-
advancedStyle?: ChartAdvancedStylePatch;
|
|
250
|
-
theme?: string;
|
|
251
90
|
}
|
|
252
91
|
export type ChartCreateSpec = IChartCreateSpec;
|
|
253
|
-
export interface IChartUpdatePatch {
|
|
254
|
-
type?: ChartKnownTypeName;
|
|
92
|
+
export interface IChartUpdatePatch extends ChartModelPatch {
|
|
255
93
|
source?: ChartSourceSpec;
|
|
256
|
-
title?: ChartTitleSpec;
|
|
257
|
-
legend?: ChartLegendSpec;
|
|
258
|
-
axes?: ChartAxesSpec;
|
|
259
|
-
series?: ChartSeriesPatch[];
|
|
260
|
-
wordCloud?: ChartWordCloudSpec;
|
|
261
|
-
appearance?: ChartAppearanceSpec;
|
|
262
|
-
mapping?: ChartMappingSpec;
|
|
263
|
-
aggregation?: ChartAggregationSpec;
|
|
264
|
-
pie?: ChartPieSpec;
|
|
265
|
-
radar?: ChartRadarSpec;
|
|
266
|
-
advancedStyle?: ChartAdvancedStylePatch;
|
|
267
|
-
theme?: string;
|
|
268
94
|
layout?: ChartLayoutPatch;
|
|
269
95
|
}
|
|
270
96
|
export type ChartUpdatePatch = IChartUpdatePatch;
|
|
271
|
-
export
|
|
97
|
+
export declare const ChartDiagnosticCode: {
|
|
98
|
+
readonly ChartNotFound: "CHART_NOT_FOUND";
|
|
99
|
+
readonly SeriesNotFound: "SERIES_NOT_FOUND";
|
|
100
|
+
readonly AmbiguousSeriesSelector: "AMBIGUOUS_SERIES_SELECTOR";
|
|
101
|
+
readonly InvalidRange: "INVALID_RANGE";
|
|
102
|
+
readonly SingleCellSource: "SINGLE_CELL_SOURCE";
|
|
103
|
+
readonly NoNumericSeries: "NO_NUMERIC_SERIES";
|
|
104
|
+
readonly NoPositiveParetoValues: "NO_POSITIVE_PARETO_VALUES";
|
|
105
|
+
readonly UnknownChartType: "UNKNOWN_CHART_TYPE";
|
|
106
|
+
readonly UnsupportedChartType: "UNSUPPORTED_CHART_TYPE";
|
|
107
|
+
readonly InvalidSize: "INVALID_SIZE";
|
|
108
|
+
readonly InvalidColor: "INVALID_COLOR";
|
|
109
|
+
readonly CommandFailed: "COMMAND_FAILED";
|
|
110
|
+
readonly UnknownOption: "UNKNOWN_OPTION";
|
|
111
|
+
};
|
|
112
|
+
export type ChartDiagnosticCode = typeof ChartDiagnosticCode[keyof typeof ChartDiagnosticCode];
|
|
113
|
+
export declare enum ChartFacadeHostGroup {
|
|
114
|
+
Source = "source",
|
|
115
|
+
Layout = "layout"
|
|
116
|
+
}
|
|
117
|
+
export declare enum ChartFacadeCreateLayoutKey {
|
|
118
|
+
Anchor = "anchor",
|
|
119
|
+
Position = "position",
|
|
120
|
+
Size = "size"
|
|
121
|
+
}
|
|
122
|
+
export type ChartFacadeCapabilityGroup = ChartModelPatchGroup | ChartFacadeHostGroup;
|
|
123
|
+
export type ChartChangedGroup = ChartModelChangedGroup | ChartFacadeHostGroup;
|
|
272
124
|
export interface IChartDiagnostic {
|
|
273
125
|
code: ChartDiagnosticCode;
|
|
274
126
|
severity: 'error' | 'warning';
|
|
@@ -285,11 +137,11 @@ export interface IChartValidationResult<TNormalized = unknown> {
|
|
|
285
137
|
normalized?: DeepReadonly<TNormalized>;
|
|
286
138
|
}
|
|
287
139
|
export type ChartValidationResult<TNormalized = unknown> = IChartValidationResult<TNormalized>;
|
|
288
|
-
export interface IChartUpdateResult {
|
|
140
|
+
export interface IChartUpdateResult extends FChartUpdateResult<FChart, ChartChangedGroup, ChartDiagnostic> {
|
|
289
141
|
ok: boolean;
|
|
290
142
|
chart: FChart | null;
|
|
291
143
|
diagnostics: ChartDiagnostic[];
|
|
292
|
-
changed:
|
|
144
|
+
changed: ChartChangedGroup[];
|
|
293
145
|
}
|
|
294
146
|
export type ChartUpdateResult = IChartUpdateResult;
|
|
295
147
|
export interface IChartSuggestion {
|
|
@@ -298,62 +150,38 @@ export interface IChartSuggestion {
|
|
|
298
150
|
reason?: string;
|
|
299
151
|
}
|
|
300
152
|
export type ChartSuggestion = IChartSuggestion;
|
|
301
|
-
export interface IChartCapabilities {
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
patchSemantics: {
|
|
305
|
-
omitted: 'noChange';
|
|
306
|
-
undefined: 'noChange';
|
|
307
|
-
null: 'clearWhereSupported';
|
|
308
|
-
object: 'semanticMerge';
|
|
309
|
-
array: 'replaceUnlessSelectorMerge';
|
|
310
|
-
unknownField: 'validationError';
|
|
311
|
-
};
|
|
312
|
-
createGroups: readonly string[];
|
|
313
|
-
updateGroups: readonly string[];
|
|
314
|
-
styleGroups: readonly string[];
|
|
315
|
-
advancedStyle: {
|
|
316
|
-
supported: boolean;
|
|
317
|
-
};
|
|
153
|
+
export interface IChartCapabilities extends Omit<ChartModelCapabilities, 'createGroups' | 'updateGroups'> {
|
|
154
|
+
createGroups: readonly ChartFacadeCapabilityGroup[];
|
|
155
|
+
updateGroups: readonly ChartFacadeCapabilityGroup[];
|
|
318
156
|
}
|
|
319
157
|
export type ChartCapabilities = IChartCapabilities;
|
|
320
158
|
export interface IChartInstanceCapabilities extends IChartCapabilities {
|
|
321
159
|
chartId: string;
|
|
322
160
|
type: ChartTypeName;
|
|
323
161
|
rawType?: number;
|
|
324
|
-
unsupportedGroups: readonly
|
|
162
|
+
unsupportedGroups: readonly ChartFacadeCapabilityGroup[];
|
|
325
163
|
}
|
|
326
164
|
export type ChartInstanceCapabilities = IChartInstanceCapabilities;
|
|
327
|
-
export
|
|
165
|
+
export type ChartExportImageOptions = IChartRenderModelImageExportOptions;
|
|
166
|
+
export type ChartExportImageResult = IChartRenderModelImageExportResult;
|
|
167
|
+
export interface IChartRangeSourceDescription {
|
|
328
168
|
range: IRange;
|
|
169
|
+
ranges?: never;
|
|
329
170
|
sheetName?: string;
|
|
330
171
|
sheetId: string;
|
|
331
172
|
unitId: string;
|
|
332
173
|
orientation: ChartSourceOrientation;
|
|
333
174
|
}
|
|
334
|
-
export
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
point?: ChartSeriesPatch['point'];
|
|
343
|
-
rightAxis?: boolean;
|
|
344
|
-
label?: {
|
|
345
|
-
visible?: boolean;
|
|
346
|
-
position?: 'top' | 'bottom' | 'inside' | 'outside';
|
|
347
|
-
contentType?: LabelContentType;
|
|
348
|
-
color?: string;
|
|
349
|
-
fontSize?: number;
|
|
350
|
-
bold?: boolean;
|
|
351
|
-
italic?: boolean;
|
|
352
|
-
};
|
|
353
|
-
dataPoints?: ChartSeriesPatch['dataPoints'];
|
|
354
|
-
data?: DeepReadonly<IChartDataSeries>;
|
|
175
|
+
export interface IChartSourceVectorDescription {
|
|
176
|
+
range: IChartRangeSourceDescription;
|
|
177
|
+
header?: IChartRangeSourceDescription;
|
|
178
|
+
}
|
|
179
|
+
export interface IChartMultiRangeSourceDescription {
|
|
180
|
+
range?: never;
|
|
181
|
+
ranges: IChartSourceVectorDescription[];
|
|
182
|
+
orientation: 'rows' | 'columns';
|
|
355
183
|
}
|
|
356
|
-
export type
|
|
184
|
+
export type ChartSourceDescription = IChartRangeSourceDescription | IChartMultiRangeSourceDescription;
|
|
357
185
|
export interface IChartLayoutDescription {
|
|
358
186
|
position?: {
|
|
359
187
|
x: number;
|
|
@@ -368,26 +196,17 @@ export interface IChartLayoutDescription {
|
|
|
368
196
|
};
|
|
369
197
|
}
|
|
370
198
|
export type ChartLayoutDescription = IChartLayoutDescription;
|
|
371
|
-
export interface IChartDescription {
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
199
|
+
export interface IChartDescription extends Omit<ChartModelDescription, 'diagnostics'>, FChartDescription<{
|
|
200
|
+
unitId: string;
|
|
201
|
+
subUnitId: string;
|
|
202
|
+
chartId: string;
|
|
203
|
+
}, {
|
|
204
|
+
kind: ChartSourceKind;
|
|
205
|
+
source: ChartSourceDescription | null;
|
|
206
|
+
}> {
|
|
375
207
|
diagnostics?: ChartDiagnostic[];
|
|
376
208
|
source: ChartSourceDescription | null;
|
|
377
|
-
title?: ChartTitleSpec;
|
|
378
|
-
legend?: ChartLegendSpec;
|
|
379
|
-
axes?: ChartAxesSpec;
|
|
380
|
-
wordCloud?: ChartWordCloudDescription;
|
|
381
|
-
appearance?: ChartAppearanceSpec;
|
|
382
|
-
mapping?: ChartMappingSpec;
|
|
383
|
-
aggregation?: ChartAggregationSpec;
|
|
384
|
-
pie?: ChartPieSpec;
|
|
385
|
-
radar?: ChartRadarSpec;
|
|
386
|
-
series: ChartSeriesDescription[];
|
|
387
|
-
category?: DeepReadonly<IChartDataCategory>;
|
|
388
|
-
theme?: string;
|
|
389
209
|
layout?: ChartLayoutDescription;
|
|
390
|
-
rawStyle?: DeepReadonly<ChartStyle>;
|
|
391
210
|
}
|
|
392
211
|
export type ChartDescription = IChartDescription;
|
|
393
212
|
export type { IEchartTheme };
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import type { IChartDataCategory, IChartDataSeries } from '@univerjs-pro/engine-chart';
|
|
1
|
+
import type { ChartKnownTypeName, IChartDataCategory, IChartDataSeries } from '@univerjs-pro/engine-chart';
|
|
2
2
|
import type { ISheetChartSourceSingleRange } from '@univerjs-pro/sheets-chart';
|
|
3
3
|
import type { Injector } from '@univerjs/core';
|
|
4
|
-
import type { ChartDescription,
|
|
4
|
+
import type { ChartDescription, ChartExportImageOptions, ChartExportImageResult, ChartInstanceCapabilities, ChartLayoutPatch, ChartSourceSpec, ChartUpdatePatch, ChartUpdateResult, ChartValidationResult } from './chart-facade-types';
|
|
5
|
+
import { FBaseChart } from '@univerjs-pro/engine-chart';
|
|
5
6
|
import { FChartBuilderBase } from './chart-builder/chart-builder-base';
|
|
6
7
|
import { ChartUpdateBuilder } from './chart-facade-builders';
|
|
7
8
|
/**
|
|
8
9
|
* The facade class for the chart.
|
|
9
10
|
* @hideconstructor
|
|
10
11
|
*/
|
|
11
|
-
export declare class FChart {
|
|
12
|
+
export declare class FChart extends FBaseChart<ChartDescription, ChartUpdateResult> {
|
|
12
13
|
/**
|
|
13
14
|
* @ignore
|
|
14
15
|
*/
|
|
@@ -37,6 +38,7 @@ export declare class FChart {
|
|
|
37
38
|
* ```
|
|
38
39
|
*/
|
|
39
40
|
getChartId(): string;
|
|
41
|
+
getId(): string;
|
|
40
42
|
/**
|
|
41
43
|
* Get the range of the chart.
|
|
42
44
|
* @returns {ISheetChartSourceSingleRange|undefined} The range of the chart.
|
|
@@ -129,12 +131,33 @@ export declare class FChart {
|
|
|
129
131
|
/**
|
|
130
132
|
* Returns a new FChartBuilderBase instance that modifies this chart.
|
|
131
133
|
* @returns {FChartBuilderBase} The new FChartBuilderBase instance.
|
|
134
|
+
* @see {@link update} for structured semantic patches and diagnostics.
|
|
132
135
|
*/
|
|
133
136
|
modify(): FChartBuilderBase;
|
|
137
|
+
/**
|
|
138
|
+
* Returns a frozen semantic snapshot of this chart, or null if it no longer exists.
|
|
139
|
+
* `rawStyle` is read-only debug information and is not accepted as update input.
|
|
140
|
+
*/
|
|
134
141
|
describe(): ChartDescription | null;
|
|
142
|
+
/** Returns verified patch groups for this chart's concrete type. */
|
|
135
143
|
getCapabilities(): ChartInstanceCapabilities | null;
|
|
144
|
+
/**
|
|
145
|
+
* Renders this chart through the shared engine-chart image export Seam.
|
|
146
|
+
* Returns data URL metadata, or null when the chart/drawing input is unavailable.
|
|
147
|
+
* The promise rejects when no render model is registered or rendering fails.
|
|
148
|
+
*/
|
|
149
|
+
exportImage(options?: ChartExportImageOptions): Promise<ChartExportImageResult | null>;
|
|
150
|
+
/** Validates and normalizes a semantic patch without executing commands. */
|
|
136
151
|
validateUpdate(patch: ChartUpdatePatch): ChartValidationResult<ChartUpdatePatch>;
|
|
152
|
+
/** Returns a convenience adapter that builds the same JSON patch accepted by `update()`. */
|
|
137
153
|
newUpdateBuilder(): ChartUpdateBuilder;
|
|
154
|
+
/**
|
|
155
|
+
* Applies a semantic merge patch.
|
|
156
|
+
*
|
|
157
|
+
* Omitted/undefined fields are unchanged; null clears fields that explicitly
|
|
158
|
+
* support clearing. The result contains diagnostics and changed groups rather
|
|
159
|
+
* than throwing for validation or command failures.
|
|
160
|
+
*/
|
|
138
161
|
update(patch: ChartUpdatePatch): Promise<ChartUpdateResult>;
|
|
139
162
|
setSource(source: ChartSourceSpec): Promise<ChartUpdateResult>;
|
|
140
163
|
setType(type: ChartKnownTypeName): Promise<ChartUpdateResult>;
|
|
@@ -1,25 +1,90 @@
|
|
|
1
1
|
import type { ChartCapabilities, ChartCreateSpec, ChartSourceSpec, ChartSuggestion, ChartUpdatePatch, ChartUpdateResult, ChartValidationResult } from './chart-facade-types';
|
|
2
|
+
import { FBaseCharts } from '@univerjs-pro/engine-chart';
|
|
2
3
|
import { FWorksheet } from '@univerjs/sheets/facade';
|
|
3
4
|
import { ChartCreateBuilder } from './chart-facade-builders';
|
|
4
5
|
import { FChart } from './f-chart';
|
|
5
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Structured chart authoring for a worksheet.
|
|
8
|
+
*
|
|
9
|
+
* JSON create/update specs are the canonical Interface. Builders returned by
|
|
10
|
+
* `newBuilder()` compile to the same specs and are optional convenience adapters.
|
|
11
|
+
*/
|
|
12
|
+
export declare class FWorksheetCharts extends FBaseCharts<FChart, ChartCreateSpec, ChartCapabilities> {
|
|
6
13
|
private readonly _worksheet;
|
|
7
14
|
constructor(_worksheet: FWorksheet);
|
|
15
|
+
/**
|
|
16
|
+
* Creates a chart from a serializable semantic spec.
|
|
17
|
+
*
|
|
18
|
+
* Call `validateCreate()` for a side-effect-free preflight. Validation or
|
|
19
|
+
* command failure throws `ChartFacadeError`, whose `diagnostics` explain the
|
|
20
|
+
* rejected fields.
|
|
21
|
+
*/
|
|
8
22
|
create(spec: ChartCreateSpec): Promise<FChart>;
|
|
23
|
+
/** Applies a semantic merge patch and returns diagnostics plus changed groups. */
|
|
9
24
|
update(chart: FChart | string, patch: ChartUpdatePatch): Promise<ChartUpdateResult>;
|
|
10
25
|
remove(chart: FChart | string): Promise<boolean>;
|
|
26
|
+
/** Returns chart handles owned by this worksheet. */
|
|
11
27
|
list(): FChart[];
|
|
28
|
+
/** Returns the worksheet chart with `chartId`, or null when it is absent. */
|
|
12
29
|
get(chartId: string): FChart | null;
|
|
30
|
+
/** Validates and normalizes a create spec without executing commands. */
|
|
13
31
|
validateCreate(spec: ChartCreateSpec): ChartValidationResult<ChartCreateSpec>;
|
|
32
|
+
/** Describes runtime chart types, patch semantics, and available groups. */
|
|
14
33
|
getCapabilities(): ChartCapabilities;
|
|
34
|
+
/** Returns a convenience adapter that builds the same JSON spec accepted by `create()`. */
|
|
15
35
|
newBuilder(): ChartCreateBuilder;
|
|
16
36
|
suggest(source: ChartSourceSpec): ChartSuggestion[];
|
|
17
37
|
private _sourceContext;
|
|
18
38
|
}
|
|
19
39
|
export interface IFWorksheetChartsMixin {
|
|
40
|
+
/**
|
|
41
|
+
* Structured chart authoring, inspection, repair, and image export.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```ts
|
|
45
|
+
* const worksheet = univerAPI.getActiveWorkbook()?.getActiveSheet();
|
|
46
|
+
* if (!worksheet) return;
|
|
47
|
+
*
|
|
48
|
+
* const chart = await worksheet.charts.create({
|
|
49
|
+
* type: 'pareto',
|
|
50
|
+
* source: 'A1:B8',
|
|
51
|
+
* pareto: {
|
|
52
|
+
* barColor: '#1677ff',
|
|
53
|
+
* cumulativeLineColor: '#f5222d',
|
|
54
|
+
* },
|
|
55
|
+
* });
|
|
56
|
+
* const before = chart.describe();
|
|
57
|
+
* const result = await chart.update({
|
|
58
|
+
* pareto: { cumulativeLineColor: '#722ed1' },
|
|
59
|
+
* });
|
|
60
|
+
* if (!result.ok) console.log(result.diagnostics);
|
|
61
|
+
* const after = chart.describe();
|
|
62
|
+
* const image = await chart.exportImage({ pixelRatio: 2 });
|
|
63
|
+
* console.log({ before, after, image });
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
20
66
|
readonly charts: FWorksheetCharts;
|
|
21
67
|
}
|
|
22
68
|
export declare class FWorksheetChartsMixin extends FWorksheet implements IFWorksheetChartsMixin {
|
|
69
|
+
/**
|
|
70
|
+
* Structured chart authoring, inspection, repair, capabilities, and image export.
|
|
71
|
+
* Prefer serializable create/update specs; use `describe()` before repairing an
|
|
72
|
+
* existing chart and inspect update diagnostics before reading it back.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```ts
|
|
76
|
+
* const chart = await worksheet.charts.create({
|
|
77
|
+
* type: 'pareto',
|
|
78
|
+
* source: 'A1:B8',
|
|
79
|
+
* pareto: { barColor: '#1677ff', cumulativeLineColor: '#f5222d' },
|
|
80
|
+
* });
|
|
81
|
+
* const before = chart.describe();
|
|
82
|
+
* const result = await chart.update({ pareto: { barColor: '#722ed1' } });
|
|
83
|
+
* if (!result.ok) console.log(result.diagnostics);
|
|
84
|
+
* const after = chart.describe();
|
|
85
|
+
* const image = await chart.exportImage({ pixelRatio: 2 });
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
23
88
|
get charts(): FWorksheetCharts;
|
|
24
89
|
}
|
|
25
90
|
declare module '@univerjs/sheets/facade' {
|
|
@@ -27,6 +27,7 @@ export interface IFWorksheetChartMixin {
|
|
|
27
27
|
* .build();
|
|
28
28
|
* await fWorksheet.insertChart(chartInfo);
|
|
29
29
|
* ```
|
|
30
|
+
* @see {@link FWorksheetCharts.create} for structured specs and validation diagnostics.
|
|
30
31
|
*/
|
|
31
32
|
insertChart(chartBuildInfo: IChartBuilderInfo): Promise<FChart>;
|
|
32
33
|
/**
|
|
@@ -60,6 +61,7 @@ export interface IFWorksheetChartMixin {
|
|
|
60
61
|
* fWorksheet.updateChart(newChartInfo);
|
|
61
62
|
* }, 3000);
|
|
62
63
|
* ```
|
|
64
|
+
* @see {@link FChart.update} for semantic merge patches and structured diagnostics.
|
|
63
65
|
*/
|
|
64
66
|
updateChart(chartBuildInfo: IChartBuilderInfo): void;
|
|
65
67
|
/**
|
|
@@ -86,6 +88,7 @@ export interface IFWorksheetChartMixin {
|
|
|
86
88
|
* .build();
|
|
87
89
|
* await fWorksheet.insertChart(chartInfo);
|
|
88
90
|
* ```
|
|
91
|
+
* @see {@link FWorksheetCharts} for the canonical structured chart Interface.
|
|
89
92
|
*/
|
|
90
93
|
newChart(fChart?: FChart): FChartBuilderBase;
|
|
91
94
|
/**
|
|
@@ -9,6 +9,7 @@ export { PieChartBuilder } from './chart-builder/pie-chart-builder';
|
|
|
9
9
|
export { RadarChartBuilder } from './chart-builder/radar-chart-builder';
|
|
10
10
|
export { ChartFacadeError } from './chart-facade-adapter';
|
|
11
11
|
export { ChartCreateBuilder, ChartUpdateBuilder } from './chart-facade-builders';
|
|
12
|
+
export { ChartSourceKind, ChartSourceOrientation } from './chart-facade-types';
|
|
12
13
|
export type * from './chart-facade-types';
|
|
13
14
|
export { FChart } from './f-chart';
|
|
14
15
|
export type * from './f-chart';
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export { ChartDataSourceMulti, ChartDataSourceSingle, createChartDataSource, getCategoryData, } from './chart-source/chart-source';
|
|
2
1
|
export { ChartUpdateConfigCommand } from './commands/commands/sheets-chart-update-config.command';
|
|
3
2
|
export type { IChartUpdateConfigCommandParams } from './commands/commands/sheets-chart-update-config.command';
|
|
4
3
|
export { ChartUpdateSourceCommand } from './commands/commands/sheets-chart-update-source.command';
|
|
@@ -9,13 +8,13 @@ export { ChartUpdateSourceConfigMutation } from './commands/mutations/sheet-char
|
|
|
9
8
|
export type { IChartUpdateSourceConfigMutationParams } from './commands/mutations/sheet-chart-update-source.mutation';
|
|
10
9
|
export { ChartUpdateConfigMutation } from './commands/mutations/sheets-chart-update-config.mutation';
|
|
11
10
|
export type { IChartUpdateConfigMutationParams } from './commands/mutations/sheets-chart-update-config.mutation';
|
|
12
|
-
export { InsertSheetsChartMutation, RemoveSheetsChartMutation } from './commands/mutations/sheets-chart.mutation';
|
|
11
|
+
export { InsertSheetsChartMutation, RemoveSheetsChartMutation, toInsertChartMutationSource, } from './commands/mutations/sheets-chart.mutation';
|
|
13
12
|
export type { IInsertSheetsChartMutationParams, IRemoveSheetsChartMutationParams, } from './commands/mutations/sheets-chart.mutation';
|
|
14
|
-
export {
|
|
15
|
-
export { ChartRenderMode, SHEETS_CHART_PLUGIN_CONFIG_KEY } from './config/config';
|
|
13
|
+
export { getAllowedChartTypes, setProperty, } from './common/util';
|
|
14
|
+
export { ChartRenderMode, SHEETS_CHART_PLUGIN_CONFIG_KEY, } from './config/config';
|
|
16
15
|
export type { IUniverSheetsChartConfig } from './config/config';
|
|
17
16
|
export { SheetChartModel } from './models/chart-model';
|
|
18
|
-
export type { IChartSourceMultiRangeItem, IChartSourceRangeItem, ISheetChartSourceSingleRange } from './models/types';
|
|
19
|
-
export { SHEETS_CHART_PLUGIN_NAME, UniverSheetsChartPlugin } from './plugin';
|
|
17
|
+
export type { IChartSourceMultiRangeItem, IChartSourceRangeItem, ISheetChartSourceSingleRange, } from './models/types';
|
|
18
|
+
export { SHEETS_CHART_PLUGIN_NAME, UniverSheetsChartPlugin, } from './plugin';
|
|
20
19
|
export { ChartModelService } from './services/chart-model.service';
|
|
21
20
|
export { SheetsChartService } from './services/sheets-chart.service';
|