@hufe921/canvas-editor 0.9.88 → 0.9.90
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 +43 -0
- package/dist/canvas-editor.es.js +299 -88
- package/dist/canvas-editor.es.js.map +1 -1
- package/dist/canvas-editor.umd.js +31 -31
- package/dist/canvas-editor.umd.js.map +1 -1
- package/dist/src/editor/core/command/CommandAdapt.d.ts +2 -2
- package/dist/src/editor/core/draw/Draw.d.ts +4 -0
- package/dist/src/editor/core/draw/control/Control.d.ts +5 -5
- package/dist/src/editor/core/draw/frame/LineNumber.d.ts +7 -0
- package/dist/src/editor/core/draw/particle/CheckboxParticle.d.ts +10 -2
- package/dist/src/editor/core/draw/particle/RadioParticle.d.ts +10 -2
- package/dist/src/editor/dataset/constant/LineNumber.d.ts +2 -0
- package/dist/src/editor/dataset/enum/Common.d.ts +4 -0
- package/dist/src/editor/dataset/enum/LineNumber.d.ts +4 -0
- package/dist/src/editor/index.d.ts +3 -2
- package/dist/src/editor/interface/Checkbox.d.ts +2 -0
- package/dist/src/editor/interface/Control.d.ts +14 -5
- package/dist/src/editor/interface/Editor.d.ts +2 -0
- package/dist/src/editor/interface/Element.d.ts +1 -1
- package/dist/src/editor/interface/LineNumber.d.ts +9 -0
- package/dist/src/editor/interface/Radio.d.ts +2 -0
- package/dist/src/editor/interface/Row.d.ts +1 -0
- package/package.json +1 -1
|
@@ -7,7 +7,7 @@ import { TitleLevel } from '../../dataset/enum/Title';
|
|
|
7
7
|
import { VerticalAlign } from '../../dataset/enum/VerticalAlign';
|
|
8
8
|
import { ICatalog } from '../../interface/Catalog';
|
|
9
9
|
import { DeepRequired } from '../../interface/Common';
|
|
10
|
-
import { IGetControlValueOption, IGetControlValueResult, ISetControlExtensionOption, ISetControlHighlightOption, ISetControlProperties, ISetControlValueOption } from '../../interface/Control';
|
|
10
|
+
import { IGetControlValueOption, IGetControlValueResult, ILocationControlOption, ISetControlExtensionOption, ISetControlHighlightOption, ISetControlProperties, ISetControlValueOption } from '../../interface/Control';
|
|
11
11
|
import { IAppendElementListOption, IDrawImagePayload, IForceUpdateOption, IGetImageOption, IGetValueOption, IPainterOption } from '../../interface/Draw';
|
|
12
12
|
import { IEditorData, IEditorHTML, IEditorOption, IEditorResult, IEditorText, ISetValueOption, IUpdateOption } from '../../interface/Editor';
|
|
13
13
|
import { IElement, IUpdateElementByIdOption } from '../../interface/Element';
|
|
@@ -143,7 +143,7 @@ export declare class CommandAdapt {
|
|
|
143
143
|
setControlHighlight(payload: ISetControlHighlightOption): void;
|
|
144
144
|
updateOptions(payload: IUpdateOption): void;
|
|
145
145
|
getControlList(): IElement[];
|
|
146
|
-
locationControl(controlId: string): void;
|
|
146
|
+
locationControl(controlId: string, options?: ILocationControlOption): void;
|
|
147
147
|
insertControl(payload: IElement): void;
|
|
148
148
|
getContainer(): HTMLDivElement;
|
|
149
149
|
getTitleValue(payload: IGetTitleValueOption): IGetTitleValueResult | null;
|
|
@@ -11,6 +11,7 @@ import { Position } from '../position/Position';
|
|
|
11
11
|
import { RangeManager } from '../range/RangeManager';
|
|
12
12
|
import { Search } from './interactive/Search';
|
|
13
13
|
import { ImageParticle } from './particle/ImageParticle';
|
|
14
|
+
import { TextParticle } from './particle/TextParticle';
|
|
14
15
|
import { TableParticle } from './particle/table/TableParticle';
|
|
15
16
|
import { TableTool } from './particle/table/TableTool';
|
|
16
17
|
import { HyperlinkParticle } from './particle/HyperlinkParticle';
|
|
@@ -69,6 +70,7 @@ export declare class Draw {
|
|
|
69
70
|
private tableParticle;
|
|
70
71
|
private tableTool;
|
|
71
72
|
private pageNumber;
|
|
73
|
+
private lineNumber;
|
|
72
74
|
private waterMark;
|
|
73
75
|
private placeholder;
|
|
74
76
|
private header;
|
|
@@ -115,6 +117,7 @@ export declare class Draw {
|
|
|
115
117
|
getCanvasHeight(pageNo?: number): number;
|
|
116
118
|
getInnerWidth(): number;
|
|
117
119
|
getOriginalInnerWidth(): number;
|
|
120
|
+
getContextInnerWidth(): number;
|
|
118
121
|
getMargins(): IMargin;
|
|
119
122
|
getOriginalMargins(): number[];
|
|
120
123
|
getPageGap(): number;
|
|
@@ -147,6 +150,7 @@ export declare class Draw {
|
|
|
147
150
|
getZone(): Zone;
|
|
148
151
|
getRange(): RangeManager;
|
|
149
152
|
getLineBreakParticle(): LineBreakParticle;
|
|
153
|
+
getTextParticle(): TextParticle;
|
|
150
154
|
getHeaderElementList(): IElement[];
|
|
151
155
|
getTableElementList(sourceElementList: IElement[]): IElement[];
|
|
152
156
|
getElementList(): IElement[];
|
|
@@ -26,7 +26,7 @@ export declare class Control {
|
|
|
26
26
|
getIsRangeInPostfix(): boolean;
|
|
27
27
|
getIsRangeWithinControl(): boolean;
|
|
28
28
|
getIsElementListContainFullControl(elementList: IElement[]): boolean;
|
|
29
|
-
getIsDisabledControl(): boolean;
|
|
29
|
+
getIsDisabledControl(context?: IControlContext): boolean;
|
|
30
30
|
getContainer(): HTMLDivElement;
|
|
31
31
|
getElementList(): IElement[];
|
|
32
32
|
getPosition(): IElementPosition | null;
|
|
@@ -45,10 +45,10 @@ export declare class Control {
|
|
|
45
45
|
setValue(data: IElement[]): number;
|
|
46
46
|
keydown(evt: KeyboardEvent): number | null;
|
|
47
47
|
cut(): number;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
getValueById(payload: IGetControlValueOption): IGetControlValueResult;
|
|
49
|
+
setValueById(payload: ISetControlValueOption): void;
|
|
50
|
+
setExtensionById(payload: ISetControlExtensionOption): void;
|
|
51
|
+
setPropertiesById(payload: ISetControlProperties): void;
|
|
52
52
|
getList(): IElement[];
|
|
53
53
|
recordBorderInfo(x: number, y: number, width: number, height: number): void;
|
|
54
54
|
drawBorder(ctx: CanvasRenderingContext2D): void;
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import { IElement } from '../../../interface/Element';
|
|
2
|
-
import {
|
|
2
|
+
import { IRow } from '../../../interface/Row';
|
|
3
3
|
import { Draw } from '../Draw';
|
|
4
|
+
interface ICheckboxRenderOption {
|
|
5
|
+
ctx: CanvasRenderingContext2D;
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
row: IRow;
|
|
9
|
+
index: number;
|
|
10
|
+
}
|
|
4
11
|
export declare class CheckboxParticle {
|
|
5
12
|
private draw;
|
|
6
13
|
private options;
|
|
7
14
|
constructor(draw: Draw);
|
|
8
15
|
setSelect(element: IElement): void;
|
|
9
|
-
render(
|
|
16
|
+
render(payload: ICheckboxRenderOption): void;
|
|
10
17
|
}
|
|
18
|
+
export {};
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import { IElement } from '../../../interface/Element';
|
|
2
|
-
import {
|
|
2
|
+
import { IRow } from '../../../interface/Row';
|
|
3
3
|
import { Draw } from '../Draw';
|
|
4
|
+
interface IRadioRenderOption {
|
|
5
|
+
ctx: CanvasRenderingContext2D;
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
row: IRow;
|
|
9
|
+
index: number;
|
|
10
|
+
}
|
|
4
11
|
export declare class RadioParticle {
|
|
5
12
|
private draw;
|
|
6
13
|
private options;
|
|
7
14
|
constructor(draw: Draw);
|
|
8
15
|
setSelect(element: IElement): void;
|
|
9
|
-
render(
|
|
16
|
+
render(payload: IRadioRenderOption): void;
|
|
10
17
|
}
|
|
18
|
+
export {};
|
|
@@ -4,7 +4,7 @@ import { IElement } from './interface/Element';
|
|
|
4
4
|
import { Command } from './core/command/Command';
|
|
5
5
|
import { Listener } from './core/listener/Listener';
|
|
6
6
|
import { RowFlex } from './dataset/enum/Row';
|
|
7
|
-
import { ImageDisplay } from './dataset/enum/Common';
|
|
7
|
+
import { ImageDisplay, LocationPosition } from './dataset/enum/Common';
|
|
8
8
|
import { ElementType } from './dataset/enum/Element';
|
|
9
9
|
import { Register } from './core/register/Register';
|
|
10
10
|
import { IContextMenuContext, IRegisterContextMenu } from './interface/contextmenu/ContextMenu';
|
|
@@ -34,6 +34,7 @@ import { IRange } from './interface/Range';
|
|
|
34
34
|
import { splitText } from './utils';
|
|
35
35
|
import { BackgroundRepeat, BackgroundSize } from './dataset/enum/Background';
|
|
36
36
|
import { TextDecorationStyle } from './dataset/enum/Text';
|
|
37
|
+
import { LineNumberType } from './dataset/enum/LineNumber';
|
|
37
38
|
export default class Editor {
|
|
38
39
|
command: Command;
|
|
39
40
|
listener: Listener;
|
|
@@ -46,5 +47,5 @@ export default class Editor {
|
|
|
46
47
|
}
|
|
47
48
|
export { splitText };
|
|
48
49
|
export { EDITOR_COMPONENT, LETTER_CLASS, INTERNAL_CONTEXT_MENU_KEY };
|
|
49
|
-
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, BackgroundRepeat, BackgroundSize, TextDecorationStyle };
|
|
50
|
+
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, BackgroundRepeat, BackgroundSize, TextDecorationStyle, LineNumberType, LocationPosition };
|
|
50
51
|
export type { IElement, IEditorData, IEditorOption, IEditorResult, IContextMenuContext, IRegisterContextMenu, IWatermark, INavigateInfo, IBlock, ILang, ICatalog, ICatalogItem, IRange, IRangeStyle };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { VerticalAlign } from '../dataset/enum/VerticalAlign';
|
|
1
2
|
export interface ICheckbox {
|
|
2
3
|
value: boolean | null;
|
|
3
4
|
code?: string;
|
|
@@ -10,4 +11,5 @@ export interface ICheckboxOption {
|
|
|
10
11
|
lineWidth?: number;
|
|
11
12
|
fillStyle?: string;
|
|
12
13
|
strokeStyle?: string;
|
|
14
|
+
verticalAlign?: VerticalAlign;
|
|
13
15
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { LocationPosition } from '../dataset/enum/Common';
|
|
1
2
|
import { ControlType, ControlIndentation } from '../dataset/enum/Control';
|
|
2
3
|
import { EditorZone } from '../dataset/enum/Editor';
|
|
3
4
|
import { MoveDirection } from '../dataset/enum/Observer';
|
|
@@ -33,7 +34,8 @@ export interface IControlHighlightRule {
|
|
|
33
34
|
}
|
|
34
35
|
export interface IControlHighlight {
|
|
35
36
|
ruleList: IControlHighlightRule[];
|
|
36
|
-
|
|
37
|
+
id?: string;
|
|
38
|
+
conceptId?: string;
|
|
37
39
|
}
|
|
38
40
|
export interface IControlRule {
|
|
39
41
|
deletable?: boolean;
|
|
@@ -96,7 +98,8 @@ export interface IControlRuleOption {
|
|
|
96
98
|
isAddPlaceholder?: boolean;
|
|
97
99
|
}
|
|
98
100
|
export interface IGetControlValueOption {
|
|
99
|
-
|
|
101
|
+
id?: string;
|
|
102
|
+
conceptId?: string;
|
|
100
103
|
}
|
|
101
104
|
export type IGetControlValueResult = (Omit<IControl, 'value'> & {
|
|
102
105
|
value: string | null;
|
|
@@ -104,16 +107,19 @@ export type IGetControlValueResult = (Omit<IControl, 'value'> & {
|
|
|
104
107
|
zone: EditorZone;
|
|
105
108
|
})[];
|
|
106
109
|
export interface ISetControlValueOption {
|
|
107
|
-
|
|
110
|
+
id?: string;
|
|
111
|
+
conceptId?: string;
|
|
108
112
|
value: string;
|
|
109
113
|
}
|
|
110
114
|
export interface ISetControlExtensionOption {
|
|
111
|
-
|
|
115
|
+
id?: string;
|
|
116
|
+
conceptId?: string;
|
|
112
117
|
extension: unknown;
|
|
113
118
|
}
|
|
114
119
|
export type ISetControlHighlightOption = IControlHighlight[];
|
|
115
120
|
export type ISetControlProperties = {
|
|
116
|
-
|
|
121
|
+
id?: string;
|
|
122
|
+
conceptId?: string;
|
|
117
123
|
properties: Partial<Omit<IControl, 'value'>>;
|
|
118
124
|
};
|
|
119
125
|
export type IRepaintControlOption = Pick<IDrawOption, 'curIndex' | 'isCompute' | 'isSubmitHistory'>;
|
|
@@ -124,3 +130,6 @@ export interface INextControlContext {
|
|
|
124
130
|
export interface IInitNextControlOption {
|
|
125
131
|
direction?: MoveDirection;
|
|
126
132
|
}
|
|
133
|
+
export interface ILocationControlOption {
|
|
134
|
+
position: LocationPosition;
|
|
135
|
+
}
|
|
@@ -18,6 +18,7 @@ import { IWatermark } from './Watermark';
|
|
|
18
18
|
import { IZoneOption } from './Zone';
|
|
19
19
|
import { ISeparatorOption } from './Separator';
|
|
20
20
|
import { ITableOption } from './table/Table';
|
|
21
|
+
import { ILineNumberOption } from './LineNumber';
|
|
21
22
|
export interface IEditorData {
|
|
22
23
|
header?: IElement[];
|
|
23
24
|
main: IElement[];
|
|
@@ -81,6 +82,7 @@ export interface IEditorOption {
|
|
|
81
82
|
background?: IBackgroundOption;
|
|
82
83
|
lineBreak?: ILineBreakOption;
|
|
83
84
|
separator?: ISeparatorOption;
|
|
85
|
+
lineNumber?: ILineNumberOption;
|
|
84
86
|
}
|
|
85
87
|
export interface IEditorResult {
|
|
86
88
|
version: string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { VerticalAlign } from '../dataset/enum/VerticalAlign';
|
|
1
2
|
export interface IRadio {
|
|
2
3
|
value: boolean | null;
|
|
3
4
|
code?: string;
|
|
@@ -10,4 +11,5 @@ export interface IRadioOption {
|
|
|
10
11
|
lineWidth?: number;
|
|
11
12
|
fillStyle?: string;
|
|
12
13
|
strokeStyle?: string;
|
|
14
|
+
verticalAlign?: VerticalAlign;
|
|
13
15
|
}
|