@hufe921/canvas-editor 0.9.9
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/LICENSE +21 -0
- package/README.md +53 -0
- package/dist/canvas-editor.es.js +11339 -0
- package/dist/canvas-editor.es.js.map +1 -0
- package/dist/canvas-editor.umd.js +59 -0
- package/dist/canvas-editor.umd.js.map +1 -0
- package/dist/src/editor/core/command/Command.d.ts +148 -0
- package/dist/src/editor/core/command/CommandAdapt.d.ts +91 -0
- package/dist/src/editor/core/contextmenu/ContextMenu.d.ts +25 -0
- package/dist/src/editor/core/contextmenu/menus/controlMenus.d.ts +2 -0
- package/dist/src/editor/core/contextmenu/menus/globalMenus.d.ts +2 -0
- package/dist/src/editor/core/contextmenu/menus/hyperlinkMenus.d.ts +2 -0
- package/dist/src/editor/core/contextmenu/menus/imageMenus.d.ts +2 -0
- package/dist/src/editor/core/contextmenu/menus/tableMenus.d.ts +2 -0
- package/dist/src/editor/core/cursor/Cursor.d.ts +15 -0
- package/dist/src/editor/core/cursor/CursorAgent.d.ts +15 -0
- package/dist/src/editor/core/draw/Draw.d.ts +134 -0
- package/dist/src/editor/core/draw/control/Control.d.ts +35 -0
- package/dist/src/editor/core/draw/control/checkbox/CheckboxControl.d.ts +15 -0
- package/dist/src/editor/core/draw/control/select/SelectControl.d.ts +21 -0
- package/dist/src/editor/core/draw/control/text/TextControl.d.ts +13 -0
- package/dist/src/editor/core/draw/frame/Background.d.ts +6 -0
- package/dist/src/editor/core/draw/frame/Header.d.ts +7 -0
- package/dist/src/editor/core/draw/frame/Margin.d.ts +7 -0
- package/dist/src/editor/core/draw/frame/PageNumber.d.ts +7 -0
- package/dist/src/editor/core/draw/frame/Watermark.d.ts +7 -0
- package/dist/src/editor/core/draw/interactive/Search.d.ts +26 -0
- package/dist/src/editor/core/draw/particle/CheckboxParticle.d.ts +7 -0
- package/dist/src/editor/core/draw/particle/HyperlinkParticle.d.ts +16 -0
- package/dist/src/editor/core/draw/particle/ImageParticle.d.ts +9 -0
- package/dist/src/editor/core/draw/particle/PageBreak.d.ts +12 -0
- package/dist/src/editor/core/draw/particle/Separator.d.ts +4 -0
- package/dist/src/editor/core/draw/particle/Subscript.d.ts +4 -0
- package/dist/src/editor/core/draw/particle/Superscript.d.ts +4 -0
- package/dist/src/editor/core/draw/particle/TextParticle.d.ts +18 -0
- package/dist/src/editor/core/draw/particle/block/BlockParticle.d.ts +14 -0
- package/dist/src/editor/core/draw/particle/block/modules/BaseBlock.d.ts +15 -0
- package/dist/src/editor/core/draw/particle/block/modules/IFrameBlock.d.ts +7 -0
- package/dist/src/editor/core/draw/particle/block/modules/VideoBlock.d.ts +6 -0
- package/dist/src/editor/core/draw/particle/date/DateParticle.d.ts +14 -0
- package/dist/src/editor/core/draw/particle/date/DatePicker.d.ts +41 -0
- package/dist/src/editor/core/draw/particle/latex/LaTexParticle.d.ts +7 -0
- package/dist/src/editor/core/draw/particle/latex/utils/LaTexUtils.d.ts +47 -0
- package/dist/src/editor/core/draw/particle/latex/utils/hershey.d.ts +10 -0
- package/dist/src/editor/core/draw/particle/latex/utils/symbols.d.ts +8 -0
- package/dist/src/editor/core/draw/particle/previewer/Previewer.d.ts +34 -0
- package/dist/src/editor/core/draw/particle/table/TableParticle.d.ts +11 -0
- package/dist/src/editor/core/draw/particle/table/TableTool.d.ts +22 -0
- package/dist/src/editor/core/draw/richtext/AbstractRichText.d.ts +14 -0
- package/dist/src/editor/core/draw/richtext/Highlight.d.ts +7 -0
- package/dist/src/editor/core/draw/richtext/Strikeout.d.ts +7 -0
- package/dist/src/editor/core/draw/richtext/Underline.d.ts +7 -0
- package/dist/src/editor/core/event/CanvasEvent.d.ts +37 -0
- package/dist/src/editor/core/event/GlobalEvent.d.ts +20 -0
- package/dist/src/editor/core/history/HistoryManager.d.ts +10 -0
- package/dist/src/editor/core/listener/Listener.d.ts +13 -0
- package/dist/src/editor/core/observer/ScrollObserver.d.ts +9 -0
- package/dist/src/editor/core/observer/SelectionObserver.d.ts +16 -0
- package/dist/src/editor/core/position/Position.d.ts +19 -0
- package/dist/src/editor/core/range/RangeManager.d.ts +21 -0
- package/dist/src/editor/core/register/Register.d.ts +14 -0
- package/dist/src/editor/core/shortcut/Shortcut.d.ts +14 -0
- package/dist/src/editor/core/shortcut/keys/richtextKeys.d.ts +2 -0
- package/dist/src/editor/core/worker/WorkerManager.d.ts +7 -0
- package/dist/src/editor/core/worker/works/wordCount.d.ts +1 -0
- package/dist/src/editor/dataset/constant/Checkbox.d.ts +2 -0
- package/dist/src/editor/dataset/constant/Common.d.ts +4 -0
- package/dist/src/editor/dataset/constant/ContextMenu.d.ts +3 -0
- package/dist/src/editor/dataset/constant/Control.d.ts +2 -0
- package/dist/src/editor/dataset/constant/Cursor.d.ts +1 -0
- package/dist/src/editor/dataset/constant/Editor.d.ts +1 -0
- package/dist/src/editor/dataset/constant/Element.d.ts +6 -0
- package/dist/src/editor/dataset/constant/Header.d.ts +2 -0
- package/dist/src/editor/dataset/constant/Regular.d.ts +4 -0
- package/dist/src/editor/dataset/constant/Watermark.d.ts +2 -0
- package/dist/src/editor/dataset/enum/Block.d.ts +4 -0
- package/dist/src/editor/dataset/enum/Control.d.ts +16 -0
- package/dist/src/editor/dataset/enum/Editor.d.ts +21 -0
- package/dist/src/editor/dataset/enum/Element.d.ts +16 -0
- package/dist/src/editor/dataset/enum/ElementStyle.d.ts +12 -0
- package/dist/src/editor/dataset/enum/Event.d.ts +5 -0
- package/dist/src/editor/dataset/enum/KeyMap.d.ts +82 -0
- package/dist/src/editor/dataset/enum/Observer.d.ts +6 -0
- package/dist/src/editor/dataset/enum/Row.d.ts +6 -0
- package/dist/src/editor/dataset/enum/table/TableTool.d.ts +4 -0
- package/dist/src/editor/index.d.ts +25 -0
- package/dist/src/editor/interface/Block.d.ts +12 -0
- package/dist/src/editor/interface/Checkbox.d.ts +13 -0
- package/dist/src/editor/interface/Common.d.ts +5 -0
- package/dist/src/editor/interface/Control.d.ts +50 -0
- package/dist/src/editor/interface/Draw.d.ts +30 -0
- package/dist/src/editor/interface/Editor.d.ts +55 -0
- package/dist/src/editor/interface/Element.d.ts +99 -0
- package/dist/src/editor/interface/Header.d.ts +6 -0
- package/dist/src/editor/interface/Listener.d.ts +29 -0
- package/dist/src/editor/interface/Margin.d.ts +1 -0
- package/dist/src/editor/interface/Position.d.ts +37 -0
- package/dist/src/editor/interface/Previewer.d.ts +11 -0
- package/dist/src/editor/interface/Range.d.ts +11 -0
- package/dist/src/editor/interface/Row.d.ts +14 -0
- package/dist/src/editor/interface/Search.d.ts +14 -0
- package/dist/src/editor/interface/Watermark.d.ts +7 -0
- package/dist/src/editor/interface/contextmenu/ContextMenu.d.ts +20 -0
- package/dist/src/editor/interface/shortcut/Shortcut.d.ts +10 -0
- package/dist/src/editor/interface/table/Colgroup.d.ts +4 -0
- package/dist/src/editor/interface/table/Td.d.ts +19 -0
- package/dist/src/editor/interface/table/Tr.d.ts +6 -0
- package/dist/src/editor/utils/clipboard.d.ts +5 -0
- package/dist/src/editor/utils/element.d.ts +10 -0
- package/dist/src/editor/utils/index.d.ts +8 -0
- package/dist/src/editor/utils/print.d.ts +1 -0
- package/package.json +60 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Draw } from '../draw/Draw';
|
|
2
|
+
import { CanvasEvent } from '../event/CanvasEvent';
|
|
3
|
+
export declare class Cursor {
|
|
4
|
+
private draw;
|
|
5
|
+
private container;
|
|
6
|
+
private options;
|
|
7
|
+
private position;
|
|
8
|
+
private cursorDom;
|
|
9
|
+
private cursorAgent;
|
|
10
|
+
constructor(draw: Draw, canvasEvent: CanvasEvent);
|
|
11
|
+
getCursorDom(): HTMLDivElement;
|
|
12
|
+
getAgentDom(): HTMLTextAreaElement;
|
|
13
|
+
drawCursor(): void;
|
|
14
|
+
recoveryCursor(): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Draw } from '../draw/Draw';
|
|
2
|
+
import { CanvasEvent } from '../event/CanvasEvent';
|
|
3
|
+
export declare class CursorAgent {
|
|
4
|
+
private draw;
|
|
5
|
+
private container;
|
|
6
|
+
private agentCursorDom;
|
|
7
|
+
private canvasEvent;
|
|
8
|
+
constructor(draw: Draw, canvasEvent: CanvasEvent);
|
|
9
|
+
getAgentCursorDom(): HTMLTextAreaElement;
|
|
10
|
+
private _keyDown;
|
|
11
|
+
private _input;
|
|
12
|
+
private _paste;
|
|
13
|
+
private _compositionstart;
|
|
14
|
+
private _compositionend;
|
|
15
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { IDrawOption, IPainterOptions } from '../../interface/Draw';
|
|
2
|
+
import { IEditorOption, IEditorResult } from '../../interface/Editor';
|
|
3
|
+
import { IElement, IElementStyle } from '../../interface/Element';
|
|
4
|
+
import { Cursor } from '../cursor/Cursor';
|
|
5
|
+
import { CanvasEvent } from '../event/CanvasEvent';
|
|
6
|
+
import { HistoryManager } from '../history/HistoryManager';
|
|
7
|
+
import { Listener } from '../listener/Listener';
|
|
8
|
+
import { Position } from '../position/Position';
|
|
9
|
+
import { RangeManager } from '../range/RangeManager';
|
|
10
|
+
import { Search } from './interactive/Search';
|
|
11
|
+
import { ImageParticle } from './particle/ImageParticle';
|
|
12
|
+
import { TableTool } from './particle/table/TableTool';
|
|
13
|
+
import { HyperlinkParticle } from './particle/HyperlinkParticle';
|
|
14
|
+
import { EditorMode, PageMode } from '../../dataset/enum/Editor';
|
|
15
|
+
import { Control } from './control/Control';
|
|
16
|
+
import { DeepRequired } from '../../interface/Common';
|
|
17
|
+
import { WorkerManager } from '../worker/WorkerManager';
|
|
18
|
+
import { Previewer } from './particle/previewer/Previewer';
|
|
19
|
+
import { DateParticle } from './particle/date/DateParticle';
|
|
20
|
+
import { IMargin } from '../../interface/Margin';
|
|
21
|
+
export declare class Draw {
|
|
22
|
+
private container;
|
|
23
|
+
private pageContainer;
|
|
24
|
+
private pageList;
|
|
25
|
+
private ctxList;
|
|
26
|
+
private pageNo;
|
|
27
|
+
private mode;
|
|
28
|
+
private options;
|
|
29
|
+
private position;
|
|
30
|
+
private elementList;
|
|
31
|
+
private listener;
|
|
32
|
+
private canvasEvent;
|
|
33
|
+
private cursor;
|
|
34
|
+
private range;
|
|
35
|
+
private margin;
|
|
36
|
+
private background;
|
|
37
|
+
private search;
|
|
38
|
+
private underline;
|
|
39
|
+
private strikeout;
|
|
40
|
+
private highlight;
|
|
41
|
+
private historyManager;
|
|
42
|
+
private previewer;
|
|
43
|
+
private imageParticle;
|
|
44
|
+
private laTexParticle;
|
|
45
|
+
private textParticle;
|
|
46
|
+
private tableParticle;
|
|
47
|
+
private tableTool;
|
|
48
|
+
private pageNumber;
|
|
49
|
+
private waterMark;
|
|
50
|
+
private header;
|
|
51
|
+
private hyperlinkParticle;
|
|
52
|
+
private dateParticle;
|
|
53
|
+
private separatorParticle;
|
|
54
|
+
private pageBreakParticle;
|
|
55
|
+
private superscriptParticle;
|
|
56
|
+
private subscriptParticle;
|
|
57
|
+
private checkboxParticle;
|
|
58
|
+
private blockParticle;
|
|
59
|
+
private control;
|
|
60
|
+
private workerManager;
|
|
61
|
+
private rowList;
|
|
62
|
+
private painterStyle;
|
|
63
|
+
private painterOptions;
|
|
64
|
+
private visiblePageNoList;
|
|
65
|
+
private intersectionPageNo;
|
|
66
|
+
constructor(container: HTMLDivElement, options: DeepRequired<IEditorOption>, elementList: IElement[], listener: Listener);
|
|
67
|
+
getMode(): EditorMode;
|
|
68
|
+
setMode(payload: EditorMode): void;
|
|
69
|
+
isReadonly(): boolean;
|
|
70
|
+
getWidth(): number;
|
|
71
|
+
getHeight(): number;
|
|
72
|
+
getCanvasWidth(): number;
|
|
73
|
+
getCanvasHeight(): number;
|
|
74
|
+
getInnerWidth(): number;
|
|
75
|
+
getOriginalInnerWidth(): number;
|
|
76
|
+
getMargins(): IMargin;
|
|
77
|
+
getOriginalMargins(): number[];
|
|
78
|
+
getPageGap(): number;
|
|
79
|
+
getPageNumberBottom(): number;
|
|
80
|
+
getHeaderTop(): number;
|
|
81
|
+
getMarginIndicatorSize(): number;
|
|
82
|
+
getDefaultBasicRowMarginHeight(): number;
|
|
83
|
+
getTdPadding(): number;
|
|
84
|
+
getContainer(): HTMLDivElement;
|
|
85
|
+
getPageContainer(): HTMLDivElement;
|
|
86
|
+
getVisiblePageNoList(): number[];
|
|
87
|
+
setVisiblePageNoList(payload: number[]): void;
|
|
88
|
+
getIntersectionPageNo(): number;
|
|
89
|
+
setIntersectionPageNo(payload: number): void;
|
|
90
|
+
getPageNo(): number;
|
|
91
|
+
setPageNo(payload: number): void;
|
|
92
|
+
getPage(): HTMLCanvasElement;
|
|
93
|
+
getPageList(): HTMLCanvasElement[];
|
|
94
|
+
getCtx(): CanvasRenderingContext2D;
|
|
95
|
+
getOptions(): DeepRequired<IEditorOption>;
|
|
96
|
+
getSearch(): Search;
|
|
97
|
+
getHistoryManager(): HistoryManager;
|
|
98
|
+
getPosition(): Position;
|
|
99
|
+
getRange(): RangeManager;
|
|
100
|
+
getElementList(): IElement[];
|
|
101
|
+
insertElementList(payload: IElement[]): void;
|
|
102
|
+
getOriginalElementList(): IElement[];
|
|
103
|
+
getCanvasEvent(): CanvasEvent;
|
|
104
|
+
getListener(): Listener;
|
|
105
|
+
getCursor(): Cursor;
|
|
106
|
+
getPreviewer(): Previewer;
|
|
107
|
+
getImageParticle(): ImageParticle;
|
|
108
|
+
getTableTool(): TableTool;
|
|
109
|
+
getHyperlinkParticle(): HyperlinkParticle;
|
|
110
|
+
getDateParticle(): DateParticle;
|
|
111
|
+
getControl(): Control;
|
|
112
|
+
getWorkerManager(): WorkerManager;
|
|
113
|
+
getRowCount(): number;
|
|
114
|
+
getDataURL(): string[];
|
|
115
|
+
getPainterStyle(): IElementStyle | null;
|
|
116
|
+
getPainterOptions(): IPainterOptions | null;
|
|
117
|
+
setPainterStyle(payload: IElementStyle | null, options?: IPainterOptions): void;
|
|
118
|
+
setDefaultRange(): void;
|
|
119
|
+
setPageMode(payload: PageMode): void;
|
|
120
|
+
setPageScale(payload: number): void;
|
|
121
|
+
setPaperSize(width: number, height: number): void;
|
|
122
|
+
setPaperMargin(payload: IMargin): void;
|
|
123
|
+
getValue(): IEditorResult;
|
|
124
|
+
private _formatContainer;
|
|
125
|
+
private _createPageContainer;
|
|
126
|
+
private _createPage;
|
|
127
|
+
private _getFont;
|
|
128
|
+
private _computeRowList;
|
|
129
|
+
private _drawRichText;
|
|
130
|
+
private _drawRow;
|
|
131
|
+
private _clearPage;
|
|
132
|
+
private _drawPage;
|
|
133
|
+
render(payload?: IDrawOption): void;
|
|
134
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { IControlInitOption, IControlInstance } from '../../../interface/Control';
|
|
2
|
+
import { IElement, IElementPosition } from '../../../interface/Element';
|
|
3
|
+
import { IRange } from '../../../interface/Range';
|
|
4
|
+
import { Draw } from '../Draw';
|
|
5
|
+
interface IMoveCursorResult {
|
|
6
|
+
newIndex: number;
|
|
7
|
+
newElement: IElement;
|
|
8
|
+
}
|
|
9
|
+
export declare class Control {
|
|
10
|
+
private draw;
|
|
11
|
+
private range;
|
|
12
|
+
private listener;
|
|
13
|
+
private options;
|
|
14
|
+
private activeControl;
|
|
15
|
+
constructor(draw: Draw);
|
|
16
|
+
isPartRangeInControlOutside(): boolean;
|
|
17
|
+
getContainer(): HTMLDivElement;
|
|
18
|
+
getElementList(): IElement[];
|
|
19
|
+
getPosition(): IElementPosition | null;
|
|
20
|
+
getPreY(): number;
|
|
21
|
+
getRange(): IRange;
|
|
22
|
+
shrinkBoundary(): void;
|
|
23
|
+
getActiveControl(): IControlInstance | null;
|
|
24
|
+
initControl(): void;
|
|
25
|
+
destroyControl(): void;
|
|
26
|
+
repaintControl(curIndex: number): void;
|
|
27
|
+
moveCursor(position: IControlInitOption): IMoveCursorResult;
|
|
28
|
+
removeControl(startIndex: number): number;
|
|
29
|
+
removePlaceholder(startIndex: number): void;
|
|
30
|
+
addPlaceholder(startIndex: number): void;
|
|
31
|
+
setValue(data: IElement[]): number;
|
|
32
|
+
keydown(evt: KeyboardEvent): number;
|
|
33
|
+
cut(): number;
|
|
34
|
+
}
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IControlInstance } from '../../../../interface/Control';
|
|
2
|
+
import { IElement } from '../../../../interface/Element';
|
|
3
|
+
import { Control } from '../Control';
|
|
4
|
+
export declare class CheckboxControl implements IControlInstance {
|
|
5
|
+
private element;
|
|
6
|
+
private control;
|
|
7
|
+
constructor(element: IElement, control: Control);
|
|
8
|
+
getElement(): IElement;
|
|
9
|
+
getCode(): string | null;
|
|
10
|
+
getValue(): IElement[];
|
|
11
|
+
setValue(): number;
|
|
12
|
+
setSelect(): void;
|
|
13
|
+
keydown(evt: KeyboardEvent): number;
|
|
14
|
+
cut(): number;
|
|
15
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { IControlInstance } from '../../../../interface/Control';
|
|
2
|
+
import { IElement } from '../../../../interface/Element';
|
|
3
|
+
import { Control } from '../Control';
|
|
4
|
+
export declare class SelectControl implements IControlInstance {
|
|
5
|
+
private element;
|
|
6
|
+
private control;
|
|
7
|
+
private isPopup;
|
|
8
|
+
private selectDom;
|
|
9
|
+
constructor(element: IElement, control: Control);
|
|
10
|
+
getElement(): IElement;
|
|
11
|
+
getCode(): string | null;
|
|
12
|
+
getValue(): IElement[];
|
|
13
|
+
setValue(): number;
|
|
14
|
+
keydown(evt: KeyboardEvent): number;
|
|
15
|
+
cut(): number;
|
|
16
|
+
clearSelect(): number;
|
|
17
|
+
setSelect(code: string): void;
|
|
18
|
+
private _createSelectPopupDom;
|
|
19
|
+
awake(): void;
|
|
20
|
+
destroy(): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IControlInstance } from '../../../../interface/Control';
|
|
2
|
+
import { IElement } from '../../../../interface/Element';
|
|
3
|
+
import { Control } from '../Control';
|
|
4
|
+
export declare class TextControl implements IControlInstance {
|
|
5
|
+
private element;
|
|
6
|
+
private control;
|
|
7
|
+
constructor(element: IElement, control: Control);
|
|
8
|
+
getElement(): IElement;
|
|
9
|
+
getValue(): IElement[];
|
|
10
|
+
setValue(data: IElement[]): number;
|
|
11
|
+
keydown(evt: KeyboardEvent): number;
|
|
12
|
+
cut(): number;
|
|
13
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { IElementPosition } from '../../../interface/Element';
|
|
2
|
+
import { ISearchResult } from '../../../interface/Search';
|
|
3
|
+
import { Draw } from '../Draw';
|
|
4
|
+
export interface INavigateInfo {
|
|
5
|
+
index: number;
|
|
6
|
+
count: number;
|
|
7
|
+
}
|
|
8
|
+
export declare class Search {
|
|
9
|
+
private draw;
|
|
10
|
+
private options;
|
|
11
|
+
private position;
|
|
12
|
+
private searchKeyword;
|
|
13
|
+
private searchNavigateIndex;
|
|
14
|
+
private searchMatchList;
|
|
15
|
+
constructor(draw: Draw);
|
|
16
|
+
getSearchKeyword(): string | null;
|
|
17
|
+
setSearchKeyword(payload: string | null): void;
|
|
18
|
+
searchNavigatePre(): number | null;
|
|
19
|
+
searchNavigateNext(): number | null;
|
|
20
|
+
searchNavigateScrollIntoView(position: IElementPosition): void;
|
|
21
|
+
getSearchNavigateIndexList(): any[];
|
|
22
|
+
getSearchMatchList(): ISearchResult[];
|
|
23
|
+
getSearchNavigateInfo(): null | INavigateInfo;
|
|
24
|
+
compute(payload: string): void;
|
|
25
|
+
render(ctx: CanvasRenderingContext2D, pageIndex: number): void;
|
|
26
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IRowElement } from '../../../interface/Row';
|
|
2
|
+
import { Draw } from '../Draw';
|
|
3
|
+
export declare class CheckboxParticle {
|
|
4
|
+
private options;
|
|
5
|
+
constructor(draw: Draw);
|
|
6
|
+
render(ctx: CanvasRenderingContext2D, element: IRowElement, x: number, y: number): void;
|
|
7
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IElement } from '../../..';
|
|
2
|
+
import { IElementPosition } from '../../../interface/Element';
|
|
3
|
+
import { IRowElement } from '../../../interface/Row';
|
|
4
|
+
import { Draw } from '../Draw';
|
|
5
|
+
export declare class HyperlinkParticle {
|
|
6
|
+
private draw;
|
|
7
|
+
private options;
|
|
8
|
+
private container;
|
|
9
|
+
private hyperlinkPopupContainer;
|
|
10
|
+
private hyperlinkDom;
|
|
11
|
+
constructor(draw: Draw);
|
|
12
|
+
private _createHyperlinkPopupDom;
|
|
13
|
+
drawHyperlinkPopup(element: IElement, position: IElementPosition): void;
|
|
14
|
+
clearHyperlinkPopup(): void;
|
|
15
|
+
render(ctx: CanvasRenderingContext2D, element: IRowElement, x: number, y: number): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IEditorOption } from '../../../interface/Editor';
|
|
2
|
+
import { IElement } from '../../../interface/Element';
|
|
3
|
+
import { Draw } from '../Draw';
|
|
4
|
+
export declare class ImageParticle {
|
|
5
|
+
protected options: Required<IEditorOption>;
|
|
6
|
+
protected imageCache: Map<string, HTMLImageElement>;
|
|
7
|
+
constructor(draw: Draw);
|
|
8
|
+
render(ctx: CanvasRenderingContext2D, element: IElement, x: number, y: number): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IRowElement } from '../../../interface/Row';
|
|
2
|
+
import { Draw } from '../Draw';
|
|
3
|
+
export declare class PageBreakParticle {
|
|
4
|
+
static readonly font: string;
|
|
5
|
+
static readonly fontSize: number;
|
|
6
|
+
static readonly displayName: string;
|
|
7
|
+
static readonly lineDash: number[];
|
|
8
|
+
private draw;
|
|
9
|
+
private options;
|
|
10
|
+
constructor(draw: Draw);
|
|
11
|
+
render(ctx: CanvasRenderingContext2D, element: IRowElement, x: number, y: number): void;
|
|
12
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { IElement } from '../../..';
|
|
2
|
+
import { IRowElement } from '../../../interface/Row';
|
|
3
|
+
import { Draw } from '../Draw';
|
|
4
|
+
export declare class TextParticle {
|
|
5
|
+
private ctx;
|
|
6
|
+
private curX;
|
|
7
|
+
private curY;
|
|
8
|
+
private text;
|
|
9
|
+
private curStyle;
|
|
10
|
+
private curColor?;
|
|
11
|
+
cacheMeasureText: Map<string, TextMetrics>;
|
|
12
|
+
constructor(draw: Draw);
|
|
13
|
+
measureText(ctx: CanvasRenderingContext2D, element: IElement): TextMetrics;
|
|
14
|
+
complete(): void;
|
|
15
|
+
record(ctx: CanvasRenderingContext2D, element: IRowElement, x: number, y: number): void;
|
|
16
|
+
private _setCurXY;
|
|
17
|
+
private _render;
|
|
18
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IRowElement } from '../../../../interface/Row';
|
|
2
|
+
import { Draw } from '../../Draw';
|
|
3
|
+
export declare class BlockParticle {
|
|
4
|
+
private draw;
|
|
5
|
+
private container;
|
|
6
|
+
private blockContainer;
|
|
7
|
+
private blockMap;
|
|
8
|
+
constructor(draw: Draw);
|
|
9
|
+
private _createBlockContainer;
|
|
10
|
+
getDraw(): Draw;
|
|
11
|
+
getBlockContainer(): HTMLDivElement;
|
|
12
|
+
render(pageNo: number, element: IRowElement, x: number, y: number): void;
|
|
13
|
+
clear(): void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IRowElement } from '../../../../../interface/Row';
|
|
2
|
+
import { BlockParticle } from '../BlockParticle';
|
|
3
|
+
export declare class BaseBlock {
|
|
4
|
+
private draw;
|
|
5
|
+
private element;
|
|
6
|
+
private block;
|
|
7
|
+
private blockContainer;
|
|
8
|
+
private blockItem;
|
|
9
|
+
constructor(blockParticle: BlockParticle, element: IRowElement);
|
|
10
|
+
getBlockElement(): IRowElement;
|
|
11
|
+
private _createBlockItem;
|
|
12
|
+
render(): void;
|
|
13
|
+
setClientRects(pageNo: number, x: number, y: number): void;
|
|
14
|
+
remove(): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IElement, IElementPosition } from '../../../../interface/Element';
|
|
2
|
+
import { IRowElement } from '../../../../interface/Row';
|
|
3
|
+
import { Draw } from '../../Draw';
|
|
4
|
+
export declare class DateParticle {
|
|
5
|
+
private draw;
|
|
6
|
+
private range;
|
|
7
|
+
private datePicker;
|
|
8
|
+
constructor(draw: Draw);
|
|
9
|
+
private _setValue;
|
|
10
|
+
getDateElementRange(): [number, number] | null;
|
|
11
|
+
clearDatePicker(): void;
|
|
12
|
+
renderDatePicker(element: IElement, position: IElementPosition): void;
|
|
13
|
+
render(ctx: CanvasRenderingContext2D, element: IRowElement, x: number, y: number): void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { IElement, IElementPosition } from '../../../../interface/Element';
|
|
2
|
+
export interface IDatePickerOption {
|
|
3
|
+
mountDom?: HTMLElement;
|
|
4
|
+
onSubmit?: (date: string) => any;
|
|
5
|
+
}
|
|
6
|
+
interface IRenderOption {
|
|
7
|
+
value: string;
|
|
8
|
+
element: IElement;
|
|
9
|
+
position: IElementPosition;
|
|
10
|
+
startTop?: number;
|
|
11
|
+
}
|
|
12
|
+
export declare class DatePicker {
|
|
13
|
+
private options;
|
|
14
|
+
private now;
|
|
15
|
+
private dom;
|
|
16
|
+
private renderOptions;
|
|
17
|
+
private isDatePicker;
|
|
18
|
+
private pickDate;
|
|
19
|
+
constructor(options?: IDatePickerOption);
|
|
20
|
+
private _createDom;
|
|
21
|
+
private _bindEvent;
|
|
22
|
+
private _setPosition;
|
|
23
|
+
isInvalidDate(value: Date): boolean;
|
|
24
|
+
private _setValue;
|
|
25
|
+
private _update;
|
|
26
|
+
private _toggleDateTimePicker;
|
|
27
|
+
private _setDatePick;
|
|
28
|
+
private _setTimePick;
|
|
29
|
+
private _scrollIntoView;
|
|
30
|
+
private _preMonth;
|
|
31
|
+
private _nextMonth;
|
|
32
|
+
private _preYear;
|
|
33
|
+
private _nextYear;
|
|
34
|
+
private _now;
|
|
35
|
+
private _toggleVisible;
|
|
36
|
+
private _submit;
|
|
37
|
+
formatDate(date: Date, format?: string): string;
|
|
38
|
+
render(option: IRenderOption): void;
|
|
39
|
+
dispose(): void;
|
|
40
|
+
}
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IElement } from '../../../../interface/Element';
|
|
2
|
+
import { ImageParticle } from '../ImageParticle';
|
|
3
|
+
import { LaTexSVG } from './utils/LaTexUtils';
|
|
4
|
+
export declare class LaTexParticle extends ImageParticle {
|
|
5
|
+
static convertLaTextToSVG(laTex: string): LaTexSVG;
|
|
6
|
+
render(ctx: CanvasRenderingContext2D, element: IElement, x: number, y: number): void;
|
|
7
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
declare const CONFIG: Record<string, number>;
|
|
2
|
+
interface Bbox {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
w: number;
|
|
6
|
+
h: number;
|
|
7
|
+
}
|
|
8
|
+
interface Expr {
|
|
9
|
+
type: string;
|
|
10
|
+
text: string;
|
|
11
|
+
mode: string;
|
|
12
|
+
chld: Expr[];
|
|
13
|
+
bbox: Bbox;
|
|
14
|
+
}
|
|
15
|
+
interface ExportOpt {
|
|
16
|
+
MIN_CHAR_H?: number;
|
|
17
|
+
MAX_W?: number;
|
|
18
|
+
MAX_H?: number;
|
|
19
|
+
MARGIN_X?: number;
|
|
20
|
+
MARGIN_Y?: number;
|
|
21
|
+
SCALE_X?: number;
|
|
22
|
+
SCALE_Y?: number;
|
|
23
|
+
STROKE_W?: number;
|
|
24
|
+
FG_COLOR?: string;
|
|
25
|
+
BG_COLOR?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface LaTexSVG {
|
|
28
|
+
svg: string;
|
|
29
|
+
width: number;
|
|
30
|
+
height: number;
|
|
31
|
+
}
|
|
32
|
+
export declare class LaTexUtils {
|
|
33
|
+
_latex: string;
|
|
34
|
+
_tree: Expr;
|
|
35
|
+
_tokens: string[];
|
|
36
|
+
_polylines: number[][][];
|
|
37
|
+
constructor(latex: string);
|
|
38
|
+
private resolveScale;
|
|
39
|
+
polylines(opt?: ExportOpt): number[][][];
|
|
40
|
+
pathd(opt?: ExportOpt): string;
|
|
41
|
+
svg(opt: ExportOpt): LaTexSVG;
|
|
42
|
+
pdf(opt: ExportOpt): string;
|
|
43
|
+
boxes(opt: ExportOpt): Bbox[];
|
|
44
|
+
box(opt: ExportOpt): Bbox;
|
|
45
|
+
}
|
|
46
|
+
declare const _impl: Record<string, Function>;
|
|
47
|
+
export { CONFIG, _impl };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { IElement, IElementPosition } from '../../../../interface/Element';
|
|
2
|
+
import { IPreviewerDrawOption } from '../../../../interface/Previewer';
|
|
3
|
+
import { Draw } from '../../Draw';
|
|
4
|
+
export declare class Previewer {
|
|
5
|
+
private container;
|
|
6
|
+
private canvas;
|
|
7
|
+
private draw;
|
|
8
|
+
private options;
|
|
9
|
+
private curElement;
|
|
10
|
+
private curElementSrc;
|
|
11
|
+
private previewerDrawOption;
|
|
12
|
+
private curPosition;
|
|
13
|
+
private resizerSelection;
|
|
14
|
+
private resizerHandleList;
|
|
15
|
+
private resizerImageContainer;
|
|
16
|
+
private resizerImage;
|
|
17
|
+
private width;
|
|
18
|
+
private height;
|
|
19
|
+
private mousedownX;
|
|
20
|
+
private mousedownY;
|
|
21
|
+
private curHandleIndex;
|
|
22
|
+
private previewerContainer;
|
|
23
|
+
private previewerImage;
|
|
24
|
+
constructor(draw: Draw);
|
|
25
|
+
private _createResizerDom;
|
|
26
|
+
private _mousedown;
|
|
27
|
+
private _mousemove;
|
|
28
|
+
private _dblclick;
|
|
29
|
+
private _drawPreviewer;
|
|
30
|
+
_setPreviewerTransform(scale: number, rotate: number, x: number, y: number): void;
|
|
31
|
+
private _clearPreviewer;
|
|
32
|
+
drawResizer(element: IElement, position: IElementPosition, options?: IPreviewerDrawOption): void;
|
|
33
|
+
clearResizer(): void;
|
|
34
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IElement } from '../../../..';
|
|
2
|
+
import { Draw } from '../../Draw';
|
|
3
|
+
export declare class TableParticle {
|
|
4
|
+
private range;
|
|
5
|
+
private options;
|
|
6
|
+
constructor(draw: Draw);
|
|
7
|
+
private _drawBorder;
|
|
8
|
+
computeRowColInfo(element: IElement): void;
|
|
9
|
+
drawRange(ctx: CanvasRenderingContext2D, element: IElement, startX: number, startY: number): void;
|
|
10
|
+
render(ctx: CanvasRenderingContext2D, element: IElement, startX: number, startY: number): void;
|
|
11
|
+
}
|