@univerjs-pro/slides-chart-ui 1.0.0-alpha.2 → 1.0.0-alpha.4
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 -2
- 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 +0 -130
- 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/operations/chart-panel.operation.d.ts +2 -0
- package/lib/types/common/slide-chart-frame-style.d.ts +8 -0
- package/lib/types/components/SlideChartEditPanel.d.ts +13 -4
- package/lib/types/components/SlideChartInlineTableEditor.d.ts +2 -4
- package/lib/types/controllers/slide-chart-double-click.render-controller.d.ts +3 -1
- package/lib/types/controllers/slide-chart-element-float-menu.controller.d.ts +28 -0
- package/lib/types/controllers/slide-chart-render-refresh.controller.d.ts +11 -0
- package/lib/types/controllers/ui.controller.d.ts +7 -4
- package/lib/types/hooks.d.ts +2 -4
- package/lib/types/index.d.ts +2 -7
- package/lib/types/locale/en-US.d.ts +0 -3
- package/lib/types/plugin.d.ts +0 -1
- package/lib/types/services/chart-element-selection.d.ts +10 -0
- package/lib/types/services/chart-panel-route.d.ts +22 -0
- package/lib/types/services/slide-chart-edit-session.service.d.ts +51 -0
- package/lib/types/services/slide-chart-host-provider.service.d.ts +83 -0
- package/lib/types/services/slide-chart-host.d.ts +11 -4
- package/lib/types/services/slide-chart-insert.service.d.ts +3 -1
- package/lib/types/services/slide-chart-render-mode.service.d.ts +15 -0
- package/lib/types/services/slide-chart-render.service.d.ts +28 -7
- package/lib/types/services/slide-chart-ui.service.d.ts +43 -3
- package/lib/types/utils/ChartPanelOptions.d.ts +6 -14
- package/lib/types/views/render/chart-adaptor.d.ts +5 -4
- 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 +16 -15
- package/lib/types/controllers/slide-chart-snapshot-refresh.controller.d.ts +0 -12
- package/lib/types/services/slide-chart-overlay.service.d.ts +0 -31
- package/lib/types/services/slide-chart-snapshot-render.service.d.ts +0 -57
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { ISlideDrawing } from '@univerjs-pro/slides';
|
|
2
|
+
import type { ISlideChartRuntimeModel } from '@univerjs-pro/slides-chart';
|
|
3
|
+
import { SlideChartModelService } from '@univerjs-pro/slides-chart';
|
|
4
|
+
import { Disposable, IUniverInstanceService } from '@univerjs/core';
|
|
5
|
+
import { IRenderManagerService } from '@univerjs/engine-render';
|
|
6
|
+
import { SlideChartRenderModeService } from './slide-chart-render-mode.service';
|
|
7
|
+
export interface ISlideChartEditSession {
|
|
8
|
+
unitId: string;
|
|
9
|
+
subUnitId: string;
|
|
10
|
+
drawingId: string;
|
|
11
|
+
chartId: string;
|
|
12
|
+
}
|
|
13
|
+
export declare class SlideChartEditSessionService extends Disposable {
|
|
14
|
+
private readonly _slideDrawingService;
|
|
15
|
+
private readonly _modelService;
|
|
16
|
+
private readonly _renderModeService;
|
|
17
|
+
private readonly _univerInstanceService;
|
|
18
|
+
private readonly _renderManagerService;
|
|
19
|
+
private _activeSession;
|
|
20
|
+
private readonly _activeSession$;
|
|
21
|
+
readonly activeSession$: import("rxjs").Observable<ISlideChartEditSession | null>;
|
|
22
|
+
private readonly _subscriptions;
|
|
23
|
+
private _activeSlideSubscription;
|
|
24
|
+
private _transformStartSubscription;
|
|
25
|
+
constructor(_slideDrawingService: {
|
|
26
|
+
getDrawingByParam(params: {
|
|
27
|
+
unitId: string;
|
|
28
|
+
subUnitId: string;
|
|
29
|
+
drawingId: string;
|
|
30
|
+
}): ISlideDrawing | null | undefined;
|
|
31
|
+
remove$?: {
|
|
32
|
+
subscribe(handler: (drawings: ISlideDrawing[]) => void): {
|
|
33
|
+
unsubscribe(): void;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
}, _modelService: Pick<SlideChartModelService, 'ensureChartModel' | 'setActiveChartRuntime'> & {
|
|
37
|
+
chartModelRemoved$?: {
|
|
38
|
+
subscribe(handler: (runtime: ISlideChartRuntimeModel) => void): {
|
|
39
|
+
unsubscribe(): void;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
}, _renderModeService: SlideChartRenderModeService, _univerInstanceService: Pick<IUniverInstanceService, 'focused$' | 'getUnit'>, _renderManagerService: Pick<IRenderManagerService, 'getRenderById'>);
|
|
43
|
+
getActiveSession(): ISlideChartEditSession | null;
|
|
44
|
+
open(session: ISlideChartEditSession): boolean;
|
|
45
|
+
close(): void;
|
|
46
|
+
isActive(chartId: string): boolean;
|
|
47
|
+
dispose(): void;
|
|
48
|
+
private _initLifecycleListeners;
|
|
49
|
+
private _bindActiveSlideListener;
|
|
50
|
+
private _bindTransformStartListener;
|
|
51
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { IDomChartHost, IImageChartHost } from '@univerjs-pro/engine-chart';
|
|
2
|
+
import type { ISlideDrawing, ISlideLineStyle } from '@univerjs-pro/slides';
|
|
3
|
+
import type { IDisposable } from '@univerjs/core';
|
|
4
|
+
import type { IBoundRectNoAngle } from '@univerjs/engine-render';
|
|
5
|
+
import { ChartHostRenderMode } from '@univerjs-pro/engine-chart';
|
|
6
|
+
import { SlideChartModelService } from '@univerjs-pro/slides-chart';
|
|
7
|
+
import { Disposable, LocaleService } from '@univerjs/core';
|
|
8
|
+
import { IRenderManagerService } from '@univerjs/engine-render';
|
|
9
|
+
import { SlideChartRenderModeService } from './slide-chart-render-mode.service';
|
|
10
|
+
import { SlideChartRenderService } from './slide-chart-render.service';
|
|
11
|
+
interface ISlideChartImageObjectHandle {
|
|
12
|
+
changeChartSource(url: string): void;
|
|
13
|
+
makeDirty(dirty?: boolean): void;
|
|
14
|
+
setChartStroke?(stroke?: ISlideLineStyle): void;
|
|
15
|
+
}
|
|
16
|
+
export interface ISlideChartHostContext {
|
|
17
|
+
unitId: string;
|
|
18
|
+
subUnitId: string;
|
|
19
|
+
drawingId: string;
|
|
20
|
+
chartId: string;
|
|
21
|
+
width: number;
|
|
22
|
+
height: number;
|
|
23
|
+
drawing: ISlideDrawing;
|
|
24
|
+
stroke?: ISlideLineStyle;
|
|
25
|
+
imageObject?: ISlideChartImageObjectHandle;
|
|
26
|
+
}
|
|
27
|
+
export declare class SlideChartHostProviderService extends Disposable {
|
|
28
|
+
private readonly _renderManagerService;
|
|
29
|
+
private readonly _localeService;
|
|
30
|
+
private readonly _modelService;
|
|
31
|
+
private readonly _renderService;
|
|
32
|
+
private readonly _renderModeService;
|
|
33
|
+
private readonly _hostContextMap;
|
|
34
|
+
private readonly _hostContextTokenMap;
|
|
35
|
+
private readonly _domHostMap;
|
|
36
|
+
private readonly _hostLayoutSubscriptions;
|
|
37
|
+
private readonly _runtimeRenderSubscriptions;
|
|
38
|
+
private readonly _domReadyChartIds;
|
|
39
|
+
private readonly _lastImageDataUrlMap;
|
|
40
|
+
private readonly _removeHost$;
|
|
41
|
+
private readonly _imageUpdated$;
|
|
42
|
+
private readonly _domReadyChanged$;
|
|
43
|
+
private readonly _layoutChanged$;
|
|
44
|
+
readonly removeHost$: import("rxjs").Observable<string>;
|
|
45
|
+
readonly imageUpdated$: import("rxjs").Observable<string>;
|
|
46
|
+
readonly domReadyChanged$: import("rxjs").Observable<string>;
|
|
47
|
+
readonly layoutChanged$: import("rxjs").Observable<string>;
|
|
48
|
+
constructor(_renderManagerService: IRenderManagerService, _localeService: LocaleService, _modelService: SlideChartModelService, _renderService: SlideChartRenderService, _renderModeService: SlideChartRenderModeService);
|
|
49
|
+
registerHostContext(context: ISlideChartHostContext): IDisposable;
|
|
50
|
+
getHostContext(chartId: string): ISlideChartHostContext | undefined;
|
|
51
|
+
ensureHost(chartId: string, mode: ChartHostRenderMode.Image): IImageChartHost | null;
|
|
52
|
+
ensureHost(chartId: string, mode: ChartHostRenderMode.Dom): IDomChartHost | null;
|
|
53
|
+
ensureHost(chartId: string, mode: ChartHostRenderMode): IImageChartHost | IDomChartHost | null;
|
|
54
|
+
getImageDataUrl(chartId: string): string | undefined;
|
|
55
|
+
commitImageHost(chartId: string, host: IImageChartHost): void;
|
|
56
|
+
renderChart(chartId: string): Promise<void>;
|
|
57
|
+
removeHost(chartId: string): void;
|
|
58
|
+
private _removeDomHost;
|
|
59
|
+
syncHostLayout(chartId: string): void;
|
|
60
|
+
checkHost(chartId: string): boolean;
|
|
61
|
+
isDomReady(chartId: string): boolean;
|
|
62
|
+
markHostReady(chartId: string): void;
|
|
63
|
+
markHostNotReady(chartId: string): void;
|
|
64
|
+
getClientRect(chartId: string, bounds?: {
|
|
65
|
+
left: number;
|
|
66
|
+
top: number;
|
|
67
|
+
right: number;
|
|
68
|
+
bottom: number;
|
|
69
|
+
}): IBoundRectNoAngle | null;
|
|
70
|
+
private _createImageChartHost;
|
|
71
|
+
private _getOrCreateDomChartHost;
|
|
72
|
+
private _bindHostLayoutListeners;
|
|
73
|
+
private _disposeHostLayoutListeners;
|
|
74
|
+
private _bindRuntimeRenderListener;
|
|
75
|
+
private _disposeRuntimeRenderListener;
|
|
76
|
+
private _applyDomHostLayout;
|
|
77
|
+
private _getCanvasClientScale;
|
|
78
|
+
private _transformCanvasBoundToClientBound;
|
|
79
|
+
private _getChartRenderObject;
|
|
80
|
+
private _requestChartCanvasRender;
|
|
81
|
+
dispose(): void;
|
|
82
|
+
}
|
|
83
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ChartImageSource, IChartHostRect, IChartHostStyle, IDomChartHost } from '@univerjs-pro/engine-chart';
|
|
2
|
-
import { ImageChartHost } from '@univerjs-pro/engine-chart';
|
|
2
|
+
import { ChartHostRenderMode, ImageChartHost } from '@univerjs-pro/engine-chart';
|
|
3
3
|
import { Disposable } from '@univerjs/core';
|
|
4
4
|
export declare class SlideImageChartHost extends ImageChartHost {
|
|
5
5
|
private readonly _rect;
|
|
@@ -17,13 +17,20 @@ export declare class SlideDomChartHost extends Disposable implements IDomChartHo
|
|
|
17
17
|
readonly chartId: string;
|
|
18
18
|
private readonly _host;
|
|
19
19
|
private readonly _applyHostStyle;
|
|
20
|
-
readonly
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
private readonly _getRenderRect?;
|
|
21
|
+
private readonly _markReady?;
|
|
22
|
+
private readonly _markNotReady?;
|
|
23
|
+
readonly mode = ChartHostRenderMode.Dom;
|
|
24
|
+
private _mountNode;
|
|
25
|
+
private _ready;
|
|
26
|
+
constructor(chartId: string, _host: HTMLElement, _applyHostStyle: (host: HTMLElement, style: IChartHostStyle) => void, _getRenderRect?: (() => IChartHostRect | null) | undefined, _markReady?: (() => void) | undefined, _markNotReady?: (() => void) | undefined);
|
|
27
|
+
getRect(): IChartHostRect | null;
|
|
23
28
|
setStyle(style: IChartHostStyle): void;
|
|
29
|
+
getHostElement(): HTMLElement;
|
|
24
30
|
ensureMount(): Promise<HTMLElement>;
|
|
25
31
|
checkMounted(): boolean;
|
|
26
32
|
syncLayout(): void;
|
|
27
33
|
markReady(): void;
|
|
28
34
|
markNotReady(): void;
|
|
35
|
+
dispose(): void;
|
|
29
36
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ChartTypeBits } from '@univerjs-pro/engine-chart';
|
|
2
2
|
import type { ISlideDrawing } from '@univerjs-pro/slides';
|
|
3
3
|
import type { SlideChartCellValue } from '@univerjs-pro/slides-chart';
|
|
4
|
+
import { ISlideDrawingStateService } from '@univerjs-pro/slides-ui';
|
|
4
5
|
import { ICommandService, IUniverInstanceService } from '@univerjs/core';
|
|
5
6
|
export interface ISlideChartInsertOptions {
|
|
6
7
|
placeholderDrawing?: ISlideDrawing;
|
|
@@ -8,7 +9,8 @@ export interface ISlideChartInsertOptions {
|
|
|
8
9
|
export declare class SlideChartInsertService {
|
|
9
10
|
private readonly _instanceService;
|
|
10
11
|
private readonly _commandService;
|
|
11
|
-
|
|
12
|
+
private readonly _drawingStateService;
|
|
13
|
+
constructor(_instanceService: IUniverInstanceService, _commandService: ICommandService, _drawingStateService: ISlideDrawingStateService);
|
|
12
14
|
insertChartFromText(text: string, chartType: ChartTypeBits, options?: ISlideChartInsertOptions): boolean;
|
|
13
15
|
insertChart(values: SlideChartCellValue[][], chartType: ChartTypeBits, options?: ISlideChartInsertOptions): boolean;
|
|
14
16
|
private _insertChartIntoPlaceholder;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ISlideChartEditSession } from './slide-chart-edit-session.service';
|
|
2
|
+
import { ChartHostRenderMode } from '@univerjs-pro/engine-chart';
|
|
3
|
+
import { Disposable } from '@univerjs/core';
|
|
4
|
+
export interface ISlideChartRenderModeChange {
|
|
5
|
+
chartId: string;
|
|
6
|
+
mode: ChartHostRenderMode;
|
|
7
|
+
}
|
|
8
|
+
export declare class SlideChartRenderModeService extends Disposable {
|
|
9
|
+
private _activeChartId;
|
|
10
|
+
private readonly _modeChanged$;
|
|
11
|
+
readonly modeChanged$: import("rxjs").Observable<ISlideChartRenderModeChange>;
|
|
12
|
+
getRenderMode(chartId: string): ChartHostRenderMode;
|
|
13
|
+
setActiveDomChart(session: ISlideChartEditSession | null): void;
|
|
14
|
+
dispose(): void;
|
|
15
|
+
}
|
|
@@ -1,13 +1,20 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ChartElementEventHandler, ChartElementEventType, ChartStyle, IChartConfig, IChartHost, IChartHostRect, IChartInstance, IChartRenderInstance, IChartRenderModel } from '@univerjs-pro/engine-chart';
|
|
2
2
|
import type { ISlideChartRuntimeModel } from '@univerjs-pro/slides-chart';
|
|
3
|
-
import {
|
|
3
|
+
import type { IDisposable } from '@univerjs/core';
|
|
4
|
+
import { ChartHostRenderMode, ChartThemeService, IChartRenderModelManagerService } from '@univerjs-pro/engine-chart';
|
|
4
5
|
import { Disposable, LocaleService } from '@univerjs/core';
|
|
5
6
|
export interface ISlideChartRenderSpecResult {
|
|
6
7
|
spec: Record<string, unknown>;
|
|
7
8
|
chartConfig: IChartConfig;
|
|
8
9
|
chartStyle: ChartStyle;
|
|
9
10
|
hostStyle: {
|
|
10
|
-
fill
|
|
11
|
+
fill?: string;
|
|
12
|
+
stroke?: string;
|
|
13
|
+
border?: {
|
|
14
|
+
color?: string;
|
|
15
|
+
width?: number;
|
|
16
|
+
};
|
|
17
|
+
radius?: number;
|
|
11
18
|
};
|
|
12
19
|
}
|
|
13
20
|
export interface ISlideChartRenderInput {
|
|
@@ -17,19 +24,33 @@ export interface ISlideChartRenderInput {
|
|
|
17
24
|
export declare const ISlideChartRenderModelService: import("@wendellhu/redi").IdentifierDecorator<IChartRenderModel<Record<string, any>>>;
|
|
18
25
|
export declare class SlideChartRenderService extends Disposable {
|
|
19
26
|
private readonly _localeService;
|
|
20
|
-
private readonly _chartThemeService
|
|
21
|
-
private readonly
|
|
22
|
-
private
|
|
23
|
-
|
|
27
|
+
private readonly _chartThemeService;
|
|
28
|
+
private readonly _renderModelManager;
|
|
29
|
+
private readonly _chartInstanceMap;
|
|
30
|
+
private readonly _chartEventHandlers;
|
|
31
|
+
private readonly _chartEventSubscriptions;
|
|
32
|
+
private readonly _chartElementEditMode;
|
|
33
|
+
private readonly _lastImageDataUrlMap;
|
|
34
|
+
constructor(_localeService: LocaleService, _chartThemeService: ChartThemeService, renderModelManager: IChartRenderModelManagerService, renderModel?: IChartRenderModel);
|
|
24
35
|
registerRenderModel(name: string, renderModel: IChartRenderModel): void;
|
|
25
36
|
setRenderModel(name: string): void;
|
|
26
37
|
getRenderModel(name?: string): IChartRenderModel | undefined;
|
|
27
38
|
createChartInstance(): IChartInstance;
|
|
28
39
|
createChartInstance(mode: ChartHostRenderMode): IChartRenderInstance;
|
|
40
|
+
render(runtime: ISlideChartRuntimeModel, host: IChartHost): Promise<void>;
|
|
41
|
+
setElementEditMode(chartId: string, enabled: boolean): void;
|
|
42
|
+
on(chartId: string, type: ChartElementEventType, handler: ChartElementEventHandler): IDisposable;
|
|
43
|
+
disposeChartInstance(chartId: string): void;
|
|
44
|
+
exportImage(chartId: string): Promise<string | undefined>;
|
|
29
45
|
createRenderInput(runtime: ISlideChartRuntimeModel): ISlideChartRenderInput;
|
|
30
46
|
createRenderSpec(runtime: ISlideChartRuntimeModel, rect: IChartHostRect, chartInstance?: IChartInstance): ISlideChartRenderSpecResult;
|
|
31
47
|
getHostStyle(chartStyle: ChartStyle): ISlideChartRenderSpecResult['hostStyle'];
|
|
32
48
|
applyHostStyle(host: HTMLElement, hostStyle: ISlideChartRenderSpecResult['hostStyle']): void;
|
|
49
|
+
private _getOrCreateChartRenderInstance;
|
|
50
|
+
private _bindChartEventHandlers;
|
|
51
|
+
private _bindChartEventHandler;
|
|
52
|
+
private _disposeChartEventSubscription;
|
|
53
|
+
private _disposeChartEventSubscriptions;
|
|
33
54
|
private _createChartRenderInstanceContext;
|
|
34
55
|
dispose(): void;
|
|
35
56
|
}
|
|
@@ -2,6 +2,7 @@ import type { ChartStyle, DeepPartial, IChartContext, IChartDataAggregation, IPi
|
|
|
2
2
|
import type { ISlideChartRuntimeModel, IUpdateSlideChartConfigCommandParams } from '@univerjs-pro/slides-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 { ChartTypeBits, DataOrientation, StackType } from '@univerjs-pro/engine-chart';
|
|
6
7
|
import { ISlideDrawingService } from '@univerjs-pro/slides';
|
|
7
8
|
import { SlideChartModelService, SlideChartResourceService } from '@univerjs-pro/slides-chart';
|
|
@@ -54,18 +55,57 @@ export type ISlideChartConfigState<GetValue, SetValue = GetValue> = {
|
|
|
54
55
|
set?(value: SetValue): void;
|
|
55
56
|
get(): Observable<GetValue> | undefined;
|
|
56
57
|
} | Observable<GetValue>;
|
|
57
|
-
export
|
|
58
|
-
|
|
58
|
+
export interface ISlideChartUIService {
|
|
59
|
+
readonly activeRuntimeModel: ISlideChartRuntimeModel | null;
|
|
60
|
+
readonly activeRuntimeModel$: Observable<ISlideChartRuntimeModel | null>;
|
|
61
|
+
readonly activeEditChart: string | null;
|
|
62
|
+
readonly activeEditChart$: Observable<string | null>;
|
|
63
|
+
readonly selectedElement$: Observable<IChartSelectedElementState | null>;
|
|
64
|
+
readonly panelRoute$: Observable<IChartPanelRouteState | null>;
|
|
65
|
+
readonly localeService: LocaleService;
|
|
66
|
+
readonly resourceService: SlideChartResourceService;
|
|
67
|
+
registerViewState<T extends SlideChartConfigStateKey = SlideChartConfigStateKey>(id: T, state: (runtime: ISlideChartRuntimeModel) => ISlideChartConfigStateMap[T]): void;
|
|
68
|
+
getViewState<V extends SlideChartConfigStateValue = SlideChartConfigStateValue>(id: SlideChartConfigStateKey, runtime?: ISlideChartRuntimeModel | null): ISlideChartConfigState<V> | undefined;
|
|
69
|
+
executeChartUpdateConfig(params: Omit<IUpdateSlideChartConfigCommandParams, 'unitId' | 'chartId'> & {
|
|
70
|
+
unitId?: string;
|
|
71
|
+
chartId?: string;
|
|
72
|
+
context?: Partial<IChartContext>;
|
|
73
|
+
dataAggregation?: Partial<IChartDataAggregation>;
|
|
74
|
+
}): void;
|
|
75
|
+
getDrawingBorderColor(unitId: string, subUnitId: string, drawingId: string): string | undefined;
|
|
76
|
+
updateDrawingBorderColor(unitId: string, subUnitId: string, drawingId: string, color: string): boolean;
|
|
77
|
+
setActiveEditChart(chartId: string | null): void;
|
|
78
|
+
isElementEditModeActive(chartId: string): boolean;
|
|
79
|
+
setSelectedElement(state: IChartSelectedElementState | null): void;
|
|
80
|
+
setPanelRoute(chartId: string, route: IChartEditPanelRoute | null): void;
|
|
81
|
+
clearPanelRoute(): void;
|
|
82
|
+
}
|
|
83
|
+
export declare const ISlideChartUIService: import("@wendellhu/redi").IdentifierDecorator<ISlideChartUIService>;
|
|
84
|
+
export declare function registerSlideChartConfigState(service: ISlideChartUIService): void;
|
|
85
|
+
export declare class SlideChartUIService extends Disposable implements ISlideChartUIService {
|
|
59
86
|
private readonly _chartModelService;
|
|
60
87
|
private readonly _commandService;
|
|
61
88
|
readonly localeService: LocaleService;
|
|
62
89
|
readonly resourceService: SlideChartResourceService;
|
|
63
90
|
private readonly _slideDrawingService;
|
|
64
91
|
private readonly _viewState;
|
|
92
|
+
private readonly _activeEditChart$;
|
|
93
|
+
private readonly _selectedElement$;
|
|
94
|
+
private readonly _panelRoute$;
|
|
95
|
+
readonly activeEditChart$: Observable<string | null>;
|
|
96
|
+
readonly selectedElement$: Observable<IChartSelectedElementState | null>;
|
|
97
|
+
readonly panelRoute$: Observable<IChartPanelRouteState | null>;
|
|
65
98
|
constructor(_chartModelService: SlideChartModelService, _commandService: ICommandService, localeService: LocaleService, resourceService: SlideChartResourceService, _slideDrawingService: ISlideDrawingService);
|
|
66
99
|
get activeRuntimeModel(): ISlideChartRuntimeModel | null;
|
|
100
|
+
get activeRuntimeModel$(): Observable<ISlideChartRuntimeModel | null>;
|
|
101
|
+
get activeEditChart(): string | null;
|
|
102
|
+
setActiveEditChart(chartId: string | null): void;
|
|
103
|
+
isElementEditModeActive(chartId: string): boolean;
|
|
104
|
+
setSelectedElement(state: IChartSelectedElementState | null): void;
|
|
105
|
+
setPanelRoute(chartId: string, route: IChartEditPanelRoute | null): void;
|
|
106
|
+
clearPanelRoute(): void;
|
|
67
107
|
registerViewState<T extends SlideChartConfigStateKey = SlideChartConfigStateKey>(id: T, state: (runtime: ISlideChartRuntimeModel) => ISlideChartConfigStateMap[T]): void;
|
|
68
|
-
getViewState<V extends SlideChartConfigStateValue = SlideChartConfigStateValue>(id: SlideChartConfigStateKey): ISlideChartConfigState<V> | undefined;
|
|
108
|
+
getViewState<V extends SlideChartConfigStateValue = SlideChartConfigStateValue>(id: SlideChartConfigStateKey, runtime?: ISlideChartRuntimeModel | null): ISlideChartConfigState<V> | undefined;
|
|
69
109
|
executeChartUpdateConfig(params: Omit<IUpdateSlideChartConfigCommandParams, 'unitId' | 'chartId'> & {
|
|
70
110
|
unitId?: string;
|
|
71
111
|
chartId?: string;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import type { ChartThemeService } from '@univerjs-pro/engine-chart';
|
|
2
|
-
import type { LocaleService } from '@univerjs/core';
|
|
3
2
|
import type { ReactNode } from 'react';
|
|
3
|
+
import type { LocaleKey } from '../locale/types';
|
|
4
4
|
import { ChartTypeBits } from '@univerjs-pro/engine-chart';
|
|
5
5
|
export interface ISlideChartSelectOption {
|
|
6
6
|
label: ReactNode;
|
|
7
7
|
value: string;
|
|
8
8
|
}
|
|
9
|
+
export interface ISlideChartLocaleOption<T = string> {
|
|
10
|
+
label: LocaleKey;
|
|
11
|
+
value: T;
|
|
12
|
+
}
|
|
9
13
|
export declare const SLIDE_CHART_TYPE_OPTIONS: readonly [{
|
|
10
14
|
readonly label: "slides-chart-ui.chartTypes.line";
|
|
11
15
|
readonly value: ChartTypeBits.Line;
|
|
@@ -70,17 +74,5 @@ export declare const SLIDE_CHART_TYPE_OPTIONS: readonly [{
|
|
|
70
74
|
readonly label: "slides-chart-ui.chartTypes.boxplot";
|
|
71
75
|
readonly value: ChartTypeBits.Boxplot;
|
|
72
76
|
}];
|
|
73
|
-
export declare const SLIDE_CHART_STACK_OPTIONS:
|
|
74
|
-
label: string;
|
|
75
|
-
value: string;
|
|
76
|
-
}[];
|
|
77
|
-
export declare function buildSlideChartTypeOptions(localeService: Pick<LocaleService, 't'>): ISlideChartSelectOption[];
|
|
78
|
-
export declare function renderThemeColorStrip(colors: string[]): import("react").JSX.Element;
|
|
77
|
+
export declare const SLIDE_CHART_STACK_OPTIONS: Array<ISlideChartLocaleOption<string>>;
|
|
79
78
|
export declare function buildSlideChartThemeOptions(themes: string[], chartThemeService: Pick<ChartThemeService, 'getColors'>): ISlideChartSelectOption[];
|
|
80
|
-
export declare function buildTranslatedOptions<T extends string>(options: Array<{
|
|
81
|
-
label: string;
|
|
82
|
-
value: T;
|
|
83
|
-
}>, localeService: Pick<LocaleService, 't'>): Array<{
|
|
84
|
-
label: string;
|
|
85
|
-
value: T;
|
|
86
|
-
}>;
|
|
@@ -3,12 +3,14 @@ import type { IRenderConvertContext } from '@univerjs-pro/slides-ui';
|
|
|
3
3
|
import type { Nullable } from '@univerjs/core';
|
|
4
4
|
import type { BaseObject, IViewportInfo, UniverRenderingContext } from '@univerjs/engine-render';
|
|
5
5
|
import { ObjectAdaptor, SlideImageObject } from '@univerjs-pro/slides-ui';
|
|
6
|
-
import {
|
|
6
|
+
import { SlideChartHostProviderService } from '../../services/slide-chart-host-provider.service';
|
|
7
7
|
type SlideChartImageObjectProps = ConstructorParameters<typeof SlideImageObject>[1];
|
|
8
8
|
export declare class SlideChartImageObject extends SlideImageObject {
|
|
9
9
|
private _chartStroke?;
|
|
10
|
+
private _hideImage;
|
|
10
11
|
constructor(key: string, props: SlideChartImageObjectProps);
|
|
11
12
|
setChartStroke(stroke?: ISlideLineStyle): void;
|
|
13
|
+
setImageHidden(hidden: boolean): void;
|
|
12
14
|
changeChartSource(url: string): void;
|
|
13
15
|
protected _draw(ctx: UniverRenderingContext, bounds?: IViewportInfo, renderWidth?: number, renderHeight?: number): void;
|
|
14
16
|
private _drawChartStroke;
|
|
@@ -16,11 +18,10 @@ export declare class SlideChartImageObject extends SlideImageObject {
|
|
|
16
18
|
private _attachNativeLoadHandlers;
|
|
17
19
|
}
|
|
18
20
|
export declare class SlideChartObjectAdaptor extends ObjectAdaptor {
|
|
19
|
-
private readonly
|
|
21
|
+
private readonly _hostProvider;
|
|
20
22
|
zIndex: number;
|
|
21
|
-
constructor(
|
|
23
|
+
constructor(_hostProvider: SlideChartHostProviderService);
|
|
22
24
|
check(drawing: ISlideDrawing): boolean;
|
|
23
25
|
convert(drawing: ISlideDrawing, ctx: IRenderConvertContext): Nullable<BaseObject>;
|
|
24
|
-
private _watchSnapshotUpdates;
|
|
25
26
|
}
|
|
26
27
|
export {};
|