@univerjs-pro/sheets-print 0.2.4 → 0.2.6

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.
@@ -8,6 +8,11 @@
8
8
  },
9
9
  "menu": "Print",
10
10
  "title": "Print",
11
+ "screenshot": {
12
+ "title": "Copy as picture",
13
+ "success": "Picture successful saved to clipboard!",
14
+ "fail": "Picture failed save to clipboard!"
15
+ },
11
16
  "size": {
12
17
  "title": "Paper Size",
13
18
  "letter": "Letter (8.5\" x11\")",
@@ -8,6 +8,11 @@
8
8
  },
9
9
  "menu": "Print",
10
10
  "title": "Print",
11
+ "screenshot": {
12
+ "title": "Copy as picture",
13
+ "success": "Picture successful saved to clipboard!",
14
+ "fail": "Picture failed save to clipboard!"
15
+ },
11
16
  "size": {
12
17
  "title": "Paper Size",
13
18
  "letter": "Letter (8.5\" x11\")",
@@ -8,6 +8,11 @@
8
8
  },
9
9
  "menu": "Print",
10
10
  "title": "Print",
11
+ "screenshot": {
12
+ "title": "Copy as picture",
13
+ "success": "Picture successful saved to clipboard!",
14
+ "fail": "Picture failed save to clipboard!"
15
+ },
11
16
  "size": {
12
17
  "title": "Paper Size",
13
18
  "letter": "Letter (8.5\" x11\")",
@@ -8,6 +8,11 @@
8
8
  },
9
9
  "menu": "打印",
10
10
  "title": "打印设置",
11
+ "screenshot": {
12
+ "title": "复制为截图",
13
+ "success": "图片已保存到剪贴板",
14
+ "fail": "图片已保存失败"
15
+ },
11
16
  "size": {
12
17
  "title": "纸张大小",
13
18
  "letter": "信纸(21.6厘米 x 27.9厘米)",
@@ -8,6 +8,11 @@
8
8
  },
9
9
  "menu": "Print",
10
10
  "title": "Print",
11
+ "screenshot": {
12
+ "title": "Copy as picture",
13
+ "success": "Picture successful saved to clipboard!",
14
+ "fail": "Picture failed save to clipboard!"
15
+ },
11
16
  "size": {
12
17
  "title": "Paper Size",
13
18
  "letter": "Letter (8.5\" x11\")",
@@ -0,0 +1,4 @@
1
+ import { ICommand } from '@univerjs/core';
2
+
3
+ export declare function convertDataURL2File(data: string, type: string): Blob;
4
+ export declare const SheetScreenShotOperation: ICommand;
@@ -25,6 +25,10 @@ export interface ISheetPrintLayoutConfig {
25
25
  customScale: number;
26
26
  freeze: PrintFreeze[];
27
27
  margin: PrintPaperMargin;
28
+ pageSizeCustom?: {
29
+ w: number;
30
+ h: number;
31
+ };
28
32
  }
29
33
  export interface ISheetPrintRenderConfig {
30
34
  gridlines: boolean;
@@ -1,4 +1,5 @@
1
+ import { IAccessor } from '@univerjs/core';
1
2
  import { IMenuButtonItem } from '@univerjs/ui';
2
- import { IAccessor } from '@wendellhu/redi';
3
3
 
4
4
  export declare function PrintMenuItemFactory(accessor: IAccessor): IMenuButtonItem;
5
+ export declare function ScreenshotMenuItemFactory(accessor: IAccessor): IMenuButtonItem;
@@ -1,16 +1,15 @@
1
1
  import { Disposable, ICommandService } from '@univerjs/core';
2
- import { IGlobalZoneService } from '@univerjs/ui';
3
- import { Injector } from '@wendellhu/redi';
2
+ import { ComponentManager, IGlobalZoneService } from '@univerjs/ui';
4
3
  import { ISheetPrintManagerService } from '../services/sheet-print-manager.service';
5
- import { SheetPrintLicenseService } from '../services/sheet-print-license.service';
4
+ import { SheetPrintClientService } from '../services/sheet-print.service';
6
5
 
7
6
  export declare class SheetPrintController extends Disposable {
8
7
  private readonly _printService;
9
8
  private readonly _commandService;
10
- private readonly _injector;
11
9
  private readonly _sheetPrintManagerService;
12
- private readonly _sheetPrintLicenseService;
13
- constructor(_printService: IGlobalZoneService, _commandService: ICommandService, _injector: Injector, _sheetPrintManagerService: ISheetPrintManagerService, _sheetPrintLicenseService: SheetPrintLicenseService);
10
+ private readonly _sheetPrintClientService;
11
+ private readonly _componentManager;
12
+ constructor(_printService: IGlobalZoneService, _commandService: ICommandService, _sheetPrintManagerService: ISheetPrintManagerService, _sheetPrintClientService: SheetPrintClientService, _componentManager: ComponentManager);
14
13
  private _initialize;
15
14
  private _initComponents;
16
15
  private _initConfigChangeListener;
@@ -8,6 +8,11 @@ declare const locales: {
8
8
  };
9
9
  menu: string;
10
10
  title: string;
11
+ screenshot: {
12
+ title: string;
13
+ success: string;
14
+ fail: string;
15
+ };
11
16
  size: {
12
17
  title: string;
13
18
  letter: string;
@@ -1,6 +1,5 @@
1
- import { ICommandService, Plugin, UniverInstanceType } from '@univerjs/core';
1
+ import { ICommandService, Injector, Plugin, UniverInstanceType } from '@univerjs/core';
2
2
  import { MenuConfig, ComponentManager, IMenuService, IShortcutService } from '@univerjs/ui';
3
- import { Injector } from '@wendellhu/redi';
4
3
 
5
4
  export interface IUniverSheetsPrintConfig {
6
5
  menu: MenuConfig;
@@ -31,6 +31,11 @@ export interface ISheetPrintLayoutInfo {
31
31
  scale: number;
32
32
  unitId: string;
33
33
  subUnitId: string;
34
+ margin: IPrintMargin;
35
+ pageSize: {
36
+ w: number;
37
+ h: number;
38
+ };
34
39
  }
35
40
  export interface ISheetPrintManagerService {
36
41
  layoutConfig$: Observable<ISheetPrintLayoutConfig>;
@@ -49,7 +54,13 @@ export interface ISheetPrintManagerService {
49
54
  reLayout: () => void;
50
55
  reset: () => void;
51
56
  }
52
- export declare const ISheetPrintManagerService: import('@wendellhu/redi').IdentifierDecorator<ISheetPrintManagerService>;
57
+ export declare const ISheetPrintManagerService: import('@univerjs/core').IdentifierDecorator<ISheetPrintManagerService>;
58
+ export declare const DEFAULT_FREEZE: {
59
+ startColumn: number;
60
+ startRow: number;
61
+ xSplit: number;
62
+ ySplit: number;
63
+ };
53
64
  export declare class SheetPrintManagerService implements ISheetPrintManagerService {
54
65
  private readonly _univerInstanceService;
55
66
  private readonly _sheetsSelectionsSrv;
@@ -0,0 +1,17 @@
1
+ import { Injector, IRange } from '@univerjs/core';
2
+ import { IGlobalZoneService } from '@univerjs/ui';
3
+ import { IRenderManagerService } from '@univerjs/engine-render';
4
+ import { ISheetPrintRenderConfig } from '../common/types';
5
+ import { ISheetPrintLayoutInfo, ISheetPrintManagerService } from './sheet-print-manager.service';
6
+ import { SheetPrintLicenseService } from './sheet-print-license.service';
7
+
8
+ export declare class SheetPrintClientService {
9
+ private readonly _sheetPrintLicenseService;
10
+ private readonly _injector;
11
+ private readonly _globalZoneService;
12
+ private readonly _sheetPrintManagerService;
13
+ private readonly _renderManagerService;
14
+ constructor(_sheetPrintLicenseService: SheetPrintLicenseService, _injector: Injector, _globalZoneService: IGlobalZoneService, _sheetPrintManagerService: ISheetPrintManagerService, _renderManagerService: IRenderManagerService);
15
+ print(configs: ISheetPrintLayoutInfo[], renderConfig: ISheetPrintRenderConfig): Promise<boolean>;
16
+ getRangeImage(unitId: string, subUnitId: string, range: IRange): string | false;
17
+ }
@@ -1,6 +1,7 @@
1
- import { IFreeze, IRange, Disposable } from '@univerjs/core';
1
+ import { IAccessor, IFreeze, IRange, Disposable } from '@univerjs/core';
2
2
  import { Engine } from '@univerjs/engine-render';
3
- import { IAccessor } from '@wendellhu/redi';
3
+ import { IPrintMargin } from '@univerjs-pro/print';
4
+ import { ISheetPrintRenderConfig } from '../../common/types';
4
5
 
5
6
  export interface IPrintSheetPageInfo {
6
7
  unitId: string;
@@ -9,10 +10,16 @@ export interface IPrintSheetPageInfo {
9
10
  freeze: IFreeze;
10
11
  scale: number;
11
12
  page: number;
13
+ pageSize: {
14
+ w: number;
15
+ h: number;
16
+ };
17
+ margin: IPrintMargin;
12
18
  }
13
19
  export declare class SheetPrintCanvasView extends Disposable {
14
20
  private _accessor;
15
21
  private _config;
22
+ private _renderConfig;
16
23
  private _isPreview;
17
24
  private _previewScale;
18
25
  private _engine;
@@ -26,7 +33,6 @@ export declare class SheetPrintCanvasView extends Disposable {
26
33
  private _viewTop;
27
34
  private _viewLeftTop;
28
35
  private _container;
29
- private _sheetPrintManagerService;
30
36
  private _skeleton;
31
37
  private _univerInstanceService;
32
38
  private _dirty;
@@ -34,13 +40,13 @@ export declare class SheetPrintCanvasView extends Disposable {
34
40
  get key(): string;
35
41
  get engine(): Engine;
36
42
  get container(): HTMLDivElement;
37
- private get _renderConfig();
38
- private get _layoutConfig();
43
+ get renderConfig(): ISheetPrintRenderConfig;
44
+ set renderConfig(config: ISheetPrintRenderConfig);
39
45
  private _spreadsheetObject;
40
- constructor(_accessor: IAccessor, _config: IPrintSheetPageInfo, _isPreview?: boolean, _previewScale?: number);
46
+ constructor(_accessor: IAccessor, _config: IPrintSheetPageInfo, _renderConfig: ISheetPrintRenderConfig, _isPreview?: boolean, _previewScale?: number);
41
47
  dispose(): void;
42
- private get _paperSize();
43
- private get _margin();
48
+ private get paperSize();
49
+ private get margin();
44
50
  private _initRenderer;
45
51
  setPreviewScale(previewScale: number): void;
46
52
  updateConfig(config: IPrintSheetPageInfo): void;
@@ -57,4 +63,5 @@ export declare class SheetPrintCanvasView extends Disposable {
57
63
  private _renderWaterMark;
58
64
  render(): void;
59
65
  renderOnReady(): void;
66
+ getImage(): string;
60
67
  }