@hufe921/canvas-editor 0.9.137 → 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 +32 -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 +4886 -2258
- 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 +10 -0
- package/dist/src/editor/core/command/CommandAdapt.d.ts +9 -1
- package/dist/src/editor/core/draw/Draw.d.ts +26 -0
- package/dist/src/editor/core/draw/control/Control.d.ts +3 -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 +8 -1
- package/dist/src/editor/core/validate/Validate.d.ts +19 -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/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 +4 -1
- package/dist/src/editor/interface/Element.d.ts +23 -3
- package/dist/src/editor/interface/Macro.d.ts +19 -0
- package/dist/src/editor/interface/Row.d.ts +8 -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/table.d.ts +4 -0
- package/package.json +1 -1
- package/dist/assets/value-DeIsXod0.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'];
|
|
@@ -89,6 +91,9 @@ export declare class Command {
|
|
|
89
91
|
executeDeleteArea: CommandAdapt['deleteArea'];
|
|
90
92
|
executeLocationArea: CommandAdapt['locationArea'];
|
|
91
93
|
executeClearGraffiti: CommandAdapt['clearGraffiti'];
|
|
94
|
+
executeToggleTrace: CommandAdapt['toggleTrace'];
|
|
95
|
+
executeCompare: CommandAdapt['compare'];
|
|
96
|
+
executeToggleRuler: CommandAdapt['toggleRuler'];
|
|
92
97
|
executeAppendElementList: CommandAdapt['appendElementList'];
|
|
93
98
|
executeUpdateElementById: CommandAdapt['updateElementById'];
|
|
94
99
|
executeDeleteElementById: CommandAdapt['deleteElementById'];
|
|
@@ -110,6 +115,8 @@ export declare class Command {
|
|
|
110
115
|
executeSetControlProperties: CommandAdapt['setControlProperties'];
|
|
111
116
|
executeSetControlPropertiesList: CommandAdapt['setControlPropertiesList'];
|
|
112
117
|
executeSetControlHighlight: CommandAdapt['setControlHighlight'];
|
|
118
|
+
executeValidate: CommandAdapt['validate'];
|
|
119
|
+
executeClearValidate: CommandAdapt['clearValidate'];
|
|
113
120
|
executeLocationControl: CommandAdapt['locationControl'];
|
|
114
121
|
executeInsertControl: CommandAdapt['insertControl'];
|
|
115
122
|
executeJumpControl: CommandAdapt['jumpControl'];
|
|
@@ -146,5 +153,8 @@ export declare class Command {
|
|
|
146
153
|
getTitleValue: CommandAdapt['getTitleValue'];
|
|
147
154
|
getPositionContextByEvent: CommandAdapt['getPositionContextByEvent'];
|
|
148
155
|
getElementById: CommandAdapt['getElementById'];
|
|
156
|
+
private interceptor?;
|
|
157
|
+
setInterceptor(fn?: (name: string, args: unknown[]) => void): void;
|
|
158
|
+
private wrap;
|
|
149
159
|
constructor(adapt: CommandAdapt);
|
|
150
160
|
}
|
|
@@ -8,7 +8,8 @@ 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';
|
|
14
15
|
import { IColumnOption } from '../../interface/Column';
|
|
@@ -91,6 +92,8 @@ export declare class CommandAdapt {
|
|
|
91
92
|
tableTdBorderType(payload: TdBorder): void;
|
|
92
93
|
tableTdSlashType(payload: TdSlash): void;
|
|
93
94
|
tableTdBackgroundColor(payload: string): void;
|
|
95
|
+
tableAutoFitToContent(): void;
|
|
96
|
+
tableAutoFitToPage(): void;
|
|
94
97
|
tableSelectAll(): void;
|
|
95
98
|
hyperlink(payload: Pick<IElement, 'valueList' | 'hyperlinkId' | 'url'>): void;
|
|
96
99
|
getHyperlinkRange(): [number, number] | null;
|
|
@@ -173,6 +176,8 @@ export declare class CommandAdapt {
|
|
|
173
176
|
setControlExtensionList(payload: ISetControlExtensionOption[]): void;
|
|
174
177
|
setControlProperties(payload: ISetControlProperties): void;
|
|
175
178
|
setControlPropertiesList(payload: ISetControlProperties[]): void;
|
|
179
|
+
validate(payload?: IValidateOption): IControlValidateResult[];
|
|
180
|
+
clearValidate(): void;
|
|
176
181
|
setControlHighlight(payload: ISetControlHighlightOption): void;
|
|
177
182
|
updateOptions(payload: IUpdateOption): void;
|
|
178
183
|
getControlList(): IElement[];
|
|
@@ -192,4 +197,7 @@ export declare class CommandAdapt {
|
|
|
192
197
|
deleteArea(options?: IDeleteAreaOption): void;
|
|
193
198
|
locationArea(areaId: string, options?: ILocationAreaOption): void;
|
|
194
199
|
clearGraffiti(): void;
|
|
200
|
+
toggleTrace(payload?: boolean): void;
|
|
201
|
+
compare(payload: IComparePayload): void;
|
|
202
|
+
toggleRuler(payload?: boolean): void;
|
|
195
203
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
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';
|
|
5
6
|
import { IColumnLayout, IColumnOption } from '../../interface/Column';
|
|
6
7
|
import { ColumnManager } from './column/ColumnManager';
|
|
@@ -12,14 +13,22 @@ import { Listener } from '../listener/Listener';
|
|
|
12
13
|
import { Position } from '../position/Position';
|
|
13
14
|
import { RangeManager } from '../range/RangeManager';
|
|
14
15
|
import { Search } from './interactive/Search';
|
|
16
|
+
import { Strikeout } from './richtext/Strikeout';
|
|
17
|
+
import { Underline } from './richtext/Underline';
|
|
15
18
|
import { ImageParticle } from './particle/ImageParticle';
|
|
16
19
|
import { TextParticle } from './particle/TextParticle';
|
|
17
20
|
import { TableParticle } from './particle/table/TableParticle';
|
|
18
21
|
import { TableTool } from './particle/table/TableTool';
|
|
22
|
+
import { Ruler } from './ruler/Ruler';
|
|
19
23
|
import { HyperlinkParticle } from './particle/HyperlinkParticle';
|
|
24
|
+
import { TraceParticle } from './particle/TraceParticle';
|
|
20
25
|
import { Header } from './frame/Header';
|
|
26
|
+
import { SuperscriptParticle } from './particle/SuperscriptParticle';
|
|
27
|
+
import { SubscriptParticle } from './particle/SubscriptParticle';
|
|
21
28
|
import { EditorMode, PageMode, PaperDirection } from '../../dataset/enum/Editor';
|
|
22
29
|
import { Control } from './control/Control';
|
|
30
|
+
import { CascadeManager } from '../cascade/CascadeManager';
|
|
31
|
+
import { Validate } from '../validate/Validate';
|
|
23
32
|
import { CheckboxParticle } from './particle/CheckboxParticle';
|
|
24
33
|
import { RadioParticle } from './particle/RadioParticle';
|
|
25
34
|
import { DeepRequired, IPadding } from '../../interface/Common';
|
|
@@ -82,6 +91,7 @@ export declare class Draw {
|
|
|
82
91
|
private laTexParticle;
|
|
83
92
|
private textParticle;
|
|
84
93
|
private tableParticle;
|
|
94
|
+
private tablePaging;
|
|
85
95
|
private tableTool;
|
|
86
96
|
private tableOperate;
|
|
87
97
|
private pageNumber;
|
|
@@ -91,6 +101,7 @@ export declare class Draw {
|
|
|
91
101
|
private header;
|
|
92
102
|
private footer;
|
|
93
103
|
private hyperlinkParticle;
|
|
104
|
+
private traceParticle;
|
|
94
105
|
private labelParticle;
|
|
95
106
|
private dateParticle;
|
|
96
107
|
private separatorParticle;
|
|
@@ -104,6 +115,8 @@ export declare class Draw {
|
|
|
104
115
|
private lineBreakParticle;
|
|
105
116
|
private whiteSpaceParticle;
|
|
106
117
|
private control;
|
|
118
|
+
private cascadeManager;
|
|
119
|
+
private validate;
|
|
107
120
|
private pageBorder;
|
|
108
121
|
private workerManager;
|
|
109
122
|
private scrollObserver;
|
|
@@ -123,6 +136,7 @@ export declare class Draw {
|
|
|
123
136
|
private printModeData;
|
|
124
137
|
private controlMinWidthPlaceholderElementListSet;
|
|
125
138
|
private columnManager;
|
|
139
|
+
private ruler;
|
|
126
140
|
constructor(rootContainer: HTMLElement, options: DeepRequired<IEditorOption>, data: IEditorData, listener: Listener, eventBus: EventBus<EventBusMap>, override: Override);
|
|
127
141
|
setPrintData(): void;
|
|
128
142
|
clearPrintData(): void;
|
|
@@ -135,6 +149,10 @@ export declare class Draw {
|
|
|
135
149
|
isPrintMode(): boolean;
|
|
136
150
|
isAreaHideDisabled(): boolean;
|
|
137
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[];
|
|
138
156
|
getOriginalWidth(): number;
|
|
139
157
|
getOriginalHeight(): number;
|
|
140
158
|
getWidth(): number;
|
|
@@ -187,6 +205,10 @@ export declare class Draw {
|
|
|
187
205
|
getRange(): RangeManager;
|
|
188
206
|
getLineBreakParticle(): LineBreakParticle;
|
|
189
207
|
getTextParticle(): TextParticle;
|
|
208
|
+
getStrikeout(): Strikeout;
|
|
209
|
+
getUnderline(): Underline;
|
|
210
|
+
getSubscriptParticle(): SubscriptParticle;
|
|
211
|
+
getSuperscriptParticle(): SuperscriptParticle;
|
|
190
212
|
getHeaderElementList(): IElement[];
|
|
191
213
|
getTableElementList(sourceElementList: IElement[]): IElement[];
|
|
192
214
|
getElementList(): IElement[];
|
|
@@ -207,17 +229,21 @@ export declare class Draw {
|
|
|
207
229
|
getPreviewer(): Previewer;
|
|
208
230
|
getImageParticle(): ImageParticle;
|
|
209
231
|
getTableTool(): TableTool;
|
|
232
|
+
getRuler(): Ruler;
|
|
210
233
|
getTableOperate(): TableOperate;
|
|
211
234
|
getTableParticle(): TableParticle;
|
|
212
235
|
getBlockParticle(): BlockParticle;
|
|
213
236
|
getHeader(): Header;
|
|
214
237
|
getFooter(): Footer;
|
|
215
238
|
getHyperlinkParticle(): HyperlinkParticle;
|
|
239
|
+
getTraceParticle(): TraceParticle;
|
|
216
240
|
getDateParticle(): DateParticle;
|
|
217
241
|
getListParticle(): ListParticle;
|
|
218
242
|
getCheckboxParticle(): CheckboxParticle;
|
|
219
243
|
getRadioParticle(): RadioParticle;
|
|
220
244
|
getControl(): Control;
|
|
245
|
+
getCascadeManager(): CascadeManager;
|
|
246
|
+
getValidate(): Validate;
|
|
221
247
|
getWorkerManager(): WorkerManager;
|
|
222
248
|
getImageObserver(): ImageObserver;
|
|
223
249
|
getI18n(): I18n;
|
|
@@ -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;
|
|
@@ -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,6 +36,7 @@ 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;
|
|
@@ -38,6 +44,7 @@ export declare class Position {
|
|
|
38
44
|
getPositionContext(): IPositionContext;
|
|
39
45
|
setPositionContext(payload: IPositionContext): void;
|
|
40
46
|
private _getColumnIndexByX;
|
|
47
|
+
private _getTableChildPositionByXY;
|
|
41
48
|
getPositionByXY(payload: IGetPositionByXYPayload): ICurrentPosition;
|
|
42
49
|
getFloatPositionByXY(payload: IGetFloatPositionByXYPayload): ICurrentPosition | void;
|
|
43
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
|
+
}
|
|
@@ -4,6 +4,7 @@ import { ITd } from '../../interface/table/Td';
|
|
|
4
4
|
import { IControlStyle } from '../../interface/Control';
|
|
5
5
|
export declare const EDITOR_ELEMENT_STYLE_ATTR: Array<keyof IElement>;
|
|
6
6
|
export declare const EDITOR_ROW_ATTR: Array<keyof IElement>;
|
|
7
|
+
export declare const EDITOR_TRACE_ATTR: Array<keyof IElement>;
|
|
7
8
|
export declare const EDITOR_ELEMENT_PARAGRAPH_STYLE_ATTR: Array<keyof IElement>;
|
|
8
9
|
export declare const EDITOR_ELEMENT_COPY_ATTR: Array<keyof IElement>;
|
|
9
10
|
export declare const EDITOR_ELEMENT_ZIP_ATTR: Array<keyof IElement>;
|
|
@@ -19,7 +19,8 @@ export declare enum EditorMode {
|
|
|
19
19
|
FORM = "form",// 表单模式(仅控件内可编辑)
|
|
20
20
|
PRINT = "print",// 打印模式(文档不可编辑、隐藏辅助元素、选区、未书写控件及边框)
|
|
21
21
|
DESIGN = "design",// 设计模式(不可删除、只读等配置不控制)
|
|
22
|
-
GRAFFITI = "graffiti"
|
|
22
|
+
GRAFFITI = "graffiti",// 涂鸦模式(屏蔽选区、允许长按移动绘制线条)
|
|
23
|
+
TRACE = "trace"
|
|
23
24
|
}
|
|
24
25
|
export declare enum EditorZone {
|
|
25
26
|
HEADER = "header",
|
|
@@ -15,6 +15,7 @@ import { ControlComponent, ControlIndentation, ControlState, ControlType } from
|
|
|
15
15
|
import { INavigateInfo } from './core/draw/interactive/Search';
|
|
16
16
|
import { KeyMap } from './dataset/enum/KeyMap';
|
|
17
17
|
import { BlockType } from './dataset/enum/Block';
|
|
18
|
+
import { MacroType } from './dataset/enum/Macro';
|
|
18
19
|
import { IBlock } from './interface/Block';
|
|
19
20
|
import { ILang } from './interface/i18n/I18n';
|
|
20
21
|
import { VerticalAlign } from './dataset/enum/VerticalAlign';
|
|
@@ -24,6 +25,7 @@ import { TitleLevel } from './dataset/enum/Title';
|
|
|
24
25
|
import { ListStyle, ListType } from './dataset/enum/List';
|
|
25
26
|
import { ICatalog, ICatalogItem } from './interface/Catalog';
|
|
26
27
|
import { UsePlugin } from './interface/Plugin';
|
|
28
|
+
import { MacroManager } from './core/macro/MacroManager';
|
|
27
29
|
import { EventBus } from './core/event/eventbus/EventBus';
|
|
28
30
|
import { EventBusMap } from './interface/EventBus';
|
|
29
31
|
import { IRangeStyle } from './interface/Listener';
|
|
@@ -49,9 +51,10 @@ export default class Editor {
|
|
|
49
51
|
register: Register;
|
|
50
52
|
destroy: () => void;
|
|
51
53
|
use: UsePlugin;
|
|
54
|
+
macro: MacroManager;
|
|
52
55
|
constructor(container: HTMLDivElement, data: IEditorData | IElement[], options?: IEditorOption);
|
|
53
56
|
}
|
|
54
57
|
export { splitText, createDomFromElementList, getElementListByHTML, getTextFromElementList };
|
|
55
58
|
export { EDITOR_COMPONENT, LETTER_CLASS, INTERNAL_CONTEXT_MENU_KEY, INTERNAL_SHORTCUT_KEY, EDITOR_CLIPBOARD };
|
|
56
|
-
export { Editor, RowFlex, VerticalAlign, EditorZone, EditorMode, ElementType, ControlType, EditorComponent, PageMode, RenderMode, ImageDisplay, Command, KeyMap, BlockType, PaperDirection, TableBorder, TdBorder, TdSlash, MaxHeightRatio, NumberType, TitleLevel, ListType, ListStyle, WordBreak, ControlIndentation, ControlComponent, BackgroundRepeat, BackgroundSize, TextDecorationStyle, LineNumberType, LocationPosition, AreaMode, ControlState, FlexDirection, WatermarkType, WatermarkLayer };
|
|
59
|
+
export { Editor, RowFlex, VerticalAlign, EditorZone, EditorMode, ElementType, ControlType, EditorComponent, PageMode, RenderMode, ImageDisplay, Command, KeyMap, BlockType, MacroType, PaperDirection, TableBorder, TdBorder, TdSlash, MaxHeightRatio, NumberType, TitleLevel, ListType, ListStyle, WordBreak, ControlIndentation, ControlComponent, BackgroundRepeat, BackgroundSize, TextDecorationStyle, LineNumberType, LocationPosition, AreaMode, ControlState, FlexDirection, WatermarkType, WatermarkLayer };
|
|
57
60
|
export type { IElement, IEditorData, IEditorOption, IEditorResult, IContextMenuContext, IRegisterContextMenu, IWatermark, INavigateInfo, IBlock, ILang, ICatalog, ICatalogItem, IRange, IRangeStyle, IBadge, IGetElementListByHTMLOption };
|