@univerjs-pro/sheets-chart-ui 1.0.0-alpha.1 → 1.0.0-alpha.2
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/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.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/config/config.d.ts +5 -0
- package/lib/types/controllers/ui.controller.d.ts +2 -0
- package/lib/types/index.d.ts +2 -1
- package/lib/types/plugin.d.ts +4 -3
- package/lib/types/services/chart-content-layout.d.ts +36 -0
- package/lib/types/services/chart-image-rect.d.ts +15 -0
- package/lib/types/services/chart-render.service.d.ts +28 -3
- package/lib/types/services/chart-snapshot-store.service.d.ts +18 -0
- package/lib/types/services/sheet-chart-host.d.ts +51 -0
- package/lib/types/services/sheet-image-chart-host.d.ts +24 -0
- package/lib/types/services/sheets-chart-host-provider.service.d.ts +34 -10
- 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 -16
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { IChartHostRect, IChartHostStyle, IDomChartHost } from '@univerjs-pro/engine-chart';
|
|
2
|
+
import type { SheetCanvasFloatDomManagerService } from '@univerjs/sheets-drawing-ui';
|
|
3
|
+
import { Disposable } from '@univerjs/core';
|
|
4
|
+
export interface IChartHostHandle {
|
|
5
|
+
mountNode: HTMLElement;
|
|
6
|
+
dispose: () => void;
|
|
7
|
+
}
|
|
8
|
+
export type ChartHostHandle = IChartHostHandle;
|
|
9
|
+
export interface ISheetChartHostPlacement {
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
left: number;
|
|
13
|
+
top: number;
|
|
14
|
+
scaleX: number;
|
|
15
|
+
scaleY: number;
|
|
16
|
+
}
|
|
17
|
+
export type SheetChartHostPlacement = ISheetChartHostPlacement;
|
|
18
|
+
export declare function createHostElement(width: number, height: number): HTMLDivElement;
|
|
19
|
+
export declare class SheetChartHost extends Disposable implements IDomChartHost {
|
|
20
|
+
readonly chartId: string;
|
|
21
|
+
private readonly _getFloatDomInfo;
|
|
22
|
+
private readonly _getPlacement;
|
|
23
|
+
private readonly _setHostStyle;
|
|
24
|
+
private readonly _isProviderDisposed;
|
|
25
|
+
private readonly _markReady;
|
|
26
|
+
private readonly _markNotReady;
|
|
27
|
+
readonly mode: "dom";
|
|
28
|
+
private _mountNode;
|
|
29
|
+
private _managed;
|
|
30
|
+
private _pendingToken;
|
|
31
|
+
private _pendingHost;
|
|
32
|
+
private _waiter;
|
|
33
|
+
private _savedWrapperStyle;
|
|
34
|
+
constructor(chartId: string, _getFloatDomInfo: () => ReturnType<SheetCanvasFloatDomManagerService['getFloatDomInfo']>, _getPlacement: () => SheetChartHostPlacement | null, _setHostStyle: (style: IChartHostStyle) => void, _isProviderDisposed: () => boolean, _markReady: () => void, _markNotReady: () => void);
|
|
35
|
+
isManaged(): boolean;
|
|
36
|
+
markUnmanaged(): void;
|
|
37
|
+
getRect(): IChartHostRect | null;
|
|
38
|
+
setStyle(style: IChartHostStyle): void;
|
|
39
|
+
ensureHandle(): Promise<ChartHostHandle>;
|
|
40
|
+
ensureMount(): Promise<HTMLElement | null>;
|
|
41
|
+
checkMounted(): boolean;
|
|
42
|
+
syncLayout(): void;
|
|
43
|
+
markReady(): void;
|
|
44
|
+
markNotReady(): void;
|
|
45
|
+
dispose(): void;
|
|
46
|
+
private _createHost;
|
|
47
|
+
private _cancelHostWait;
|
|
48
|
+
private _applyHostPlacement;
|
|
49
|
+
private _activateHostWrapper;
|
|
50
|
+
private _restoreHostWrapper;
|
|
51
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ChartImageSource, IChartHostRect, IChartHostStyle } from '@univerjs-pro/engine-chart';
|
|
2
|
+
import type { Rect } from '@univerjs/engine-render';
|
|
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: () => Rect | 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 { ChartHostRenderMode, IDomChartHost, IImageChartHost } from '@univerjs-pro/engine-chart';
|
|
1
2
|
import type { Rect } from '@univerjs/engine-render';
|
|
2
3
|
import type { Observable } from 'rxjs';
|
|
4
|
+
import type { ChartHostHandle } from './sheet-chart-host';
|
|
3
5
|
import { Disposable } from '@univerjs/core';
|
|
4
6
|
import { IRenderManagerService } from '@univerjs/engine-render';
|
|
5
7
|
import { SheetCanvasFloatDomManagerService } from '@univerjs/sheets-drawing-ui';
|
|
8
|
+
import { ChartSnapshotStoreService } from './chart-snapshot-store.service';
|
|
9
|
+
export { createHostElement } from './sheet-chart-host';
|
|
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
19
|
getHostSize: (chartId: string) => Rect | 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
40
|
getHostSize(id: string): Rect | 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: 'image'): Promise<IImageChartHost | null>;
|
|
46
|
+
ensureHost(id: string, mode: 'dom'): Promise<IDomChartHost | null>;
|
|
47
|
+
ensureHost(id: string, mode: ChartHostRenderMode): 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>;
|