@univerjs-pro/sheets-chart-ui 1.0.0-alpha.1 → 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 +5 -3
- 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/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/index.css +3 -127
- 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/commands/commands/focused-chart.command.d.ts +9 -0
- package/lib/types/commands/operations/open-chart-panel-operation.d.ts +2 -0
- package/lib/types/config/config.d.ts +6 -0
- package/lib/types/controllers/chart-element-float-menu.controller.d.ts +30 -0
- package/lib/types/controllers/chart-render.controller.d.ts +4 -1
- package/lib/types/controllers/ui.controller.d.ts +16 -3
- package/lib/types/hooks.d.ts +2 -4
- package/lib/types/index.d.ts +6 -2
- package/lib/types/locale/en-US.d.ts +2 -0
- package/lib/types/menu/chart-context-menu.d.ts +7 -0
- package/lib/types/plugin.d.ts +5 -3
- package/lib/types/services/chart-content-layout.d.ts +35 -0
- package/lib/types/services/chart-element-popup-anchor.d.ts +10 -0
- package/lib/types/services/chart-element-selection.d.ts +9 -0
- package/lib/types/services/chart-image-rect.d.ts +18 -0
- package/lib/types/services/chart-panel-route.d.ts +20 -0
- package/lib/types/services/chart-render.service.d.ts +47 -10
- package/lib/types/services/chart-snapshot-store.service.d.ts +18 -0
- package/lib/types/services/sheet-chart-host.d.ts +56 -0
- package/lib/types/services/sheet-image-chart-host.d.ts +24 -0
- package/lib/types/services/sheets-chart-host-provider.service.d.ts +37 -13
- package/lib/types/services/sheets-chart-ui.service.d.ts +50 -11
- package/lib/types/views/chart-edit-panel/Options.d.ts +26 -85
- package/lib/types/views/chart-edit-panel/RadarChartOptionsEdit.d.ts +0 -2
- package/lib/types/views/chart-edit-panel/data-tab-panel/BubbleDataEdit.d.ts +1 -6
- package/lib/types/views/chart-edit-panel/data-tab-panel/DataTabPanel.d.ts +0 -3
- package/lib/types/views/chart-edit-panel/style-tab-panel/AxisOptionsEdit.d.ts +0 -2
- package/lib/types/views/chart-edit-panel/style-tab-panel/DataLabelOptions.d.ts +1 -1
- package/lib/types/views/chart-edit-panel/style-tab-panel/ParetoLine.d.ts +0 -2
- package/lib/types/views/chart-edit-panel/style-tab-panel/PieChartStyleEdit.d.ts +0 -2
- package/lib/types/views/chart-edit-panel/style-tab-panel/RelationEdit.d.ts +1 -6
- package/lib/types/views/chart-edit-panel/style-tab-panel/TrendLineEdit.d.ts +1 -6
- package/lib/types/views/chart-edit-panel/style-tab-panel/WaterfallSeriesEdit.d.ts +1 -6
- package/lib/types/views/chart-edit-panel/style-tab-panel/WordCloudShapeSelector.d.ts +1 -6
- package/lib/types/views/chart-edit-panel/style-tab-panel/grid-line-and-tick-options/GridLineAndTickOptions.d.ts +0 -2
- package/lib/types/views/chart-edit-panel/style-tab-panel/series-style-edit/CombinationChartTypeSelect.d.ts +0 -2
- package/lib/types/views/chart-edit-panel/style-tab-panel/series-style-edit/SeriesStyleEdit.d.ts +1 -2
- package/lib/types/views/chart-edit-panel/style-tab-panel/series-style-edit/use-series-chart-type.d.ts +2 -8
- 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 +21 -18
- package/lib/types/views/chart-edit-panel/color-picker-control/index.d.ts +0 -6
- package/lib/types/views/chart-edit-panel/dropdown-menu/index.d.ts +0 -9
- package/lib/types/views/chart-edit-panel/font-format-bar/FontFormatBar.d.ts +0 -16
- package/lib/types/views/chart-edit-panel/font-format-bar/index.d.ts +0 -1
- package/lib/types/views/chart-edit-panel/use-translated-options.d.ts +0 -6
- package/lib/types/views/print-chart/index.d.ts +0 -10
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export interface IChartOuterRect {
|
|
2
|
+
width: number;
|
|
3
|
+
height: number;
|
|
4
|
+
strokeWidth?: number;
|
|
5
|
+
}
|
|
6
|
+
export interface IChartScale {
|
|
7
|
+
scaleX?: number;
|
|
8
|
+
scaleY?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface IChartFloatDomLayout {
|
|
11
|
+
startX: number;
|
|
12
|
+
endX: number;
|
|
13
|
+
startY: number;
|
|
14
|
+
endY: number;
|
|
15
|
+
width: number;
|
|
16
|
+
height: number;
|
|
17
|
+
absolute: {
|
|
18
|
+
left: boolean;
|
|
19
|
+
top: boolean;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export interface IChartHostPlacement extends IChartOuterRect {
|
|
23
|
+
left: number;
|
|
24
|
+
top: number;
|
|
25
|
+
scaleX: number;
|
|
26
|
+
scaleY: number;
|
|
27
|
+
}
|
|
28
|
+
export interface IChartOffset {
|
|
29
|
+
left: number;
|
|
30
|
+
top: number;
|
|
31
|
+
}
|
|
32
|
+
export declare function getChartContentRect(rect: IChartOuterRect, minSize?: number): IChartOuterRect;
|
|
33
|
+
export declare function getChartHostPlacement(rect: IChartOuterRect, scale?: IChartScale, floatDomLayout?: IChartFloatDomLayout): IChartHostPlacement;
|
|
34
|
+
export declare function getChartContentOffset(_scale?: IChartScale): IChartOffset;
|
|
35
|
+
export declare function getChartFloatDomInnerOffset(layout?: IChartFloatDomLayout): IChartOffset;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IChartElementEvent } from '@univerjs-pro/engine-chart';
|
|
2
|
+
import type { IDisposable } from '@univerjs/core';
|
|
3
|
+
import type { IBoundRectNoAngle } from '@univerjs/engine-render';
|
|
4
|
+
import type { Observable } from 'rxjs';
|
|
5
|
+
export interface IChartElementPopupAnchorObserver extends IDisposable {
|
|
6
|
+
initialRect: IBoundRectNoAngle;
|
|
7
|
+
anchorRect$: Observable<IBoundRectNoAngle>;
|
|
8
|
+
visible: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function createChartElementPopupAnchorObserver(event: IChartElementEvent, update$: Observable<unknown> | undefined, onHidden: () => void): IChartElementPopupAnchorObserver;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ChartElementConfigTarget } from '@univerjs-pro/chart-ui';
|
|
2
|
+
import type { ChartModel, IChartElementHit } from '@univerjs-pro/engine-chart';
|
|
3
|
+
import type { IChartEditPanelRoute } from './chart-panel-route';
|
|
4
|
+
export interface ISheetsChartElementSelection {
|
|
5
|
+
target: ChartElementConfigTarget;
|
|
6
|
+
route: IChartEditPanelRoute;
|
|
7
|
+
showFloatMenu: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function resolveSheetsChartElementSelection(chartModel: ChartModel, hit: IChartElementHit): ISheetsChartElementSelection | undefined;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ChartImageSource } from '@univerjs-pro/engine-chart';
|
|
2
|
+
import type { IRectProps, IViewportInfo, UniverRenderingContext, Vector2 } from '@univerjs/engine-render';
|
|
3
|
+
import { Rect } from '@univerjs/engine-render';
|
|
4
|
+
export declare class ChartImageRect extends Rect {
|
|
5
|
+
private readonly _getImage;
|
|
6
|
+
private readonly _shouldSuppressSnapshot;
|
|
7
|
+
private readonly _disposeImage;
|
|
8
|
+
private _urlImage;
|
|
9
|
+
private _url;
|
|
10
|
+
constructor(key: string, config: IRectProps, _getImage: () => ChartImageSource | undefined, _shouldSuppressSnapshot?: () => boolean, _disposeImage?: () => void);
|
|
11
|
+
dispose(): void;
|
|
12
|
+
render(mainCtx: UniverRenderingContext, bounds?: IViewportInfo): this;
|
|
13
|
+
protected _draw(ctx: UniverRenderingContext, _bounds?: IViewportInfo, renderWidth?: number, renderHeight?: number): void;
|
|
14
|
+
private _drawChartFrame;
|
|
15
|
+
isHit(coord: Vector2): boolean;
|
|
16
|
+
private _drawChartImage;
|
|
17
|
+
private _getDrawable;
|
|
18
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ChartElementConfigTarget } from '@univerjs-pro/chart-ui';
|
|
2
|
+
import type { IChartElementHit } from '@univerjs-pro/engine-chart';
|
|
3
|
+
export interface IChartEditPanelRoute {
|
|
4
|
+
tab: 'style' | 'data';
|
|
5
|
+
section?: 'chartStyle' | 'chartAndAxisTitles' | 'legend' | 'horizontalAxis' | 'verticalAxis' | 'rightVerticalAxis' | 'series' | 'pieStyle' | 'paretoBarSeries' | 'paretoLineSeries' | 'waterfallSeries' | 'relation' | 'wordCloud';
|
|
6
|
+
titleKey?: 'title' | 'subtitle' | 'xAxisTitle' | 'yAxisTitle' | 'rightYAxisTitle';
|
|
7
|
+
axisId?: 'xAxis' | 'yAxis' | 'rightYAxis';
|
|
8
|
+
seriesId?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface IChartSelectedElementState {
|
|
11
|
+
chartId: string;
|
|
12
|
+
element: IChartElementHit;
|
|
13
|
+
target: ChartElementConfigTarget;
|
|
14
|
+
route: IChartEditPanelRoute;
|
|
15
|
+
}
|
|
16
|
+
export interface IChartPanelRouteState {
|
|
17
|
+
chartId: string;
|
|
18
|
+
route: IChartEditPanelRoute | null;
|
|
19
|
+
}
|
|
20
|
+
export declare function resolveChartEditPanelRoute(target: ChartElementConfigTarget): IChartEditPanelRoute | undefined;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import type { ChartDirection, ChartStyle, IChartConfig, IChartRenderModel } from '@univerjs-pro/engine-chart';
|
|
2
|
-
import {
|
|
1
|
+
import type { ChartDirection, ChartElementEventHandler, ChartElementEventType, ChartImageSource, ChartStyle, IChartConfig, IChartRenderModel } from '@univerjs-pro/engine-chart';
|
|
2
|
+
import type { IDisposable } from '@univerjs/core';
|
|
3
|
+
import type { Scene } from '@univerjs/engine-render';
|
|
4
|
+
import { ChartThemeService, IChartRenderModelManagerService } from '@univerjs-pro/engine-chart';
|
|
3
5
|
import { ChartModelService } from '@univerjs-pro/sheets-chart';
|
|
4
6
|
import { Disposable, IConfigService, Injector, IUniverInstanceService, LocaleService, ThemeService } from '@univerjs/core';
|
|
5
7
|
import { IDrawingManagerService } from '@univerjs/drawing';
|
|
6
8
|
import { IRenderManagerService } from '@univerjs/engine-render';
|
|
7
9
|
import { SheetCanvasFloatDomManagerService } from '@univerjs/sheets-drawing-ui';
|
|
10
|
+
import { ChartSnapshotStoreService } from './chart-snapshot-store.service';
|
|
8
11
|
import { IChartHostProviderService } from './sheets-chart-host-provider.service';
|
|
9
12
|
interface IRuntimeChartModel {
|
|
10
13
|
id?: string;
|
|
@@ -25,30 +28,64 @@ export declare class ChartRenderService extends Disposable {
|
|
|
25
28
|
private readonly _chartThemeService;
|
|
26
29
|
private readonly _themeService;
|
|
27
30
|
private readonly _configService;
|
|
28
|
-
private
|
|
31
|
+
private readonly _chartSnapshotStoreService;
|
|
29
32
|
private _chartInstanceMap;
|
|
30
|
-
private
|
|
33
|
+
private _chartEventHandlers;
|
|
34
|
+
private _chartEventSubscriptions;
|
|
35
|
+
private _chartElementEditMode;
|
|
36
|
+
private readonly _renderModelManager;
|
|
37
|
+
private readonly _ownsRenderModelManager;
|
|
31
38
|
private _renderDebounceMap;
|
|
32
39
|
private _debounceHandleMap;
|
|
33
|
-
|
|
40
|
+
private readonly _chartRenderMode;
|
|
41
|
+
private readonly _lastRenderInputMap;
|
|
42
|
+
private _activeChartId;
|
|
43
|
+
private _lastActiveSheet;
|
|
44
|
+
constructor(_chartHostProvider: IChartHostProviderService, _sheetCanvasFloatDomManagerService: SheetCanvasFloatDomManagerService, _chartModelService: ChartModelService, _drawingManagerService: IDrawingManagerService, _univerInstanceService: IUniverInstanceService, _renderManagerService: IRenderManagerService, _localeService: LocaleService, _injector: Injector, _chartThemeService: ChartThemeService, _themeService: ThemeService, _configService: IConfigService, _chartSnapshotStoreService: ChartSnapshotStoreService, renderModelManager?: IChartRenderModelManagerService);
|
|
34
45
|
private _getWatermark;
|
|
35
46
|
registerRenderModel(name: string, renderModel: IChartRenderModel): void;
|
|
36
47
|
setRenderModel(name: string): void;
|
|
48
|
+
getChartSnapshotImage(id: string): ChartImageSource | undefined;
|
|
49
|
+
private _resolveChartRenderMode;
|
|
50
|
+
private _getChartSnapshotKey;
|
|
51
|
+
private _registerChartImageRenderObjectFactory;
|
|
52
|
+
private _initActiveChartModelListener;
|
|
53
|
+
private _initDrawingDeactivationListener;
|
|
54
|
+
private _initActiveRuntimeLayerListener;
|
|
55
|
+
private _rerenderLatest;
|
|
56
|
+
private _disposeChartDomInstance;
|
|
57
|
+
private _disposeChartRenderInstance;
|
|
58
|
+
private _clearChartRuntimeCache;
|
|
59
|
+
private _clearSheetChartRuntimeCaches;
|
|
60
|
+
private _getChartRenderObject;
|
|
61
|
+
private _getChartRenderObjectContext;
|
|
62
|
+
private _setChartRuntimeZIndex;
|
|
63
|
+
private _applyActiveChartRuntimeZIndex;
|
|
64
|
+
private _resetChartRuntimeZIndex;
|
|
37
65
|
_resizeChart(id: string, value: {
|
|
38
66
|
width: number | undefined;
|
|
39
67
|
height: number | undefined;
|
|
40
68
|
}): void;
|
|
41
69
|
private _debounceHandle;
|
|
42
70
|
handleActiveSubUnitChange(): void;
|
|
71
|
+
setElementEditMode(chartId: string, enabled: boolean): void;
|
|
72
|
+
exportImage(chartId: string): Promise<string | undefined>;
|
|
73
|
+
on(chartId: string, type: ChartElementEventType, handler: ChartElementEventHandler): IDisposable;
|
|
74
|
+
private _getCurrentSnapshotImage;
|
|
75
|
+
private _bindChartEventHandlers;
|
|
76
|
+
private _bindChartEventHandler;
|
|
77
|
+
private _disposeChartEventSubscription;
|
|
78
|
+
private _disposeChartEventSubscriptions;
|
|
43
79
|
getRenderModel(name: string): IChartRenderModel<Record<string, any>> | undefined;
|
|
44
|
-
private _ensureChartInstance;
|
|
45
80
|
checkChartCanRender(id: string): boolean;
|
|
46
81
|
private _getChartRenderSkipReason;
|
|
47
82
|
render(id: string, config: IChartConfig, style: ChartStyle): Promise<void>;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
83
|
+
/** Render static chart snapshots into the print scene so drawing z-order is preserved. */
|
|
84
|
+
renderChartsForPrinting(unitId: string, subUnitId: string, scene: Scene): Promise<void>;
|
|
85
|
+
private _createPrintingChartObject;
|
|
86
|
+
private _getOrCreateChartRenderInstance;
|
|
87
|
+
private _createChartRenderInstanceContext;
|
|
88
|
+
private _cancelDebouncedCallbacks;
|
|
52
89
|
dispose(): void;
|
|
53
90
|
}
|
|
54
91
|
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ChartImageSource } from '@univerjs-pro/engine-chart';
|
|
2
|
+
import { Disposable } from '@univerjs/core';
|
|
3
|
+
export interface IChartSnapshotKey {
|
|
4
|
+
unitId: string;
|
|
5
|
+
subUnitId: string;
|
|
6
|
+
chartId: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function disposeChartImageSource(image?: ChartImageSource): void;
|
|
9
|
+
export declare class ChartSnapshotStoreService extends Disposable {
|
|
10
|
+
private readonly _entries;
|
|
11
|
+
nextVersion(key: IChartSnapshotKey): number;
|
|
12
|
+
isLatest(key: IChartSnapshotKey, version: number): boolean;
|
|
13
|
+
setImage(key: IChartSnapshotKey, image: ChartImageSource, version: number): boolean;
|
|
14
|
+
getImage(key: IChartSnapshotKey): ChartImageSource | undefined;
|
|
15
|
+
clearImage(key: IChartSnapshotKey): void;
|
|
16
|
+
clearChart(chartId: string): void;
|
|
17
|
+
dispose(): void;
|
|
18
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { IChartHostRect, IChartHostStyle, IDomChartHost } from '@univerjs-pro/engine-chart';
|
|
2
|
+
import type { SheetCanvasFloatDomManagerService } from '@univerjs/sheets-drawing-ui';
|
|
3
|
+
import { ChartHostRenderMode } from '@univerjs-pro/engine-chart';
|
|
4
|
+
import { Disposable } from '@univerjs/core';
|
|
5
|
+
export interface IChartHostHandle {
|
|
6
|
+
mountNode: HTMLElement;
|
|
7
|
+
dispose: () => void;
|
|
8
|
+
}
|
|
9
|
+
export type ChartHostHandle = IChartHostHandle;
|
|
10
|
+
export interface ISheetChartHostPlacement {
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
left: number;
|
|
14
|
+
top: number;
|
|
15
|
+
scaleX: number;
|
|
16
|
+
scaleY: number;
|
|
17
|
+
}
|
|
18
|
+
export type SheetChartHostPlacement = ISheetChartHostPlacement;
|
|
19
|
+
export declare function createHostElement(width: number, height: number): HTMLDivElement;
|
|
20
|
+
export declare class SheetChartHost extends Disposable implements IDomChartHost {
|
|
21
|
+
readonly chartId: string;
|
|
22
|
+
private readonly _getFloatDomInfo;
|
|
23
|
+
private readonly _getPlacement;
|
|
24
|
+
private readonly _setHostStyle;
|
|
25
|
+
private readonly _isProviderDisposed;
|
|
26
|
+
private readonly _markReady;
|
|
27
|
+
private readonly _markNotReady;
|
|
28
|
+
readonly mode = ChartHostRenderMode.Dom;
|
|
29
|
+
private _frameNode;
|
|
30
|
+
private _mountNode;
|
|
31
|
+
private _borderNode;
|
|
32
|
+
private _managed;
|
|
33
|
+
private _pendingToken;
|
|
34
|
+
private _pendingHost;
|
|
35
|
+
private _waiter;
|
|
36
|
+
private _hostStyle;
|
|
37
|
+
private _savedWrapperStyle;
|
|
38
|
+
constructor(chartId: string, _getFloatDomInfo: () => ReturnType<SheetCanvasFloatDomManagerService['getFloatDomInfo']>, _getPlacement: () => SheetChartHostPlacement | null, _setHostStyle: (style: IChartHostStyle) => void, _isProviderDisposed: () => boolean, _markReady: () => void, _markNotReady: () => void);
|
|
39
|
+
isManaged(): boolean;
|
|
40
|
+
markUnmanaged(): void;
|
|
41
|
+
getRect(): IChartHostRect | null;
|
|
42
|
+
setStyle(style: IChartHostStyle): void;
|
|
43
|
+
ensureHandle(): Promise<ChartHostHandle>;
|
|
44
|
+
ensureMount(): Promise<HTMLElement | null>;
|
|
45
|
+
checkMounted(): boolean;
|
|
46
|
+
syncLayout(): void;
|
|
47
|
+
markReady(): void;
|
|
48
|
+
markNotReady(): void;
|
|
49
|
+
dispose(): void;
|
|
50
|
+
private _createHost;
|
|
51
|
+
private _cancelHostWait;
|
|
52
|
+
private _applyHostPlacement;
|
|
53
|
+
private _applyHostStyle;
|
|
54
|
+
private _activateHostWrapper;
|
|
55
|
+
private _restoreHostWrapper;
|
|
56
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ChartImageSource, IChartHostRect, IChartHostStyle } from '@univerjs-pro/engine-chart';
|
|
2
|
+
import type { IChartOuterRect } from './chart-content-layout';
|
|
3
|
+
import type { ChartSnapshotStoreService } from './chart-snapshot-store.service';
|
|
4
|
+
import { ImageChartHost } from '@univerjs-pro/engine-chart';
|
|
5
|
+
interface ChartSnapshotKey {
|
|
6
|
+
unitId: string;
|
|
7
|
+
subUnitId: string;
|
|
8
|
+
chartId: string;
|
|
9
|
+
}
|
|
10
|
+
export declare class SheetImageChartHost extends ImageChartHost {
|
|
11
|
+
private readonly _getOuterRect;
|
|
12
|
+
private readonly _setHostStyle;
|
|
13
|
+
private readonly _snapshotKey;
|
|
14
|
+
private readonly _snapshotStore;
|
|
15
|
+
private readonly _requestPaint;
|
|
16
|
+
constructor(chartId: string, _getOuterRect: () => IChartOuterRect | null, _setHostStyle: (style: IChartHostStyle) => void, _snapshotKey: ChartSnapshotKey, _snapshotStore: ChartSnapshotStoreService, _requestPaint: () => void);
|
|
17
|
+
getRect(): IChartHostRect | null;
|
|
18
|
+
setStyle(style: IChartHostStyle): void;
|
|
19
|
+
nextVersion(): number;
|
|
20
|
+
commitSnapshot(image: ChartImageSource, version: number): boolean;
|
|
21
|
+
requestPaint(): void;
|
|
22
|
+
invalidateSnapshot(): void;
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
@@ -1,35 +1,59 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IDomChartHost, IImageChartHost } from '@univerjs-pro/engine-chart';
|
|
2
2
|
import type { Observable } from 'rxjs';
|
|
3
|
+
import type { IChartOuterRect } from './chart-content-layout';
|
|
4
|
+
import type { ChartHostHandle } from './sheet-chart-host';
|
|
5
|
+
import { ChartHostRenderMode } from '@univerjs-pro/engine-chart';
|
|
3
6
|
import { Disposable } from '@univerjs/core';
|
|
4
7
|
import { IRenderManagerService } from '@univerjs/engine-render';
|
|
5
8
|
import { SheetCanvasFloatDomManagerService } from '@univerjs/sheets-drawing-ui';
|
|
9
|
+
import { ChartSnapshotStoreService } from './chart-snapshot-store.service';
|
|
6
10
|
export interface IChartHostProviderService {
|
|
7
|
-
ensureHost
|
|
11
|
+
ensureHost(chartId: string, mode: 'image'): Promise<IImageChartHost | null>;
|
|
12
|
+
ensureHost(chartId: string, mode: 'dom'): Promise<IDomChartHost | null>;
|
|
13
|
+
ensureHost(chartId: string, mode: ChartHostRenderMode): Promise<IImageChartHost | IDomChartHost | null>;
|
|
14
|
+
ensureHost(chartId: string): Promise<{
|
|
8
15
|
mountNode: string | HTMLElement;
|
|
9
|
-
dispose
|
|
16
|
+
dispose: () => void;
|
|
10
17
|
}>;
|
|
11
18
|
setHostStyle: (chartId: string, style: Record<string, any>) => void;
|
|
12
|
-
getHostSize: (chartId: string) =>
|
|
19
|
+
getHostSize: (chartId: string) => IChartOuterRect | null;
|
|
13
20
|
removeHost$: Observable<string>;
|
|
21
|
+
removeHost: (chartId: string) => void;
|
|
14
22
|
checkHost: (chartId: string) => boolean;
|
|
23
|
+
syncHostLayout: (chartId: string) => void;
|
|
24
|
+
isDomReady: (chartId: string) => boolean;
|
|
25
|
+
markHostNotReady: (chartId: string) => void;
|
|
26
|
+
invalidateSnapshot: (chartId: string) => void;
|
|
15
27
|
}
|
|
16
|
-
export declare function createHostElement(width: number, height: number): HTMLDivElement;
|
|
17
28
|
export declare class SheetsChartHostProviderService extends Disposable implements IChartHostProviderService {
|
|
18
29
|
private readonly _sheetCanvasFloatDomManagerService;
|
|
19
30
|
private _renderManagerService;
|
|
20
|
-
private
|
|
31
|
+
private readonly _chartSnapshotStoreService;
|
|
32
|
+
private _chartHostMap;
|
|
33
|
+
private _activeDomReadyChartIds;
|
|
21
34
|
private _removeHost$;
|
|
22
35
|
readonly removeHost$: Observable<string>;
|
|
23
|
-
constructor(_sheetCanvasFloatDomManagerService: SheetCanvasFloatDomManagerService, _renderManagerService: IRenderManagerService);
|
|
36
|
+
constructor(_sheetCanvasFloatDomManagerService: SheetCanvasFloatDomManagerService, _renderManagerService: IRenderManagerService, _chartSnapshotStoreService: ChartSnapshotStoreService);
|
|
24
37
|
private _getSceneAndTransformerByDrawingSearch;
|
|
25
38
|
setBorder(id: string, color: string): void;
|
|
26
39
|
setHostStyle(id: string, style: Record<string, any>): void;
|
|
27
|
-
getHostSize(id: string):
|
|
40
|
+
getHostSize(id: string): IChartOuterRect | null;
|
|
28
41
|
checkHost(id: string): boolean;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
42
|
+
syncHostLayout(id: string): void;
|
|
43
|
+
removeHost(id: string): void;
|
|
44
|
+
ensureHost(id: string): Promise<ChartHostHandle>;
|
|
45
|
+
ensureHost(id: string, mode: ChartHostRenderMode.Image | 'image'): Promise<IImageChartHost | null>;
|
|
46
|
+
ensureHost(id: string, mode: ChartHostRenderMode.Dom | 'dom'): Promise<IDomChartHost | null>;
|
|
47
|
+
ensureHost(id: string, mode: ChartHostRenderMode | 'image' | 'dom'): Promise<IImageChartHost | IDomChartHost | null>;
|
|
48
|
+
isDomReady(id: string): boolean;
|
|
49
|
+
markHostNotReady(id: string): void;
|
|
50
|
+
invalidateSnapshot(id: string): void;
|
|
51
|
+
private _createImageChartHost;
|
|
52
|
+
private _getOrCreateSheetChartHost;
|
|
53
|
+
private _markHostReady;
|
|
54
|
+
private _getChartSnapshotKey;
|
|
55
|
+
private _requestChartCanvasRender;
|
|
56
|
+
private _getHostPlacement;
|
|
57
|
+
dispose(): void;
|
|
34
58
|
}
|
|
35
59
|
export declare const IChartHostProviderService: import("@wendellhu/redi").IdentifierDecorator<IChartHostProviderService>;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { AreaLineStyle, ChartModel, ChartStyle, DeepPartial, IAllSeriesStyle, IAxisOptions, IChartContext, IChartStyle, ILegendStyle, InvalidValueType, IPieLabelStyle, IRelationForceOptions, IRuntimeAxis, ITrendLine, LinePointShape, RadarShape, RelationChartLayoutEnum, RightYAxisOptions, TitlePositionEnum, WaterfallStackTypeEnum, WordCloudShapeEnum } from '@univerjs-pro/engine-chart';
|
|
2
|
-
import type { IChartSourceMultiRangeItem, IChartUpdateConfigCommandParams, IChartUpdateSourceCommandParams, ISheetChartSourceSingleRange } from '@univerjs-pro/sheets-chart';
|
|
2
|
+
import type { IChartSourceMultiRangeItem, IChartUpdateConfigCommandParams, IChartUpdateSourceCommandParams, ISheetChartSourceSingleRange, SheetChartModel } from '@univerjs-pro/sheets-chart';
|
|
3
3
|
import type { Nullable } from '@univerjs/core';
|
|
4
4
|
import type { Observable } from 'rxjs';
|
|
5
|
+
import type { IChartEditPanelRoute, IChartPanelRouteState, IChartSelectedElementState } from './chart-panel-route';
|
|
5
6
|
import { CategoryType, ChartTypeBits, DataOrientation } from '@univerjs-pro/engine-chart';
|
|
6
7
|
import { ChartModelService, SheetsChartService } from '@univerjs-pro/sheets-chart';
|
|
7
8
|
import { Disposable, ICommandService, IUniverInstanceService, LocaleService } from '@univerjs/core';
|
|
8
9
|
import { IChartHostProviderService } from './sheets-chart-host-provider.service';
|
|
9
|
-
export declare function registryChartConfigState(service:
|
|
10
|
+
export declare function registryChartConfigState(service: ISheetsChartUIService): void;
|
|
10
11
|
export interface IChartOptionType {
|
|
11
12
|
label: string;
|
|
12
13
|
value: string;
|
|
@@ -61,11 +62,11 @@ export interface IChartConfigStateMap {
|
|
|
61
62
|
dataPointsOptions: IChartConfigState<Nullable<IChartOptionType[]>>;
|
|
62
63
|
chartThemeColorType: IChartConfigState<Nullable<string>>;
|
|
63
64
|
titlePosition: IChartConfigState<Nullable<TitlePositionEnum>, TitlePositionEnum>;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
bubbleSizeIndex: IChartConfigState<Nullable<number>, number | undefined>;
|
|
66
|
+
scatterXIndex: IChartConfigState<Nullable<number>, number>;
|
|
67
|
+
scatterYIndex: IChartConfigState<Nullable<number>, number>;
|
|
68
|
+
scatterLabelIndex: IChartConfigState<Nullable<number>, number>;
|
|
69
|
+
bubbleSeriesIndex: IChartConfigState<Nullable<number>, number>;
|
|
69
70
|
relationLayout: IChartConfigState<Nullable<RelationChartLayoutEnum>, RelationChartLayoutEnum>;
|
|
70
71
|
useValueAsSymbolSize: IChartConfigState<Nullable<boolean>, boolean>;
|
|
71
72
|
forceOption: IChartConfigState<Nullable<IRelationForceOptions>, IRelationForceOptions | undefined>;
|
|
@@ -91,7 +92,32 @@ export type IChartConfigState<GetValue, SetValue = GetValue> = {
|
|
|
91
92
|
set?(value: SetValue): void;
|
|
92
93
|
get(): Observable<GetValue> | undefined;
|
|
93
94
|
} | Observable<GetValue>;
|
|
94
|
-
export
|
|
95
|
+
export interface ISheetsChartUIService {
|
|
96
|
+
readonly activeChartModel: Nullable<SheetChartModel>;
|
|
97
|
+
readonly activeChartModel$: Observable<Nullable<SheetChartModel>>;
|
|
98
|
+
readonly activeEditChart: string | null;
|
|
99
|
+
readonly activeEditChart$: Observable<string | null>;
|
|
100
|
+
readonly direction$: LocaleService['direction$'];
|
|
101
|
+
readonly panelRoute$: Observable<IChartPanelRouteState | null>;
|
|
102
|
+
readonly rangeSelectMode: boolean;
|
|
103
|
+
readonly selectedElement$: Observable<IChartSelectedElementState | null>;
|
|
104
|
+
setActiveEditChart(chartId: string | null): void;
|
|
105
|
+
setRangeSelectMode(on: boolean): void;
|
|
106
|
+
isElementEditModeActive(chartId: string): boolean;
|
|
107
|
+
setSelectedElement(state: IChartSelectedElementState | null): void;
|
|
108
|
+
setPanelRoute(chartId: string, route: IChartEditPanelRoute | null): void;
|
|
109
|
+
clearPanelRoute(): void;
|
|
110
|
+
getDataSource(id: string): ReturnType<SheetsChartService['getChartDataSource']>;
|
|
111
|
+
registerViewState<T extends ChartConfigStateKey = ChartConfigStateKey>(id: T, state: (chartModel: ChartModel) => IChartConfigStateMap[T]): void;
|
|
112
|
+
getViewState<V extends ChartConfigStateValue = ChartConfigStateValue>(id: ChartConfigStateKey, activeChartModel?: Nullable<SheetChartModel>): IChartConfigState<V> | undefined;
|
|
113
|
+
executeChartUpdateConfig(params: Omit<IChartUpdateConfigCommandParams, 'unitId'>): void;
|
|
114
|
+
executeChartUpdateSourceConfig(params: Omit<IChartUpdateSourceCommandParams, 'unitId'>): void;
|
|
115
|
+
removeViewState(id: ChartConfigStateKey): void;
|
|
116
|
+
setBorder(id: string, color: string): void;
|
|
117
|
+
t(...args: Parameters<LocaleService['t']>): string;
|
|
118
|
+
}
|
|
119
|
+
export declare const ISheetsChartUIService: import("@wendellhu/redi").IdentifierDecorator<ISheetsChartUIService>;
|
|
120
|
+
export declare class SheetsChartUIService extends Disposable implements ISheetsChartUIService {
|
|
95
121
|
private readonly _chartModelService;
|
|
96
122
|
private readonly _sheetsChartService;
|
|
97
123
|
private readonly _commandService;
|
|
@@ -100,14 +126,27 @@ export declare class SheetsChartUIService extends Disposable {
|
|
|
100
126
|
private _univerInstanceService;
|
|
101
127
|
private _viewState;
|
|
102
128
|
private _rangeSelectMode;
|
|
129
|
+
private readonly _activeEditChart$;
|
|
130
|
+
private readonly _selectedElement$;
|
|
131
|
+
private readonly _panelRoute$;
|
|
132
|
+
readonly activeEditChart$: Observable<string | null>;
|
|
133
|
+
readonly selectedElement$: Observable<IChartSelectedElementState | null>;
|
|
134
|
+
readonly panelRoute$: Observable<IChartPanelRouteState | null>;
|
|
103
135
|
constructor(_chartModelService: ChartModelService, _sheetsChartService: SheetsChartService, _commandService: ICommandService, _localeService: LocaleService, _chartHostProviderService: IChartHostProviderService, _univerInstanceService: IUniverInstanceService);
|
|
104
|
-
get activeChartModel(): Nullable<
|
|
136
|
+
get activeChartModel(): Nullable<SheetChartModel>;
|
|
137
|
+
get activeChartModel$(): Observable<Nullable<SheetChartModel>>;
|
|
105
138
|
get rangeSelectMode(): boolean;
|
|
139
|
+
get activeEditChart(): string | null;
|
|
106
140
|
get direction$(): Observable<"ltr" | "rtl">;
|
|
107
|
-
|
|
141
|
+
setRangeSelectMode(on: boolean): void;
|
|
142
|
+
setActiveEditChart(chartId: string | null): void;
|
|
143
|
+
isElementEditModeActive(chartId: string): boolean;
|
|
144
|
+
setSelectedElement(state: IChartSelectedElementState | null): void;
|
|
145
|
+
setPanelRoute(chartId: string, route: IChartEditPanelRoute | null): void;
|
|
146
|
+
clearPanelRoute(): void;
|
|
108
147
|
getDataSource(id: string): import("@univerjs-pro/sheets-chart/models/types.js").ISheetChartDataSource | undefined;
|
|
109
148
|
registerViewState<T extends ChartConfigStateKey = ChartConfigStateKey>(id: T, state: (chartModel: ChartModel) => IChartConfigStateMap[T]): void;
|
|
110
|
-
getViewState<V extends ChartConfigStateValue = ChartConfigStateValue>(id: ChartConfigStateKey): IChartConfigState<V> | undefined;
|
|
149
|
+
getViewState<V extends ChartConfigStateValue = ChartConfigStateValue>(id: ChartConfigStateKey, activeChartModel?: Nullable<SheetChartModel>): IChartConfigState<V> | undefined;
|
|
111
150
|
executeChartUpdateConfig(params: Omit<IChartUpdateConfigCommandParams, 'unitId'>): void;
|
|
112
151
|
executeChartUpdateSourceConfig(params: Omit<IChartUpdateSourceCommandParams, 'unitId'>): void;
|
|
113
152
|
removeViewState(id: ChartConfigStateKey): void;
|