@univerjs-pro/engine-chart 0.24.0 → 0.25.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,6 +1,8 @@
1
1
  export { AreaLineStyle, AxisAlignEnum, AxisValueType, CategoryType, ChartAttributeBits, ChartBorderDashType, ChartSourceDataTypeEnum, ChartTrendlineType, ChartTypeBits, DataOrientation, InvalidValueType, IRuntimeAxisPosition, IRuntimeAxisPriority, LabelAlignEnum, LabelContentType, LegendPositionEnum, LinePointShape, PieLabelPosition, RadarShape, RelationChartLayoutEnum, SelectModeEnum, SeriesLabelPosition, StackType, TextAlign, TextVerticalAlign, TitlePositionEnum, WaterfallSeriesTypeEnum, WaterfallStackTypeEnum, WordCloudShapeEnum, } from './enum';
2
2
  export { buildChartData } from './model/chart-data-operators/build-chart-data';
3
- export { findCategoryIndexes, findCategoryOperator, findHeaderOperator, findSeriesOperator, pieSeriesFilterOperator } from './model/chart-data-operators/operators';
3
+ export { findCategoryIndexes, findCategoryOperator, findHeaderOperator, findSeriesOperator, pieSeriesFilterOperator, } from './model/chart-data-operators/operators';
4
+ export type { IChartLocaleTexts } from './model/chart-locale-texts';
5
+ export { getDefaultChartLocaleTexts, replaceLocaleParams } from './model/chart-locale-texts';
4
6
  export { ChartModel } from './model/chart-model';
5
7
  export { CHART_DEBOUNCE_TIME } from './model/chart-model';
6
8
  export { ChartThemeService, registerChartThemeService } from './model/chart-theme.service';
@@ -1,4 +1,4 @@
1
- import type { LocaleService } from '@univerjs/core';
2
1
  import type { IChartContext, IChartData, IUniverDataSet } from '../../types';
2
+ import type { IChartLocaleTexts } from '../chart-locale-texts';
3
3
  import { ChartTypeBits } from '../../enum';
4
- export declare function buildChartData(dataSource: IUniverDataSet, chartContext: IChartContext, chartType: ChartTypeBits, isRowDirection: boolean, localeService: LocaleService): IChartData;
4
+ export declare function buildChartData(dataSource: IUniverDataSet, chartContext: IChartContext, chartType: ChartTypeBits, isRowDirection: boolean, localeTexts: IChartLocaleTexts): IChartData;
@@ -0,0 +1,22 @@
1
+ export interface IChartLocaleTexts {
2
+ seriesDefaultName: string;
3
+ categoryDefaultName: string;
4
+ blank: string;
5
+ boxplotMin: string;
6
+ boxplotQ1: string;
7
+ boxplotMedian: string;
8
+ boxplotQ3: string;
9
+ boxplotMax: string;
10
+ bubbleEmptyTips: string;
11
+ cloudWord: string;
12
+ cloudFrequency: string;
13
+ msgEmptyTips: string;
14
+ msgSankeyCircularTips: string;
15
+ paretoLineName: string;
16
+ relationEmptyTips: string;
17
+ waterfallPositive: string;
18
+ waterfallNegative: string;
19
+ waterfallSubtotal: string;
20
+ }
21
+ export declare function replaceLocaleParams(text: string, ...args: string[]): string;
22
+ export declare function getDefaultChartLocaleTexts(): IChartLocaleTexts;
@@ -1,9 +1,10 @@
1
1
  import type { Injector } from '@univerjs/core';
2
2
  import type { Observable, Subscription } from 'rxjs';
3
3
  import type { ChartStyle, IChartConfig, IChartContext, IChartDataAggregation, IChartDataSource, IChartRuntimeContext, IChartSnapshot, IRuntimeAxis } from '../types';
4
- import { Disposable, LocaleService } from '@univerjs/core';
4
+ import { Disposable } from '@univerjs/core';
5
5
  import { BehaviorSubject } from 'rxjs';
6
6
  import { ChartTypeBits } from '../enum';
7
+ import type { IChartLocaleTexts } from './chart-locale-texts';
7
8
  import { ChartThemeService } from './chart-theme.service';
8
9
  import { WordCloudMuskImageService } from './word-cloud-musk-image.service';
9
10
  export interface IChartModelInit {
@@ -12,11 +13,12 @@ export interface IChartModelInit {
12
13
  dataAggregation?: IChartDataAggregation;
13
14
  context?: Pick<IChartContext, 'categoryIndex' | 'seriesIndexes' | 'transform'>;
14
15
  style?: ChartStyle;
16
+ localeTexts?: IChartLocaleTexts;
15
17
  }
16
18
  export declare const CHART_DEBOUNCE_TIME = 0;
17
19
  export declare class ChartModel extends Disposable {
18
20
  readonly id: string;
19
- private _options;
21
+ protected _options: IChartModelInit;
20
22
  private _injector;
21
23
  protected _dataSource: IChartDataSource;
22
24
  get dataSource(): IChartDataSource;
@@ -104,91 +106,25 @@ export declare class ChartModel extends Disposable {
104
106
  getRenderColor?: {} | undefined;
105
107
  isDarkMode?: boolean | undefined;
106
108
  hasSecondaryAxis?: boolean | undefined;
107
- localeService?: {
108
- readonly currentLocale$?: {
109
- source?: {
110
- source?: /*elided*/ any | undefined;
111
- operator?: {
112
- call?: {} | undefined;
113
- } | undefined;
114
- lift?: {} | undefined;
115
- subscribe?: {} | undefined;
116
- forEach?: {} | undefined;
117
- pipe?: {} | undefined;
118
- toPromise?: {} | undefined;
119
- } | undefined;
120
- operator?: {
121
- call?: {} | undefined;
122
- } | undefined;
123
- lift?: {} | undefined;
124
- subscribe?: {} | undefined;
125
- forEach?: {} | undefined;
126
- pipe?: {} | undefined;
127
- toPromise?: {} | undefined;
128
- } | undefined;
129
- readonly direction$?: {
130
- source?: {
131
- source?: /*elided*/ any | undefined;
132
- operator?: {
133
- call?: {} | undefined;
134
- } | undefined;
135
- lift?: {} | undefined;
136
- subscribe?: {} | undefined;
137
- forEach?: {} | undefined;
138
- pipe?: {} | undefined;
139
- toPromise?: {} | undefined;
140
- } | undefined;
141
- operator?: {
142
- call?: {} | undefined;
143
- } | undefined;
144
- lift?: {} | undefined;
145
- subscribe?: {} | undefined;
146
- forEach?: {} | undefined;
147
- pipe?: {} | undefined;
148
- toPromise?: {} | undefined;
149
- } | undefined;
150
- localeChanged$?: {
151
- closed?: boolean | undefined;
152
- observers?: import("rxjs").Observer<void>[] | undefined;
153
- isStopped?: boolean | undefined;
154
- hasError?: boolean | undefined;
155
- thrownError?: any;
156
- lift?: {} | undefined;
157
- next?: {} | undefined;
158
- error?: {} | undefined;
159
- complete?: {} | undefined;
160
- unsubscribe?: {} | undefined;
161
- readonly observed?: boolean | undefined;
162
- asObservable?: {} | undefined;
163
- source?: {
164
- source?: /*elided*/ any | undefined;
165
- operator?: {
166
- call?: {} | undefined;
167
- } | undefined;
168
- lift?: {} | undefined;
169
- subscribe?: {} | undefined;
170
- forEach?: {} | undefined;
171
- pipe?: {} | undefined;
172
- toPromise?: {} | undefined;
173
- } | undefined;
174
- operator?: {
175
- call?: {} | undefined;
176
- } | undefined;
177
- subscribe?: {} | undefined;
178
- forEach?: {} | undefined;
179
- pipe?: {} | undefined;
180
- toPromise?: {} | undefined;
181
- } | undefined;
182
- load?: {} | undefined;
183
- t?: (key: string, ...args: string[]) => string;
184
- setLocale?: {} | undefined;
185
- getLocales?: {} | undefined;
186
- getCurrentLocale?: {} | undefined;
187
- setDirection?: {} | undefined;
188
- getDirection?: {} | undefined;
189
- resolveKeyPath?: {} | undefined;
190
- disposeWithMe?: {} | undefined;
191
- dispose?: {} | undefined;
109
+ localeTexts?: {
110
+ seriesDefaultName?: string | undefined;
111
+ categoryDefaultName?: string | undefined;
112
+ blank?: string | undefined;
113
+ boxplotMin?: string | undefined;
114
+ boxplotQ1?: string | undefined;
115
+ boxplotMedian?: string | undefined;
116
+ boxplotQ3?: string | undefined;
117
+ boxplotMax?: string | undefined;
118
+ bubbleEmptyTips?: string | undefined;
119
+ cloudWord?: string | undefined;
120
+ cloudFrequency?: string | undefined;
121
+ msgEmptyTips?: string | undefined;
122
+ msgSankeyCircularTips?: string | undefined;
123
+ paretoLineName?: string | undefined;
124
+ relationEmptyTips?: string | undefined;
125
+ waterfallPositive?: string | undefined;
126
+ waterfallNegative?: string | undefined;
127
+ waterfallSubtotal?: string | undefined;
192
128
  } | undefined;
193
129
  wordCloudImageMaskMap?: {
194
130
  clear?: {} | undefined;
@@ -1292,91 +1228,25 @@ export declare class ChartModel extends Disposable {
1292
1228
  getRenderColor?: {} | undefined;
1293
1229
  isDarkMode?: boolean | undefined;
1294
1230
  hasSecondaryAxis?: boolean | undefined;
1295
- localeService?: {
1296
- readonly currentLocale$?: {
1297
- source?: {
1298
- source?: /*elided*/ any | undefined;
1299
- operator?: {
1300
- call?: {} | undefined;
1301
- } | undefined;
1302
- lift?: {} | undefined;
1303
- subscribe?: {} | undefined;
1304
- forEach?: {} | undefined;
1305
- pipe?: {} | undefined;
1306
- toPromise?: {} | undefined;
1307
- } | undefined;
1308
- operator?: {
1309
- call?: {} | undefined;
1310
- } | undefined;
1311
- lift?: {} | undefined;
1312
- subscribe?: {} | undefined;
1313
- forEach?: {} | undefined;
1314
- pipe?: {} | undefined;
1315
- toPromise?: {} | undefined;
1316
- } | undefined;
1317
- readonly direction$?: {
1318
- source?: {
1319
- source?: /*elided*/ any | undefined;
1320
- operator?: {
1321
- call?: {} | undefined;
1322
- } | undefined;
1323
- lift?: {} | undefined;
1324
- subscribe?: {} | undefined;
1325
- forEach?: {} | undefined;
1326
- pipe?: {} | undefined;
1327
- toPromise?: {} | undefined;
1328
- } | undefined;
1329
- operator?: {
1330
- call?: {} | undefined;
1331
- } | undefined;
1332
- lift?: {} | undefined;
1333
- subscribe?: {} | undefined;
1334
- forEach?: {} | undefined;
1335
- pipe?: {} | undefined;
1336
- toPromise?: {} | undefined;
1337
- } | undefined;
1338
- localeChanged$?: {
1339
- closed?: boolean | undefined;
1340
- observers?: import("rxjs").Observer<void>[] | undefined;
1341
- isStopped?: boolean | undefined;
1342
- hasError?: boolean | undefined;
1343
- thrownError?: any;
1344
- lift?: {} | undefined;
1345
- next?: {} | undefined;
1346
- error?: {} | undefined;
1347
- complete?: {} | undefined;
1348
- unsubscribe?: {} | undefined;
1349
- readonly observed?: boolean | undefined;
1350
- asObservable?: {} | undefined;
1351
- source?: {
1352
- source?: /*elided*/ any | undefined;
1353
- operator?: {
1354
- call?: {} | undefined;
1355
- } | undefined;
1356
- lift?: {} | undefined;
1357
- subscribe?: {} | undefined;
1358
- forEach?: {} | undefined;
1359
- pipe?: {} | undefined;
1360
- toPromise?: {} | undefined;
1361
- } | undefined;
1362
- operator?: {
1363
- call?: {} | undefined;
1364
- } | undefined;
1365
- subscribe?: {} | undefined;
1366
- forEach?: {} | undefined;
1367
- pipe?: {} | undefined;
1368
- toPromise?: {} | undefined;
1369
- } | undefined;
1370
- load?: {} | undefined;
1371
- t?: (key: string, ...args: string[]) => string;
1372
- setLocale?: {} | undefined;
1373
- getLocales?: {} | undefined;
1374
- getCurrentLocale?: {} | undefined;
1375
- setDirection?: {} | undefined;
1376
- getDirection?: {} | undefined;
1377
- resolveKeyPath?: {} | undefined;
1378
- disposeWithMe?: {} | undefined;
1379
- dispose?: {} | undefined;
1231
+ localeTexts?: {
1232
+ seriesDefaultName?: string | undefined;
1233
+ categoryDefaultName?: string | undefined;
1234
+ blank?: string | undefined;
1235
+ boxplotMin?: string | undefined;
1236
+ boxplotQ1?: string | undefined;
1237
+ boxplotMedian?: string | undefined;
1238
+ boxplotQ3?: string | undefined;
1239
+ boxplotMax?: string | undefined;
1240
+ bubbleEmptyTips?: string | undefined;
1241
+ cloudWord?: string | undefined;
1242
+ cloudFrequency?: string | undefined;
1243
+ msgEmptyTips?: string | undefined;
1244
+ msgSankeyCircularTips?: string | undefined;
1245
+ paretoLineName?: string | undefined;
1246
+ relationEmptyTips?: string | undefined;
1247
+ waterfallPositive?: string | undefined;
1248
+ waterfallNegative?: string | undefined;
1249
+ waterfallSubtotal?: string | undefined;
1380
1250
  } | undefined;
1381
1251
  wordCloudImageMaskMap?: {
1382
1252
  clear?: {} | undefined;
@@ -2480,91 +2350,25 @@ export declare class ChartModel extends Disposable {
2480
2350
  getRenderColor?: {} | undefined;
2481
2351
  isDarkMode?: boolean | undefined;
2482
2352
  hasSecondaryAxis?: boolean | undefined;
2483
- localeService?: {
2484
- readonly currentLocale$?: {
2485
- source?: {
2486
- source?: /*elided*/ any | undefined;
2487
- operator?: {
2488
- call?: {} | undefined;
2489
- } | undefined;
2490
- lift?: {} | undefined;
2491
- subscribe?: {} | undefined;
2492
- forEach?: {} | undefined;
2493
- pipe?: {} | undefined;
2494
- toPromise?: {} | undefined;
2495
- } | undefined;
2496
- operator?: {
2497
- call?: {} | undefined;
2498
- } | undefined;
2499
- lift?: {} | undefined;
2500
- subscribe?: {} | undefined;
2501
- forEach?: {} | undefined;
2502
- pipe?: {} | undefined;
2503
- toPromise?: {} | undefined;
2504
- } | undefined;
2505
- readonly direction$?: {
2506
- source?: {
2507
- source?: /*elided*/ any | undefined;
2508
- operator?: {
2509
- call?: {} | undefined;
2510
- } | undefined;
2511
- lift?: {} | undefined;
2512
- subscribe?: {} | undefined;
2513
- forEach?: {} | undefined;
2514
- pipe?: {} | undefined;
2515
- toPromise?: {} | undefined;
2516
- } | undefined;
2517
- operator?: {
2518
- call?: {} | undefined;
2519
- } | undefined;
2520
- lift?: {} | undefined;
2521
- subscribe?: {} | undefined;
2522
- forEach?: {} | undefined;
2523
- pipe?: {} | undefined;
2524
- toPromise?: {} | undefined;
2525
- } | undefined;
2526
- localeChanged$?: {
2527
- closed?: boolean | undefined;
2528
- observers?: import("rxjs").Observer<void>[] | undefined;
2529
- isStopped?: boolean | undefined;
2530
- hasError?: boolean | undefined;
2531
- thrownError?: any;
2532
- lift?: {} | undefined;
2533
- next?: {} | undefined;
2534
- error?: {} | undefined;
2535
- complete?: {} | undefined;
2536
- unsubscribe?: {} | undefined;
2537
- readonly observed?: boolean | undefined;
2538
- asObservable?: {} | undefined;
2539
- source?: {
2540
- source?: /*elided*/ any | undefined;
2541
- operator?: {
2542
- call?: {} | undefined;
2543
- } | undefined;
2544
- lift?: {} | undefined;
2545
- subscribe?: {} | undefined;
2546
- forEach?: {} | undefined;
2547
- pipe?: {} | undefined;
2548
- toPromise?: {} | undefined;
2549
- } | undefined;
2550
- operator?: {
2551
- call?: {} | undefined;
2552
- } | undefined;
2553
- subscribe?: {} | undefined;
2554
- forEach?: {} | undefined;
2555
- pipe?: {} | undefined;
2556
- toPromise?: {} | undefined;
2557
- } | undefined;
2558
- load?: {} | undefined;
2559
- t?: (key: string, ...args: string[]) => string;
2560
- setLocale?: {} | undefined;
2561
- getLocales?: {} | undefined;
2562
- getCurrentLocale?: {} | undefined;
2563
- setDirection?: {} | undefined;
2564
- getDirection?: {} | undefined;
2565
- resolveKeyPath?: {} | undefined;
2566
- disposeWithMe?: {} | undefined;
2567
- dispose?: {} | undefined;
2353
+ localeTexts?: {
2354
+ seriesDefaultName?: string | undefined;
2355
+ categoryDefaultName?: string | undefined;
2356
+ blank?: string | undefined;
2357
+ boxplotMin?: string | undefined;
2358
+ boxplotQ1?: string | undefined;
2359
+ boxplotMedian?: string | undefined;
2360
+ boxplotQ3?: string | undefined;
2361
+ boxplotMax?: string | undefined;
2362
+ bubbleEmptyTips?: string | undefined;
2363
+ cloudWord?: string | undefined;
2364
+ cloudFrequency?: string | undefined;
2365
+ msgEmptyTips?: string | undefined;
2366
+ msgSankeyCircularTips?: string | undefined;
2367
+ paretoLineName?: string | undefined;
2368
+ relationEmptyTips?: string | undefined;
2369
+ waterfallPositive?: string | undefined;
2370
+ waterfallNegative?: string | undefined;
2371
+ waterfallSubtotal?: string | undefined;
2568
2372
  } | undefined;
2569
2373
  wordCloudImageMaskMap?: {
2570
2374
  clear?: {} | undefined;
@@ -3607,7 +3411,6 @@ export declare class ChartModel extends Disposable {
3607
3411
  _init(): void;
3608
3412
  getRuntimeService(): {
3609
3413
  chartThemeService: ChartThemeService;
3610
- localeService: LocaleService;
3611
3414
  wordCloudMuskImageService: WordCloudMuskImageService;
3612
3415
  };
3613
3416
  getRuntimeContext(): IChartRuntimeContext;
@@ -1,6 +1,7 @@
1
1
  import type { Injector } from '@univerjs/core';
2
2
  import type { ChartTypeBits } from '../../enum';
3
3
  import type { ChartStyle, IChartContext, IChartHostRect, IUniverDataSet } from '../../types';
4
+ import type { IChartLocaleTexts } from '../chart-locale-texts';
4
5
  import { StaticChartSource } from '../../source/static-chart-source';
5
6
  import { ChartModel } from '../chart-model';
6
7
  /**
@@ -50,6 +51,7 @@ export interface IChartModelInitParams {
50
51
  * The direction of the data source. If the data source is column direction, the value should be false.The default value is true.
51
52
  */
52
53
  isRowDirection?: boolean;
54
+ localeTexts?: IChartLocaleTexts;
53
55
  }
54
56
  export declare function generateChartModelContext(chartModel: ChartModel, dataSource: StaticChartSource): IChartContext | null;
55
57
  /**
@@ -1,7 +1,8 @@
1
- import type { CellValue, IDisposable, LocaleService, Nullable } from '@univerjs/core';
1
+ import type { CellValue, IDisposable, Nullable } from '@univerjs/core';
2
2
  import type { Observable } from 'rxjs';
3
3
  import type { AreaLineStyle, AxisAlignEnum, AxisValueType, CategoryType, ChartBorderDashType, ChartSourceDataTypeEnum, ChartTrendlineType, ChartTypeBits, DataOrientation, InvalidValueType, IRuntimeAxisPosition, IRuntimeAxisPriority, LabelAlignEnum, LegendPositionEnum, LinePointShape, PieLabelPosition, RadarShape, RelationChartLayoutEnum, SelectModeEnum, SeriesLabelPosition, TitlePositionEnum, WaterfallSeriesTypeEnum, WaterfallStackTypeEnum, WordCloudShapeEnum } from './enum';
4
4
  import type { IEchartTheme } from './model/constants/build-in-theme';
5
+ import type { IChartLocaleTexts } from './model/chart-locale-texts';
5
6
  import type { BarSeriesOption } from './utils/echarts';
6
7
  export type DeepPartial<T> = T extends Record<string, any> ? T extends any[] ? T : {
7
8
  [key in keyof T]+?: DeepPartial<T[key]>;
@@ -173,7 +174,7 @@ export interface IChartRuntimeContext {
173
174
  */
174
175
  isDarkMode: boolean;
175
176
  hasSecondaryAxis: boolean;
176
- localeService: LocaleService;
177
+ localeTexts: IChartLocaleTexts;
177
178
  wordCloudImageMaskMap: Map<string, HTMLImageElement>;
178
179
  }
179
180
  export interface ILabelStyle {