@univerjs-pro/sheets-print 0.1.10
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 +16 -0
- package/lib/cjs/index.js +1 -0
- package/lib/es/index.js +1 -0
- package/lib/index.css +1 -0
- package/lib/types/commands/operations/sheet-print.operation.d.ts +5 -0
- package/lib/types/common/constant.d.ts +2 -0
- package/lib/types/common/hooks.d.ts +1 -0
- package/lib/types/common/plugin-name.d.ts +1 -0
- package/lib/types/common/types.d.ts +34 -0
- package/lib/types/controllers/menu.d.ts +4 -0
- package/lib/types/controllers/sheet-print.controller.d.ts +17 -0
- package/lib/types/controllers/shortcut.d.ts +3 -0
- package/lib/types/index.d.ts +2 -0
- package/lib/types/locale/en-US.d.ts +95 -0
- package/lib/types/locale/index.d.ts +2 -0
- package/lib/types/locale/zh-CN.d.ts +95 -0
- package/lib/types/models/model.d.ts +0 -0
- package/lib/types/plugin.d.ts +16 -0
- package/lib/types/services/sheet-print-manager.service.d.ts +85 -0
- package/lib/types/views/components/sheet-print-canvas-view.d.ts +56 -0
- package/lib/types/views/components/sheet-print-page-preview.d.ts +9 -0
- package/lib/types/views/components/sheet-print-view.d.ts +3 -0
- package/lib/umd/index.js +1 -0
- package/package.json +92 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
print: {
|
|
3
|
+
header: {
|
|
4
|
+
total: string;
|
|
5
|
+
pages: string;
|
|
6
|
+
cancel: string;
|
|
7
|
+
next: string;
|
|
8
|
+
};
|
|
9
|
+
menu: string;
|
|
10
|
+
title: string;
|
|
11
|
+
size: {
|
|
12
|
+
title: string;
|
|
13
|
+
letter: string;
|
|
14
|
+
tabloid: string;
|
|
15
|
+
legal: string;
|
|
16
|
+
statement: string;
|
|
17
|
+
executive: string;
|
|
18
|
+
folio: string;
|
|
19
|
+
a3: string;
|
|
20
|
+
a4: string;
|
|
21
|
+
a5: string;
|
|
22
|
+
b4: string;
|
|
23
|
+
b5: string;
|
|
24
|
+
};
|
|
25
|
+
margin: {
|
|
26
|
+
title: string;
|
|
27
|
+
normal: string;
|
|
28
|
+
narrow: string;
|
|
29
|
+
wide: string;
|
|
30
|
+
};
|
|
31
|
+
area: {
|
|
32
|
+
title: string;
|
|
33
|
+
currentSheet: string;
|
|
34
|
+
workbook: string;
|
|
35
|
+
currentSelection: string;
|
|
36
|
+
};
|
|
37
|
+
selection: {
|
|
38
|
+
title: string;
|
|
39
|
+
allWorkbook: string;
|
|
40
|
+
workbookUnit: string;
|
|
41
|
+
};
|
|
42
|
+
scale: {
|
|
43
|
+
title: string;
|
|
44
|
+
normal: string;
|
|
45
|
+
fitWidth: string;
|
|
46
|
+
fitHeight: string;
|
|
47
|
+
fitPage: string;
|
|
48
|
+
custom: string;
|
|
49
|
+
};
|
|
50
|
+
orientation: {
|
|
51
|
+
title: string;
|
|
52
|
+
landscape: string;
|
|
53
|
+
portrait: string;
|
|
54
|
+
};
|
|
55
|
+
formatting: {
|
|
56
|
+
title: string;
|
|
57
|
+
skeleton: string;
|
|
58
|
+
};
|
|
59
|
+
align: {
|
|
60
|
+
title: string;
|
|
61
|
+
horizontal: {
|
|
62
|
+
title: string;
|
|
63
|
+
middle: string;
|
|
64
|
+
start: string;
|
|
65
|
+
end: string;
|
|
66
|
+
};
|
|
67
|
+
vertical: {
|
|
68
|
+
title: string;
|
|
69
|
+
start: string;
|
|
70
|
+
end: string;
|
|
71
|
+
middle: string;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
headerFooter: {
|
|
75
|
+
title: string;
|
|
76
|
+
page: string;
|
|
77
|
+
workbook: string;
|
|
78
|
+
sheet: string;
|
|
79
|
+
date: string;
|
|
80
|
+
time: string;
|
|
81
|
+
};
|
|
82
|
+
freeze: {
|
|
83
|
+
title: string;
|
|
84
|
+
desc: string;
|
|
85
|
+
row: string;
|
|
86
|
+
column: string;
|
|
87
|
+
};
|
|
88
|
+
limit: {
|
|
89
|
+
page: string;
|
|
90
|
+
waterMark: string;
|
|
91
|
+
link: string;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
export default _default;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
print: {
|
|
3
|
+
header: {
|
|
4
|
+
total: string;
|
|
5
|
+
pages: string;
|
|
6
|
+
cancel: string;
|
|
7
|
+
next: string;
|
|
8
|
+
};
|
|
9
|
+
menu: string;
|
|
10
|
+
title: string;
|
|
11
|
+
size: {
|
|
12
|
+
title: string;
|
|
13
|
+
letter: string;
|
|
14
|
+
tabloid: string;
|
|
15
|
+
legal: string;
|
|
16
|
+
statement: string;
|
|
17
|
+
executive: string;
|
|
18
|
+
folio: string;
|
|
19
|
+
a3: string;
|
|
20
|
+
a4: string;
|
|
21
|
+
a5: string;
|
|
22
|
+
b4: string;
|
|
23
|
+
b5: string;
|
|
24
|
+
};
|
|
25
|
+
margin: {
|
|
26
|
+
title: string;
|
|
27
|
+
normal: string;
|
|
28
|
+
narrow: string;
|
|
29
|
+
wide: string;
|
|
30
|
+
};
|
|
31
|
+
area: {
|
|
32
|
+
title: string;
|
|
33
|
+
currentSheet: string;
|
|
34
|
+
workbook: string;
|
|
35
|
+
currentSelection: string;
|
|
36
|
+
};
|
|
37
|
+
selection: {
|
|
38
|
+
title: string;
|
|
39
|
+
allWorkbook: string;
|
|
40
|
+
workbookUnit: string;
|
|
41
|
+
};
|
|
42
|
+
scale: {
|
|
43
|
+
title: string;
|
|
44
|
+
normal: string;
|
|
45
|
+
fitWidth: string;
|
|
46
|
+
fitHeight: string;
|
|
47
|
+
fitPage: string;
|
|
48
|
+
custom: string;
|
|
49
|
+
};
|
|
50
|
+
orientation: {
|
|
51
|
+
title: string;
|
|
52
|
+
landscape: string;
|
|
53
|
+
portrait: string;
|
|
54
|
+
};
|
|
55
|
+
formatting: {
|
|
56
|
+
title: string;
|
|
57
|
+
skeleton: string;
|
|
58
|
+
};
|
|
59
|
+
align: {
|
|
60
|
+
title: string;
|
|
61
|
+
horizontal: {
|
|
62
|
+
title: string;
|
|
63
|
+
middle: string;
|
|
64
|
+
start: string;
|
|
65
|
+
end: string;
|
|
66
|
+
};
|
|
67
|
+
vertical: {
|
|
68
|
+
title: string;
|
|
69
|
+
start: string;
|
|
70
|
+
end: string;
|
|
71
|
+
middle: string;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
headerFooter: {
|
|
75
|
+
title: string;
|
|
76
|
+
page: string;
|
|
77
|
+
workbook: string;
|
|
78
|
+
sheet: string;
|
|
79
|
+
date: string;
|
|
80
|
+
time: string;
|
|
81
|
+
};
|
|
82
|
+
freeze: {
|
|
83
|
+
title: string;
|
|
84
|
+
desc: string;
|
|
85
|
+
row: string;
|
|
86
|
+
column: string;
|
|
87
|
+
};
|
|
88
|
+
limit: {
|
|
89
|
+
page: string;
|
|
90
|
+
waterMark: string;
|
|
91
|
+
link: string;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
export default _default;
|
|
File without changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Injector } from '@wendellhu/redi';
|
|
2
|
+
import { ComponentManager, IMenuService, IShortcutService } from '@univerjs/ui';
|
|
3
|
+
import { ICommandService, LocaleService, Plugin, UniverInstanceType } from '@univerjs/core';
|
|
4
|
+
|
|
5
|
+
export declare class SheetsPrintPlugin extends Plugin {
|
|
6
|
+
readonly _injector: Injector;
|
|
7
|
+
private readonly _commandService;
|
|
8
|
+
private readonly _localeService;
|
|
9
|
+
private readonly _shortcutService;
|
|
10
|
+
private readonly _menuService;
|
|
11
|
+
private readonly _componentManager;
|
|
12
|
+
static pluginName: string;
|
|
13
|
+
static type: UniverInstanceType;
|
|
14
|
+
constructor(_: unknown, _injector: Injector, _commandService: ICommandService, _localeService: LocaleService, _shortcutService: IShortcutService, _menuService: IMenuService, _componentManager: ComponentManager);
|
|
15
|
+
onReady(): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { ISheetPrintLayoutConfig, ISheetPrintRenderConfig } from '../common/types';
|
|
2
|
+
import { IPrintMargin } from '@univerjs-pro/print';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
import { SheetSkeletonManagerService } from '@univerjs/sheets-ui';
|
|
5
|
+
import { SelectionManagerService } from '@univerjs/sheets';
|
|
6
|
+
import { IFreeze, IRange, IUniverInstanceService } from '@univerjs/core';
|
|
7
|
+
|
|
8
|
+
export interface IPrintSheetInfo {
|
|
9
|
+
unitId: string;
|
|
10
|
+
subUnitId: string;
|
|
11
|
+
range: IRange;
|
|
12
|
+
freeze: IFreeze;
|
|
13
|
+
contentSize: {
|
|
14
|
+
w: number;
|
|
15
|
+
h: number;
|
|
16
|
+
};
|
|
17
|
+
scale: number;
|
|
18
|
+
}
|
|
19
|
+
export interface IPrintRowPage {
|
|
20
|
+
startRow: number;
|
|
21
|
+
endRow: number;
|
|
22
|
+
}
|
|
23
|
+
export interface IPrintColumnPage {
|
|
24
|
+
startColumn: number;
|
|
25
|
+
endColumn: number;
|
|
26
|
+
}
|
|
27
|
+
export interface ISheetPrintLayoutInfo {
|
|
28
|
+
pages: IRange[];
|
|
29
|
+
freeze: IFreeze;
|
|
30
|
+
scale: number;
|
|
31
|
+
unitId: string;
|
|
32
|
+
subUnitId: string;
|
|
33
|
+
}
|
|
34
|
+
export interface ISheetPrintManagerService {
|
|
35
|
+
layoutConfig$: Observable<ISheetPrintLayoutConfig>;
|
|
36
|
+
updateLayoutConfig(config: Partial<ISheetPrintLayoutConfig>): void;
|
|
37
|
+
get layoutConfig(): ISheetPrintLayoutConfig;
|
|
38
|
+
renderConfig$: Observable<ISheetPrintRenderConfig>;
|
|
39
|
+
updateRenderConfig(config: Partial<ISheetPrintRenderConfig>): void;
|
|
40
|
+
get renderConfig(): ISheetPrintRenderConfig;
|
|
41
|
+
layoutInfos$: Observable<ISheetPrintLayoutInfo[]>;
|
|
42
|
+
get layoutInfos(): ISheetPrintLayoutInfo[];
|
|
43
|
+
paperSize: {
|
|
44
|
+
w: number;
|
|
45
|
+
h: number;
|
|
46
|
+
};
|
|
47
|
+
paperMargin: IPrintMargin;
|
|
48
|
+
reLayout: () => void;
|
|
49
|
+
reset: () => void;
|
|
50
|
+
}
|
|
51
|
+
export declare const ISheetPrintManagerService: import('@wendellhu/redi').IdentifierDecorator<ISheetPrintManagerService>;
|
|
52
|
+
export declare class SheetPrintManagerService implements ISheetPrintManagerService {
|
|
53
|
+
private readonly _univerInstanceService;
|
|
54
|
+
private readonly _sheetSkeletonManagerService;
|
|
55
|
+
private readonly _selectionManagerService;
|
|
56
|
+
private _layoutConfig;
|
|
57
|
+
private _renderConfig;
|
|
58
|
+
private _layoutInfos;
|
|
59
|
+
private readonly _layoutInfos$;
|
|
60
|
+
private readonly _layoutConfig$;
|
|
61
|
+
private readonly _renderConfig$;
|
|
62
|
+
readonly layoutConfig$: Observable<ISheetPrintLayoutConfig>;
|
|
63
|
+
readonly renderConfig$: Observable<ISheetPrintRenderConfig>;
|
|
64
|
+
readonly layoutInfos$: Observable<ISheetPrintLayoutInfo[]>;
|
|
65
|
+
constructor(_univerInstanceService: IUniverInstanceService, _sheetSkeletonManagerService: SheetSkeletonManagerService, _selectionManagerService: SelectionManagerService);
|
|
66
|
+
get layoutInfos(): ISheetPrintLayoutInfo[];
|
|
67
|
+
get renderConfig(): ISheetPrintRenderConfig;
|
|
68
|
+
get layoutConfig(): ISheetPrintLayoutConfig;
|
|
69
|
+
get paperSize(): {
|
|
70
|
+
w: number;
|
|
71
|
+
h: number;
|
|
72
|
+
};
|
|
73
|
+
get paperMargin(): IPrintMargin;
|
|
74
|
+
updateLayoutConfig(config: Partial<ISheetPrintLayoutConfig>): void;
|
|
75
|
+
updateRenderConfig(config: Partial<ISheetPrintRenderConfig>): void;
|
|
76
|
+
reLayout(): void;
|
|
77
|
+
reset(): void;
|
|
78
|
+
private _calculate;
|
|
79
|
+
private _calculateSheetRangeById;
|
|
80
|
+
private _calculateCurrentSelectionRange;
|
|
81
|
+
private _calculateFinalRange;
|
|
82
|
+
private _calculatePrintScale;
|
|
83
|
+
private _calculateSubSheetRange;
|
|
84
|
+
private _calculateSheetPages;
|
|
85
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { IAccessor } from '@wendellhu/redi';
|
|
2
|
+
import { Engine } from '@univerjs/engine-render';
|
|
3
|
+
import { IFreeze, IRange, Disposable } from '@univerjs/core';
|
|
4
|
+
|
|
5
|
+
export interface IPrintSheetPageInfo {
|
|
6
|
+
unitId: string;
|
|
7
|
+
subUnitId: string;
|
|
8
|
+
range: IRange;
|
|
9
|
+
freeze: IFreeze;
|
|
10
|
+
scale: number;
|
|
11
|
+
page: number;
|
|
12
|
+
}
|
|
13
|
+
export declare class SheetPrintCanvasView extends Disposable {
|
|
14
|
+
private _accessor;
|
|
15
|
+
private _config;
|
|
16
|
+
private _isPreview;
|
|
17
|
+
private _previewScale;
|
|
18
|
+
private _engine;
|
|
19
|
+
private _scene;
|
|
20
|
+
private _key;
|
|
21
|
+
private _viewMain;
|
|
22
|
+
private _viewLeft;
|
|
23
|
+
private _viewTop;
|
|
24
|
+
private _viewLeftTop;
|
|
25
|
+
private _container;
|
|
26
|
+
private _sheetPrintManagerService;
|
|
27
|
+
private _skeleton;
|
|
28
|
+
private _univerInstanceService;
|
|
29
|
+
private _dirty;
|
|
30
|
+
get key(): string;
|
|
31
|
+
get engine(): Engine;
|
|
32
|
+
get container(): HTMLDivElement;
|
|
33
|
+
private get _renderConfig();
|
|
34
|
+
private get _layoutConfig();
|
|
35
|
+
private _spreadsheetObject;
|
|
36
|
+
constructor(_accessor: IAccessor, _config: IPrintSheetPageInfo, _isPreview?: boolean, _previewScale?: number);
|
|
37
|
+
dispose(): void;
|
|
38
|
+
private get _paperSize();
|
|
39
|
+
private get _margin();
|
|
40
|
+
private _initRenderer;
|
|
41
|
+
setPreviewScale(previewScale: number): void;
|
|
42
|
+
updateConfig(config: IPrintSheetPageInfo): void;
|
|
43
|
+
markDirty(dirty: boolean): void;
|
|
44
|
+
private _addComponent;
|
|
45
|
+
private _addViewport;
|
|
46
|
+
private _totalWidth;
|
|
47
|
+
private _totalHeight;
|
|
48
|
+
private _resizeViewport;
|
|
49
|
+
private _getTranslateOffset;
|
|
50
|
+
prepare(): void;
|
|
51
|
+
private _renderMainScene;
|
|
52
|
+
private _renderHeaderFooter;
|
|
53
|
+
private _renderWaterMark;
|
|
54
|
+
render(): void;
|
|
55
|
+
renderOnReady(): void;
|
|
56
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IPrintSheetPageInfo } from './sheet-print-canvas-view';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
|
|
4
|
+
export interface ISheetPrintPageViewProps {
|
|
5
|
+
page: number;
|
|
6
|
+
previewScale: number;
|
|
7
|
+
config: IPrintSheetPageInfo;
|
|
8
|
+
}
|
|
9
|
+
export declare const SheetPrintPagePreview: (props: ISheetPrintPageViewProps) => React.JSX.Element;
|