@hufe921/canvas-editor 0.9.136 → 1.0.0
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/CHANGELOG.md +52 -0
- package/README.md +11 -8
- package/dist/assets/catalog-B-cbxN0s.js.map +1 -1
- package/dist/assets/value-B0aX9J3d.js.map +1 -0
- package/dist/assets/wordCount-BWZRHbSB.js.map +1 -0
- package/dist/canvas-editor.js +5105 -2340
- package/dist/canvas-editor.js.map +1 -1
- package/dist/canvas-editor.umd.cjs +41 -37
- package/dist/canvas-editor.umd.cjs.map +1 -1
- package/dist/src/editor/core/cascade/CascadeManager.d.ts +28 -0
- package/dist/src/editor/core/cascade/expression/evaluator.d.ts +14 -0
- package/dist/src/editor/core/cascade/expression/parser.d.ts +36 -0
- package/dist/src/editor/core/cascade/expression/tokenizer.d.ts +19 -0
- package/dist/src/editor/core/command/Command.d.ts +12 -0
- package/dist/src/editor/core/command/CommandAdapt.d.ts +14 -2
- package/dist/src/editor/core/draw/Draw.d.ts +33 -0
- package/dist/src/editor/core/draw/column/ColumnManager.d.ts +14 -0
- package/dist/src/editor/core/draw/control/Control.d.ts +3 -0
- package/dist/src/editor/core/draw/interactive/Area.d.ts +2 -0
- package/dist/src/editor/core/draw/interactive/Search.d.ts +1 -0
- package/dist/src/editor/core/draw/particle/ListParticle.d.ts +10 -0
- package/dist/src/editor/core/draw/particle/TraceParticle.d.ts +40 -0
- package/dist/src/editor/core/draw/particle/table/TableOperate.d.ts +3 -0
- package/dist/src/editor/core/draw/particle/table/TablePaging.d.ts +13 -0
- package/dist/src/editor/core/draw/particle/table/TableParticle.d.ts +19 -2
- package/dist/src/editor/core/draw/particle/table/TableTool.d.ts +2 -0
- package/dist/src/editor/core/draw/ruler/Ruler.d.ts +43 -0
- package/dist/src/editor/core/macro/MacroManager.d.ts +25 -0
- package/dist/src/editor/core/position/Position.d.ts +9 -1
- package/dist/src/editor/core/validate/Validate.d.ts +19 -0
- package/dist/src/editor/dataset/constant/Column.d.ts +2 -0
- package/dist/src/editor/dataset/constant/ContextMenu.d.ts +2 -0
- package/dist/src/editor/dataset/constant/Element.d.ts +1 -0
- package/dist/src/editor/dataset/constant/Ruler.d.ts +2 -0
- package/dist/src/editor/dataset/constant/Trace.d.ts +2 -0
- package/dist/src/editor/dataset/enum/Editor.d.ts +2 -1
- package/dist/src/editor/dataset/enum/Macro.d.ts +4 -0
- package/dist/src/editor/dataset/enum/Trace.d.ts +4 -0
- package/dist/src/editor/index.d.ts +4 -1
- package/dist/src/editor/interface/Area.d.ts +6 -0
- package/dist/src/editor/interface/Column.d.ts +14 -0
- package/dist/src/editor/interface/Compare.d.ts +5 -0
- package/dist/src/editor/interface/Control.d.ts +46 -0
- package/dist/src/editor/interface/Draw.d.ts +1 -0
- package/dist/src/editor/interface/Editor.d.ts +7 -1
- package/dist/src/editor/interface/Element.d.ts +24 -3
- package/dist/src/editor/interface/Macro.d.ts +19 -0
- package/dist/src/editor/interface/Print.d.ts +6 -0
- package/dist/src/editor/interface/Row.d.ts +9 -1
- package/dist/src/editor/interface/Ruler.d.ts +4 -0
- package/dist/src/editor/interface/Trace.d.ts +11 -0
- package/dist/src/editor/interface/i18n/I18n.d.ts +4 -0
- package/dist/src/editor/interface/i18n/Trace.d.ts +7 -0
- package/dist/src/editor/interface/i18n/Validate.d.ts +15 -0
- package/dist/src/editor/utils/diff.d.ts +7 -0
- package/dist/src/editor/utils/element.d.ts +21 -2
- package/dist/src/editor/utils/print.d.ts +2 -1
- package/dist/src/editor/utils/table.d.ts +4 -0
- package/package.json +1 -1
- package/dist/assets/value-By4_Dx3W.js.map +0 -1
- package/dist/assets/wordCount-Osi0e4qK.js.map +0 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Draw } from '../draw/Draw';
|
|
2
|
+
export declare class CascadeManager {
|
|
3
|
+
private draw;
|
|
4
|
+
private control;
|
|
5
|
+
private eventBus;
|
|
6
|
+
private baselines;
|
|
7
|
+
private controlBaselines;
|
|
8
|
+
private valueCache;
|
|
9
|
+
private isExecuting;
|
|
10
|
+
private needsRerun;
|
|
11
|
+
constructor(draw: Draw);
|
|
12
|
+
private getZoneElementLists;
|
|
13
|
+
private collectAll;
|
|
14
|
+
private resolveIdentifier;
|
|
15
|
+
private resolveIdentifierUncached;
|
|
16
|
+
private resolveByControlId;
|
|
17
|
+
private normalizeGetValueResult;
|
|
18
|
+
private findTitleRangeElements;
|
|
19
|
+
private recordBaseline;
|
|
20
|
+
private writeWithBaseline;
|
|
21
|
+
private restoreBaseline;
|
|
22
|
+
private recordControlBaseline;
|
|
23
|
+
private restoreControlBaseline;
|
|
24
|
+
private applyAction;
|
|
25
|
+
private applyComputes;
|
|
26
|
+
executeAll(): void;
|
|
27
|
+
private executePass;
|
|
28
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IAstNode } from './parser';
|
|
2
|
+
export interface IResolvedValue {
|
|
3
|
+
code?: string | null;
|
|
4
|
+
codes?: string[];
|
|
5
|
+
text?: string | null;
|
|
6
|
+
isDate?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export type ResolveIdentifier = (name: string) => IResolvedValue | undefined;
|
|
9
|
+
export interface IEvalContext {
|
|
10
|
+
resolve: ResolveIdentifier;
|
|
11
|
+
resolveSelf?: () => IResolvedValue | undefined;
|
|
12
|
+
}
|
|
13
|
+
export declare function evaluate(node: IAstNode, context: IEvalContext): boolean;
|
|
14
|
+
export declare function evaluateValue(node: IAstNode, context: IEvalContext): string | number | null;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { IToken } from './tokenizer';
|
|
2
|
+
export type IAstNode = {
|
|
3
|
+
type: 'logical';
|
|
4
|
+
op: '&&' | '||';
|
|
5
|
+
left: IAstNode;
|
|
6
|
+
right: IAstNode;
|
|
7
|
+
} | {
|
|
8
|
+
type: 'not';
|
|
9
|
+
argument: IAstNode;
|
|
10
|
+
} | {
|
|
11
|
+
type: 'compare';
|
|
12
|
+
op: string;
|
|
13
|
+
left: IAstNode;
|
|
14
|
+
right: IAstNode;
|
|
15
|
+
} | {
|
|
16
|
+
type: 'arithmetic';
|
|
17
|
+
op: string;
|
|
18
|
+
left: IAstNode;
|
|
19
|
+
right: IAstNode;
|
|
20
|
+
} | {
|
|
21
|
+
type: 'literal';
|
|
22
|
+
value: unknown;
|
|
23
|
+
} | {
|
|
24
|
+
type: 'getValue';
|
|
25
|
+
target: {
|
|
26
|
+
kind: 'id';
|
|
27
|
+
value: string;
|
|
28
|
+
} | {
|
|
29
|
+
kind: 'self';
|
|
30
|
+
};
|
|
31
|
+
} | {
|
|
32
|
+
type: 'call';
|
|
33
|
+
name: string;
|
|
34
|
+
args: IAstNode[];
|
|
35
|
+
};
|
|
36
|
+
export declare function parse(tokens: IToken[]): IAstNode;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare enum TokenType {
|
|
2
|
+
IDENT = "IDENT",
|
|
3
|
+
STRING = "STRING",
|
|
4
|
+
NUMBER = "NUMBER",
|
|
5
|
+
BOOLEAN = "BOOLEAN",
|
|
6
|
+
NULL = "NULL",
|
|
7
|
+
SELF = "SELF",
|
|
8
|
+
OP = "OP",
|
|
9
|
+
LPAREN = "LPAREN",
|
|
10
|
+
RPAREN = "RPAREN",
|
|
11
|
+
LBRACKET = "LBRACKET",
|
|
12
|
+
RBRACKET = "RBRACKET",
|
|
13
|
+
COMMA = "COMMA"
|
|
14
|
+
}
|
|
15
|
+
export interface IToken {
|
|
16
|
+
type: TokenType;
|
|
17
|
+
value: string;
|
|
18
|
+
}
|
|
19
|
+
export declare function tokenize(source: string): IToken[];
|
|
@@ -51,6 +51,8 @@ export declare class Command {
|
|
|
51
51
|
executeTableTdBorderType: CommandAdapt['tableTdBorderType'];
|
|
52
52
|
executeTableTdSlashType: CommandAdapt['tableTdSlashType'];
|
|
53
53
|
executeTableTdBackgroundColor: CommandAdapt['tableTdBackgroundColor'];
|
|
54
|
+
executeTableAutoFitToContent: CommandAdapt['tableAutoFitToContent'];
|
|
55
|
+
executeTableAutoFitToPage: CommandAdapt['tableAutoFitToPage'];
|
|
54
56
|
executeTableSelectAll: CommandAdapt['tableSelectAll'];
|
|
55
57
|
executeImage: CommandAdapt['image'];
|
|
56
58
|
executeHyperlink: CommandAdapt['hyperlink'];
|
|
@@ -72,6 +74,7 @@ export declare class Command {
|
|
|
72
74
|
executeSetImageCaption: CommandAdapt['setImageCaption'];
|
|
73
75
|
executeChangeImageDisplay: CommandAdapt['changeImageDisplay'];
|
|
74
76
|
executePageMode: CommandAdapt['pageMode'];
|
|
77
|
+
executeSetColumns: CommandAdapt['setColumns'];
|
|
75
78
|
executePageScale: CommandAdapt['pageScale'];
|
|
76
79
|
executePageScaleRecovery: CommandAdapt['pageScaleRecovery'];
|
|
77
80
|
executePageScaleMinus: CommandAdapt['pageScaleMinus'];
|
|
@@ -88,6 +91,9 @@ export declare class Command {
|
|
|
88
91
|
executeDeleteArea: CommandAdapt['deleteArea'];
|
|
89
92
|
executeLocationArea: CommandAdapt['locationArea'];
|
|
90
93
|
executeClearGraffiti: CommandAdapt['clearGraffiti'];
|
|
94
|
+
executeToggleTrace: CommandAdapt['toggleTrace'];
|
|
95
|
+
executeCompare: CommandAdapt['compare'];
|
|
96
|
+
executeToggleRuler: CommandAdapt['toggleRuler'];
|
|
91
97
|
executeAppendElementList: CommandAdapt['appendElementList'];
|
|
92
98
|
executeUpdateElementById: CommandAdapt['updateElementById'];
|
|
93
99
|
executeDeleteElementById: CommandAdapt['deleteElementById'];
|
|
@@ -109,6 +115,8 @@ export declare class Command {
|
|
|
109
115
|
executeSetControlProperties: CommandAdapt['setControlProperties'];
|
|
110
116
|
executeSetControlPropertiesList: CommandAdapt['setControlPropertiesList'];
|
|
111
117
|
executeSetControlHighlight: CommandAdapt['setControlHighlight'];
|
|
118
|
+
executeValidate: CommandAdapt['validate'];
|
|
119
|
+
executeClearValidate: CommandAdapt['clearValidate'];
|
|
112
120
|
executeLocationControl: CommandAdapt['locationControl'];
|
|
113
121
|
executeInsertControl: CommandAdapt['insertControl'];
|
|
114
122
|
executeJumpControl: CommandAdapt['jumpControl'];
|
|
@@ -135,6 +143,7 @@ export declare class Command {
|
|
|
135
143
|
getKeywordRangeList: CommandAdapt['getKeywordRangeList'];
|
|
136
144
|
getKeywordContext: CommandAdapt['getKeywordContext'];
|
|
137
145
|
getPaperMargin: CommandAdapt['getPaperMargin'];
|
|
146
|
+
getColumns: CommandAdapt['getColumns'];
|
|
138
147
|
getSearchNavigateInfo: CommandAdapt['getSearchNavigateInfo'];
|
|
139
148
|
getLocale: CommandAdapt['getLocale'];
|
|
140
149
|
getGroupIds: CommandAdapt['getGroupIds'];
|
|
@@ -144,5 +153,8 @@ export declare class Command {
|
|
|
144
153
|
getTitleValue: CommandAdapt['getTitleValue'];
|
|
145
154
|
getPositionContextByEvent: CommandAdapt['getPositionContextByEvent'];
|
|
146
155
|
getElementById: CommandAdapt['getElementById'];
|
|
156
|
+
private interceptor?;
|
|
157
|
+
setInterceptor(fn?: (name: string, args: unknown[]) => void): void;
|
|
158
|
+
private wrap;
|
|
147
159
|
constructor(adapt: CommandAdapt);
|
|
148
160
|
}
|
|
@@ -8,9 +8,11 @@ import { TitleLevel } from '../../dataset/enum/Title';
|
|
|
8
8
|
import { VerticalAlign } from '../../dataset/enum/VerticalAlign';
|
|
9
9
|
import { ICatalog } from '../../interface/Catalog';
|
|
10
10
|
import { DeepRequired } from '../../interface/Common';
|
|
11
|
-
import {
|
|
11
|
+
import { IComparePayload } from '../../interface/Compare';
|
|
12
|
+
import { IControlValidateResult, IGetControlValueOption, IGetControlValueResult, ILocationControlOption, IRemoveControlOption, ISetControlExtensionOption, ISetControlHighlightOption, ISetControlProperties, ISetControlValueOption, IValidateOption } from '../../interface/Control';
|
|
12
13
|
import { IAppendElementListOption, IDrawImagePayload, IForceUpdateOption, IGetImageOption, IGetValueOption, IPainterOption } from '../../interface/Draw';
|
|
13
14
|
import { IEditorData, IEditorHTML, IEditorOption, IEditorResult, IEditorText, IFocusOption, ISetValueOption, IUpdateOption } from '../../interface/Editor';
|
|
15
|
+
import { IColumnOption } from '../../interface/Column';
|
|
14
16
|
import { IDeleteElementByIdOption, IElement, IElementPosition, IGetElementByIdOption, IImageCaption, IImageCrop, IInsertElementListOption, IUpdateElementByIdOption } from '../../interface/Element';
|
|
15
17
|
import { ICopyOption, IPasteOption, IPositionContextByEventOption, IPositionContextByEventResult } from '../../interface/Event';
|
|
16
18
|
import { IMargin } from '../../interface/Margin';
|
|
@@ -24,6 +26,7 @@ import { INavigateInfo } from '../draw/interactive/Search';
|
|
|
24
26
|
import { IGetAreaValueOption, IGetAreaValueResult, IInsertAreaOption, ILocationAreaOption, IDeleteAreaOption, ISetAreaPropertiesOption, ISetAreaValueOption } from '../../interface/Area';
|
|
25
27
|
import { IAreaBadge, IBadge } from '../../interface/Badge';
|
|
26
28
|
import { IRichtextOption } from '../../interface/Command';
|
|
29
|
+
import { IPrintOption } from '@/editor/interface/Print';
|
|
27
30
|
export declare class CommandAdapt {
|
|
28
31
|
private draw;
|
|
29
32
|
private range;
|
|
@@ -89,6 +92,8 @@ export declare class CommandAdapt {
|
|
|
89
92
|
tableTdBorderType(payload: TdBorder): void;
|
|
90
93
|
tableTdSlashType(payload: TdSlash): void;
|
|
91
94
|
tableTdBackgroundColor(payload: string): void;
|
|
95
|
+
tableAutoFitToContent(): void;
|
|
96
|
+
tableAutoFitToPage(): void;
|
|
92
97
|
tableSelectAll(): void;
|
|
93
98
|
hyperlink(payload: Pick<IElement, 'valueList' | 'hyperlinkId' | 'url'>): void;
|
|
94
99
|
getHyperlinkRange(): [number, number] | null;
|
|
@@ -108,7 +113,7 @@ export declare class CommandAdapt {
|
|
|
108
113
|
searchNavigateNext(): void;
|
|
109
114
|
getSearchNavigateInfo(): null | INavigateInfo;
|
|
110
115
|
replace(payload: string, option?: IReplaceOption): void;
|
|
111
|
-
print(): Promise<void>;
|
|
116
|
+
print(option?: IPrintOption): Promise<void>;
|
|
112
117
|
replaceImageElement(payload: string): void;
|
|
113
118
|
saveAsImageElement(): void;
|
|
114
119
|
setImageCrop(crop: IImageCrop): void;
|
|
@@ -133,6 +138,8 @@ export declare class CommandAdapt {
|
|
|
133
138
|
getKeywordRangeList(payload: string): IRange[];
|
|
134
139
|
getKeywordContext(payload: string): ISearchResultContext[] | null;
|
|
135
140
|
pageMode(payload: PageMode): void;
|
|
141
|
+
setColumns(config: IColumnOption | null): void;
|
|
142
|
+
getColumns(): IColumnOption | null;
|
|
136
143
|
pageScale(scale: number): void;
|
|
137
144
|
pageScaleRecovery(): void;
|
|
138
145
|
pageScaleMinus(): void;
|
|
@@ -169,6 +176,8 @@ export declare class CommandAdapt {
|
|
|
169
176
|
setControlExtensionList(payload: ISetControlExtensionOption[]): void;
|
|
170
177
|
setControlProperties(payload: ISetControlProperties): void;
|
|
171
178
|
setControlPropertiesList(payload: ISetControlProperties[]): void;
|
|
179
|
+
validate(payload?: IValidateOption): IControlValidateResult[];
|
|
180
|
+
clearValidate(): void;
|
|
172
181
|
setControlHighlight(payload: ISetControlHighlightOption): void;
|
|
173
182
|
updateOptions(payload: IUpdateOption): void;
|
|
174
183
|
getControlList(): IElement[];
|
|
@@ -188,4 +197,7 @@ export declare class CommandAdapt {
|
|
|
188
197
|
deleteArea(options?: IDeleteAreaOption): void;
|
|
189
198
|
locationArea(areaId: string, options?: ILocationAreaOption): void;
|
|
190
199
|
clearGraffiti(): void;
|
|
200
|
+
toggleTrace(payload?: boolean): void;
|
|
201
|
+
compare(payload: IComparePayload): void;
|
|
202
|
+
toggleRuler(payload?: boolean): void;
|
|
191
203
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { IAppendElementListOption, IComputeRowListPayload, IDrawOption, IDrawRowPayload, IGetImageOption, IGetOriginValueOption, IGetValueOption, IPainterOption } from '../../interface/Draw';
|
|
2
2
|
import { IEditorData, IEditorOption, IEditorResult, ISetValueOption } from '../../interface/Editor';
|
|
3
3
|
import { IElement, IElementStyle, ISpliceElementListOption, IInsertElementListOption } from '../../interface/Element';
|
|
4
|
+
import { IMarkElementListDeletedOption } from '../../interface/Trace';
|
|
4
5
|
import { IRow } from '../../interface/Row';
|
|
6
|
+
import { IColumnLayout, IColumnOption } from '../../interface/Column';
|
|
7
|
+
import { ColumnManager } from './column/ColumnManager';
|
|
5
8
|
import { Cursor } from '../cursor/Cursor';
|
|
6
9
|
import { CanvasEvent } from '../event/CanvasEvent';
|
|
7
10
|
import { GlobalEvent } from '../event/GlobalEvent';
|
|
@@ -10,14 +13,22 @@ import { Listener } from '../listener/Listener';
|
|
|
10
13
|
import { Position } from '../position/Position';
|
|
11
14
|
import { RangeManager } from '../range/RangeManager';
|
|
12
15
|
import { Search } from './interactive/Search';
|
|
16
|
+
import { Strikeout } from './richtext/Strikeout';
|
|
17
|
+
import { Underline } from './richtext/Underline';
|
|
13
18
|
import { ImageParticle } from './particle/ImageParticle';
|
|
14
19
|
import { TextParticle } from './particle/TextParticle';
|
|
15
20
|
import { TableParticle } from './particle/table/TableParticle';
|
|
16
21
|
import { TableTool } from './particle/table/TableTool';
|
|
22
|
+
import { Ruler } from './ruler/Ruler';
|
|
17
23
|
import { HyperlinkParticle } from './particle/HyperlinkParticle';
|
|
24
|
+
import { TraceParticle } from './particle/TraceParticle';
|
|
18
25
|
import { Header } from './frame/Header';
|
|
26
|
+
import { SuperscriptParticle } from './particle/SuperscriptParticle';
|
|
27
|
+
import { SubscriptParticle } from './particle/SubscriptParticle';
|
|
19
28
|
import { EditorMode, PageMode, PaperDirection } from '../../dataset/enum/Editor';
|
|
20
29
|
import { Control } from './control/Control';
|
|
30
|
+
import { CascadeManager } from '../cascade/CascadeManager';
|
|
31
|
+
import { Validate } from '../validate/Validate';
|
|
21
32
|
import { CheckboxParticle } from './particle/CheckboxParticle';
|
|
22
33
|
import { RadioParticle } from './particle/RadioParticle';
|
|
23
34
|
import { DeepRequired, IPadding } from '../../interface/Common';
|
|
@@ -80,6 +91,7 @@ export declare class Draw {
|
|
|
80
91
|
private laTexParticle;
|
|
81
92
|
private textParticle;
|
|
82
93
|
private tableParticle;
|
|
94
|
+
private tablePaging;
|
|
83
95
|
private tableTool;
|
|
84
96
|
private tableOperate;
|
|
85
97
|
private pageNumber;
|
|
@@ -89,6 +101,7 @@ export declare class Draw {
|
|
|
89
101
|
private header;
|
|
90
102
|
private footer;
|
|
91
103
|
private hyperlinkParticle;
|
|
104
|
+
private traceParticle;
|
|
92
105
|
private labelParticle;
|
|
93
106
|
private dateParticle;
|
|
94
107
|
private separatorParticle;
|
|
@@ -102,6 +115,8 @@ export declare class Draw {
|
|
|
102
115
|
private lineBreakParticle;
|
|
103
116
|
private whiteSpaceParticle;
|
|
104
117
|
private control;
|
|
118
|
+
private cascadeManager;
|
|
119
|
+
private validate;
|
|
105
120
|
private pageBorder;
|
|
106
121
|
private workerManager;
|
|
107
122
|
private scrollObserver;
|
|
@@ -120,6 +135,8 @@ export declare class Draw {
|
|
|
120
135
|
private lazyRenderIntersectionObserver;
|
|
121
136
|
private printModeData;
|
|
122
137
|
private controlMinWidthPlaceholderElementListSet;
|
|
138
|
+
private columnManager;
|
|
139
|
+
private ruler;
|
|
123
140
|
constructor(rootContainer: HTMLElement, options: DeepRequired<IEditorOption>, data: IEditorData, listener: Listener, eventBus: EventBus<EventBusMap>, override: Override);
|
|
124
141
|
setPrintData(): void;
|
|
125
142
|
clearPrintData(): void;
|
|
@@ -130,7 +147,12 @@ export declare class Draw {
|
|
|
130
147
|
isDisabled(): boolean;
|
|
131
148
|
isDesignMode(): boolean;
|
|
132
149
|
isPrintMode(): boolean;
|
|
150
|
+
isAreaHideDisabled(): boolean;
|
|
133
151
|
isGraffitiMode(): boolean;
|
|
152
|
+
isTraceMode(): boolean;
|
|
153
|
+
setTraceEnabled(enabled: boolean): void;
|
|
154
|
+
setRulerEnabled(enabled: boolean): void;
|
|
155
|
+
deleteElementList(elementList: IElement[], index: number, count?: number, options?: IMarkElementListDeletedOption): IElement[];
|
|
134
156
|
getOriginalWidth(): number;
|
|
135
157
|
getOriginalHeight(): number;
|
|
136
158
|
getWidth(): number;
|
|
@@ -140,6 +162,8 @@ export declare class Draw {
|
|
|
140
162
|
getCanvasWidth(pageNo?: number): number;
|
|
141
163
|
getCanvasHeight(pageNo?: number): number;
|
|
142
164
|
getInnerWidth(): number;
|
|
165
|
+
getColumnLayout(): IColumnLayout | null;
|
|
166
|
+
setColumnConfig(config: IColumnOption | null): void;
|
|
143
167
|
getOriginalInnerWidth(): number;
|
|
144
168
|
getContextInnerWidth(): number;
|
|
145
169
|
getMargins(): IMargin;
|
|
@@ -177,9 +201,14 @@ export declare class Draw {
|
|
|
177
201
|
getHistoryManager(): HistoryManager;
|
|
178
202
|
getPosition(): Position;
|
|
179
203
|
getZone(): Zone;
|
|
204
|
+
getColumnManager(): ColumnManager;
|
|
180
205
|
getRange(): RangeManager;
|
|
181
206
|
getLineBreakParticle(): LineBreakParticle;
|
|
182
207
|
getTextParticle(): TextParticle;
|
|
208
|
+
getStrikeout(): Strikeout;
|
|
209
|
+
getUnderline(): Underline;
|
|
210
|
+
getSubscriptParticle(): SubscriptParticle;
|
|
211
|
+
getSuperscriptParticle(): SuperscriptParticle;
|
|
183
212
|
getHeaderElementList(): IElement[];
|
|
184
213
|
getTableElementList(sourceElementList: IElement[]): IElement[];
|
|
185
214
|
getElementList(): IElement[];
|
|
@@ -200,17 +229,21 @@ export declare class Draw {
|
|
|
200
229
|
getPreviewer(): Previewer;
|
|
201
230
|
getImageParticle(): ImageParticle;
|
|
202
231
|
getTableTool(): TableTool;
|
|
232
|
+
getRuler(): Ruler;
|
|
203
233
|
getTableOperate(): TableOperate;
|
|
204
234
|
getTableParticle(): TableParticle;
|
|
205
235
|
getBlockParticle(): BlockParticle;
|
|
206
236
|
getHeader(): Header;
|
|
207
237
|
getFooter(): Footer;
|
|
208
238
|
getHyperlinkParticle(): HyperlinkParticle;
|
|
239
|
+
getTraceParticle(): TraceParticle;
|
|
209
240
|
getDateParticle(): DateParticle;
|
|
210
241
|
getListParticle(): ListParticle;
|
|
211
242
|
getCheckboxParticle(): CheckboxParticle;
|
|
212
243
|
getRadioParticle(): RadioParticle;
|
|
213
244
|
getControl(): Control;
|
|
245
|
+
getCascadeManager(): CascadeManager;
|
|
246
|
+
getValidate(): Validate;
|
|
214
247
|
getWorkerManager(): WorkerManager;
|
|
215
248
|
getImageObserver(): ImageObserver;
|
|
216
249
|
getI18n(): I18n;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IColumnLayout, IColumnOption } from '../../../interface/Column';
|
|
2
|
+
import { Draw } from '../Draw';
|
|
3
|
+
export declare class ColumnManager {
|
|
4
|
+
private draw;
|
|
5
|
+
private options;
|
|
6
|
+
private layout;
|
|
7
|
+
constructor(draw: Draw);
|
|
8
|
+
computeLayout(innerWidth: number, config: IColumnOption | undefined): IColumnLayout | null;
|
|
9
|
+
compute(): void;
|
|
10
|
+
getLayout(): IColumnLayout | null;
|
|
11
|
+
setConfig(config: IColumnOption | null | undefined): void;
|
|
12
|
+
getOffset(columnIndex: number | undefined): number;
|
|
13
|
+
drawSeparator(ctx: CanvasRenderingContext2D, pageNo: number): void;
|
|
14
|
+
}
|
|
@@ -51,8 +51,11 @@ export declare class Control {
|
|
|
51
51
|
reAwakeControl(): void;
|
|
52
52
|
selectValue(): boolean;
|
|
53
53
|
moveCursor(position: IControlInitOption): IMoveCursorResult;
|
|
54
|
+
getControlStartIndex(elementList: IElement[], startIndex: number, controlId: string): number;
|
|
55
|
+
getControlEndIndex(elementList: IElement[], startIndex: number, controlId: string): number;
|
|
54
56
|
removeControl(startIndex: number, context?: IControlContext): number | null;
|
|
55
57
|
removePlaceholder(startIndex: number, context?: IControlContext): void;
|
|
58
|
+
removePlaceholderInRange(elementList: IElement[], startIndex: number, count: number): number;
|
|
56
59
|
addPlaceholder(startIndex: number, context?: IControlContext): void;
|
|
57
60
|
setValue(data: IElement[]): number;
|
|
58
61
|
setControlProperties(properties: Partial<IControl>, context?: IControlContext): void;
|
|
@@ -17,6 +17,8 @@ export declare class Area {
|
|
|
17
17
|
insertArea(payload: IInsertAreaOption): string | null;
|
|
18
18
|
render(ctx: CanvasRenderingContext2D, pageNo: number): void;
|
|
19
19
|
compute(): void;
|
|
20
|
+
private computeAreaInfo;
|
|
21
|
+
private computeTableAreaInfo;
|
|
20
22
|
getAreaValue(options?: IGetAreaValueOption): IGetAreaValueResult | null;
|
|
21
23
|
getContextByAreaId(areaId: string, options?: ILocationAreaOption): {
|
|
22
24
|
range: IRange;
|
|
@@ -9,9 +9,19 @@ export declare class ListParticle {
|
|
|
9
9
|
private readonly UN_COUNT_STYLE_WIDTH;
|
|
10
10
|
private readonly MEASURE_BASE_TEXT;
|
|
11
11
|
private readonly LIST_GAP;
|
|
12
|
+
readonly LIST_INDENT_WIDTH = 30;
|
|
13
|
+
private readonly MAX_LEVEL;
|
|
12
14
|
constructor(draw: Draw);
|
|
13
15
|
setList(listType: ListType | null, listStyle?: ListStyle): void;
|
|
14
16
|
unsetList(): void;
|
|
17
|
+
increaseListLevel(): void;
|
|
18
|
+
decreaseListLevel(): void;
|
|
19
|
+
private applySegmentLevel;
|
|
20
|
+
private findPreviousListId;
|
|
21
|
+
private isParagraphStart;
|
|
22
|
+
private clearListInfo;
|
|
23
|
+
private clearPreviousEmptyListItems;
|
|
24
|
+
private extractListSegments;
|
|
15
25
|
computeListStyle(ctx: CanvasRenderingContext2D, elementList: IElement[]): Map<string, number>;
|
|
16
26
|
private findStyledElement;
|
|
17
27
|
private getListFontStyle;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { IElement, IElementMetrics, IElementPosition } from '../../../interface/Element';
|
|
2
|
+
import { IRow, IRowElement } from '../../../interface/Row';
|
|
3
|
+
import { IMarkElementListDeletedOption } from '../../../interface/Trace';
|
|
4
|
+
import { Draw } from '../Draw';
|
|
5
|
+
interface ITraceRenderContext {
|
|
6
|
+
ctx: CanvasRenderingContext2D;
|
|
7
|
+
element: IRowElement;
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
curRow: IRow;
|
|
11
|
+
metrics: IElementMetrics;
|
|
12
|
+
offsetY: number;
|
|
13
|
+
scale: number;
|
|
14
|
+
}
|
|
15
|
+
export declare class TraceParticle {
|
|
16
|
+
private draw;
|
|
17
|
+
private options;
|
|
18
|
+
private container;
|
|
19
|
+
private tracePopupContainer;
|
|
20
|
+
private listDom;
|
|
21
|
+
private lastHoverKey;
|
|
22
|
+
private strikeoutState;
|
|
23
|
+
private underlineState;
|
|
24
|
+
private currentRow;
|
|
25
|
+
constructor(draw: Draw);
|
|
26
|
+
private _createTracePopupDom;
|
|
27
|
+
drawTracePopup(element: IElement, position: IElementPosition | undefined, pageNo: number): void;
|
|
28
|
+
clearTracePopup(): void;
|
|
29
|
+
handleMouseMove(evt: MouseEvent): void;
|
|
30
|
+
private _getTraceFlags;
|
|
31
|
+
render(context: ITraceRenderContext): void;
|
|
32
|
+
flush(ctx: CanvasRenderingContext2D): void;
|
|
33
|
+
private _flushStrikeout;
|
|
34
|
+
private _flushUnderline;
|
|
35
|
+
isTraceHidden(element: IElement): boolean;
|
|
36
|
+
private _markElementList;
|
|
37
|
+
markElementListInserted(elementList: IElement[]): void;
|
|
38
|
+
markElementListDeleted(elementList: IElement[], options?: IMarkElementListDeletedOption): IElement[];
|
|
39
|
+
}
|
|
40
|
+
export {};
|
|
@@ -28,5 +28,8 @@ export declare class TableOperate {
|
|
|
28
28
|
tableTdBorderType(payload: TdBorder): void;
|
|
29
29
|
tableTdSlashType(payload: TdSlash): void;
|
|
30
30
|
tableTdBackgroundColor(payload: string): void;
|
|
31
|
+
private _measureTdContentWidth;
|
|
32
|
+
tableAutoFitToContent(): void;
|
|
33
|
+
tableAutoFitToPage(): void;
|
|
31
34
|
tableSelectAll(): void;
|
|
32
35
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IElement, ITableRowFragment } from '../../../../interface/Element';
|
|
2
|
+
import { IRow } from '../../../../interface/Row';
|
|
3
|
+
import { Draw } from '../../Draw';
|
|
4
|
+
export declare class TablePaging {
|
|
5
|
+
private draw;
|
|
6
|
+
private options;
|
|
7
|
+
private tableParticle;
|
|
8
|
+
constructor(draw: Draw);
|
|
9
|
+
splitTableRowAcrossPages(rowList: IRow[]): IRow[];
|
|
10
|
+
truncateTableByFragment(element: IElement, fragment: ITableRowFragment, elementList: IElement[]): boolean;
|
|
11
|
+
private _trimTdContentToWindow;
|
|
12
|
+
private _repairTableContextAfterTruncate;
|
|
13
|
+
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { IElement } from '../../../..';
|
|
2
|
+
import { ITableRowFragment } from '../../../../interface/Element';
|
|
3
|
+
import { IRow } from '../../../../interface/Row';
|
|
2
4
|
import { ITd } from '../../../../interface/table/Td';
|
|
3
5
|
import { ITr } from '../../../../interface/table/Tr';
|
|
4
6
|
import { Draw } from '../../Draw';
|
|
@@ -6,19 +8,34 @@ export declare class TableParticle {
|
|
|
6
8
|
private draw;
|
|
7
9
|
private range;
|
|
8
10
|
private options;
|
|
11
|
+
private fragmentContentHeightCache;
|
|
12
|
+
private tdLineHeightPrefixCache;
|
|
13
|
+
private fragmentTdListCache;
|
|
9
14
|
constructor(draw: Draw);
|
|
10
15
|
getTrListGroupByCol(payload: ITr[]): ITr[];
|
|
11
16
|
getRangeRowCol(): ITd[][] | null;
|
|
12
17
|
private _drawOuterBorder;
|
|
18
|
+
getFragmentTdList(element: IElement, fragment: ITableRowFragment): ITd[];
|
|
19
|
+
private _getDrawTdList;
|
|
13
20
|
private _drawSlash;
|
|
14
21
|
private _drawBorder;
|
|
15
22
|
private _drawBackgroundColor;
|
|
16
23
|
getTableWidth(element: IElement): number;
|
|
24
|
+
getFragmentTrHeight(tr: ITr, trIndex: number, fragment?: ITableRowFragment): number;
|
|
25
|
+
getFragmentContentHeight(element: IElement, fragment: Pick<ITableRowFragment, 'startTrIndex' | 'endTrIndex' | 'startSplitTrOffset' | 'endSplitTrHeight'>): number;
|
|
26
|
+
getTdWindowInFragment(td: ITd, element: IElement, fragment: ITableRowFragment): [number, number];
|
|
27
|
+
getTdWindowOffsetY(windowStart: number, fragment: ITableRowFragment): number;
|
|
28
|
+
getTdVisibleRowListByWindow(td: ITd, windowStart: number, windowEnd: number): {
|
|
29
|
+
rowList: IRow[];
|
|
30
|
+
startIndex: number;
|
|
31
|
+
startRowIndex: number;
|
|
32
|
+
};
|
|
33
|
+
getTdLineRangeBySplitWindow(td: ITd, windowStart: number, windowEnd: number): [number, number];
|
|
17
34
|
getTableHeight(element: IElement): number;
|
|
18
35
|
getRowCountByColIndex(trList: ITr[], colIndex: number): number;
|
|
19
36
|
getTdListByColIndex(trList: ITr[], colIndex: number): ITd[];
|
|
20
37
|
getTdListByRowIndex(trList: ITr[], rowIndex: number): ITd[];
|
|
21
38
|
computeRowColInfo(element: IElement): void;
|
|
22
|
-
drawRange(ctx: CanvasRenderingContext2D, element: IElement, startX: number, startY: number): void;
|
|
23
|
-
render(ctx: CanvasRenderingContext2D, element: IElement, startX: number, startY: number): void;
|
|
39
|
+
drawRange(ctx: CanvasRenderingContext2D, element: IElement, startX: number, startY: number, fragment?: ITableRowFragment): void;
|
|
40
|
+
render(ctx: CanvasRenderingContext2D, element: IElement, startX: number, startY: number, fragment?: ITableRowFragment): void;
|
|
24
41
|
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Draw } from '../Draw';
|
|
2
|
+
export declare class Ruler {
|
|
3
|
+
private readonly MM_PX;
|
|
4
|
+
private readonly HANDLE_HIT_TOLERANCE;
|
|
5
|
+
private readonly MIN_INNER_SIZE;
|
|
6
|
+
private draw;
|
|
7
|
+
private options;
|
|
8
|
+
private container;
|
|
9
|
+
private rulerContainer;
|
|
10
|
+
private canvasX;
|
|
11
|
+
private ctxX;
|
|
12
|
+
private canvasY;
|
|
13
|
+
private ctxY;
|
|
14
|
+
private dragSide;
|
|
15
|
+
private dragStartPosition;
|
|
16
|
+
private dragOriginMargins;
|
|
17
|
+
private mousemoveHandler;
|
|
18
|
+
private mouseupHandler;
|
|
19
|
+
constructor(draw: Draw);
|
|
20
|
+
isEnable(): boolean;
|
|
21
|
+
private _createDOM;
|
|
22
|
+
setEnabled(enabled: boolean): void;
|
|
23
|
+
dispose(): void;
|
|
24
|
+
render(): void;
|
|
25
|
+
private _renderX;
|
|
26
|
+
private _renderY;
|
|
27
|
+
private _drawXHandle;
|
|
28
|
+
private _drawYHandle;
|
|
29
|
+
private _getHitMarginSideX;
|
|
30
|
+
private _getHitMarginSideY;
|
|
31
|
+
private _getRelativeX;
|
|
32
|
+
private _getRelativeY;
|
|
33
|
+
private _isMarginDragDisabled;
|
|
34
|
+
private _startDrag;
|
|
35
|
+
private _mousedownX;
|
|
36
|
+
private _mousedownY;
|
|
37
|
+
private _updateCursorX;
|
|
38
|
+
private _updateCursorY;
|
|
39
|
+
private _dragMargin;
|
|
40
|
+
private _stopDrag;
|
|
41
|
+
clampMargin(value: number, max: number): number;
|
|
42
|
+
private _setDisplayedMargins;
|
|
43
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Command } from '../command/Command';
|
|
2
|
+
import type { IMacro, IRecordedMacro, IScriptMacro, IMacroHandler } from '../../interface/Macro';
|
|
3
|
+
export declare class MacroManager {
|
|
4
|
+
private macros;
|
|
5
|
+
private recording;
|
|
6
|
+
private isPlaying;
|
|
7
|
+
private command;
|
|
8
|
+
constructor(command: Command);
|
|
9
|
+
isRecording(): boolean;
|
|
10
|
+
startRecording(): void;
|
|
11
|
+
stopRecording(name: string): IRecordedMacro | null;
|
|
12
|
+
cancelRecording(): void;
|
|
13
|
+
play(idOrName: string, ...args: unknown[]): Promise<void>;
|
|
14
|
+
getMacros(): IMacro[];
|
|
15
|
+
getMacro(idOrName: string): IMacro | undefined;
|
|
16
|
+
removeMacro(idOrName: string): boolean;
|
|
17
|
+
exportMacros(): string;
|
|
18
|
+
importMacros(json: string, options?: {
|
|
19
|
+
overwrite?: boolean;
|
|
20
|
+
}): void;
|
|
21
|
+
register(name: string, handler: IMacroHandler): IScriptMacro;
|
|
22
|
+
unregister(idOrName: string): boolean;
|
|
23
|
+
private findMacro;
|
|
24
|
+
private logStep;
|
|
25
|
+
}
|
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
import { IComputePageRowPositionPayload, IComputePageRowPositionResult, IComputeRowPositionPayload, IFloatPosition, IGetFloatPositionByXYPayload, ISetSurroundPositionPayload } from '../../interface/Position';
|
|
2
2
|
import { IElement, IElementPosition } from '../../interface/Element';
|
|
3
|
+
import { ITd } from '../../interface/table/Td';
|
|
3
4
|
import { ICurrentPosition, IGetPositionByXYPayload, IPositionContext } from '../../interface/Position';
|
|
4
5
|
import { Draw } from '../draw/Draw';
|
|
5
6
|
export declare class Position {
|
|
6
7
|
private cursorPosition;
|
|
7
8
|
private positionContext;
|
|
8
9
|
private positionList;
|
|
10
|
+
private tablePagingPositionList;
|
|
11
|
+
private tablePagingPositionMap;
|
|
9
12
|
private floatPositionList;
|
|
10
13
|
private draw;
|
|
11
14
|
private eventBus;
|
|
12
15
|
private options;
|
|
13
16
|
constructor(draw: Draw);
|
|
14
17
|
getFloatPositionList(): IFloatPosition[];
|
|
18
|
+
getTablePagingPositionList(): IElementPosition[];
|
|
19
|
+
getTableFragmentPosition(index: number, pageNo: number, anchorPosition?: IElementPosition | null): IElementPosition | null;
|
|
15
20
|
getTablePositionList(sourceElementList: IElement[]): IElementPosition[];
|
|
16
|
-
getTableTdByContext(sourceElementList: IElement[], context: IPositionContext):
|
|
21
|
+
getTableTdByContext(sourceElementList: IElement[], context: IPositionContext): ITd | null;
|
|
17
22
|
buildTablePositionContext(context: IPositionContext, element: IElement, trIndex: number, tdIndex: number): IPositionContext;
|
|
18
23
|
getTableElementByContext(sourceElementList: IElement[], context: IPositionContext): IElement | null;
|
|
19
24
|
getTableElementPositionByContext(sourceElementList: IElement[], sourcePositionList: IElementPosition[], context: IPositionContext): IElementPosition | null;
|
|
@@ -31,12 +36,15 @@ export declare class Position {
|
|
|
31
36
|
y: number;
|
|
32
37
|
};
|
|
33
38
|
computePageRowPosition(payload: IComputePageRowPositionPayload): IComputePageRowPositionResult;
|
|
39
|
+
private _offsetTdPositionByVerticalAlign;
|
|
34
40
|
computePositionList(): void;
|
|
35
41
|
computeRowPosition(payload: IComputeRowPositionPayload): IElementPosition[];
|
|
36
42
|
setCursorPosition(position: IElementPosition | null): void;
|
|
37
43
|
getCursorPosition(): IElementPosition | null;
|
|
38
44
|
getPositionContext(): IPositionContext;
|
|
39
45
|
setPositionContext(payload: IPositionContext): void;
|
|
46
|
+
private _getColumnIndexByX;
|
|
47
|
+
private _getTableChildPositionByXY;
|
|
40
48
|
getPositionByXY(payload: IGetPositionByXYPayload): ICurrentPosition;
|
|
41
49
|
getFloatPositionByXY(payload: IGetFloatPositionByXYPayload): ICurrentPosition | void;
|
|
42
50
|
adjustPositionContext(payload: IGetPositionByXYPayload): ICurrentPosition | null;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IControlValidateResult, IValidateOption } from '../../interface/Control';
|
|
2
|
+
import { Draw } from '../draw/Draw';
|
|
3
|
+
export declare class Validate {
|
|
4
|
+
private draw;
|
|
5
|
+
private control;
|
|
6
|
+
private i18n;
|
|
7
|
+
private highlightedControlIds;
|
|
8
|
+
private lastErrorBackgroundColor;
|
|
9
|
+
constructor(draw: Draw);
|
|
10
|
+
private collectControlElements;
|
|
11
|
+
private getNormalizedValue;
|
|
12
|
+
private isHidden;
|
|
13
|
+
private t;
|
|
14
|
+
private validateControl;
|
|
15
|
+
private walkAllControlElements;
|
|
16
|
+
private applyHighlight;
|
|
17
|
+
clearHighlight(): void;
|
|
18
|
+
execute(payload?: IValidateOption): IControlValidateResult[];
|
|
19
|
+
}
|