@hufe921/canvas-editor 0.9.96 → 0.9.98
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 +55 -0
- package/dist/canvas-editor.es.js +903 -191
- package/dist/canvas-editor.es.js.map +1 -1
- package/dist/canvas-editor.umd.js +38 -36
- package/dist/canvas-editor.umd.js.map +1 -1
- package/dist/src/editor/core/command/Command.d.ts +5 -0
- package/dist/src/editor/core/command/CommandAdapt.d.ts +8 -2
- package/dist/src/editor/core/draw/Draw.d.ts +3 -0
- package/dist/src/editor/core/draw/control/Control.d.ts +5 -2
- package/dist/src/editor/core/draw/control/select/SelectControl.d.ts +5 -2
- package/dist/src/editor/core/draw/interactive/Area.d.ts +18 -0
- package/dist/src/editor/core/draw/particle/table/TableOperate.d.ts +1 -0
- package/dist/src/editor/core/event/CanvasEvent.d.ts +2 -1
- package/dist/src/editor/core/event/handlers/copy.d.ts +2 -1
- package/dist/src/editor/core/range/RangeManager.d.ts +5 -1
- package/dist/src/editor/dataset/constant/Element.d.ts +1 -0
- package/dist/src/editor/dataset/enum/Area.d.ts +5 -0
- package/dist/src/editor/dataset/enum/Control.d.ts +6 -0
- package/dist/src/editor/dataset/enum/Element.d.ts +1 -0
- package/dist/src/editor/index.d.ts +4 -3
- package/dist/src/editor/interface/Area.d.ts +41 -0
- package/dist/src/editor/interface/Control.d.ts +21 -2
- package/dist/src/editor/interface/Element.d.ts +8 -1
- package/dist/src/editor/interface/Event.d.ts +3 -0
- package/dist/src/editor/interface/Listener.d.ts +2 -2
- package/dist/src/editor/interface/Range.d.ts +2 -1
- package/dist/src/editor/interface/Row.d.ts +1 -0
- package/dist/src/editor/interface/table/Table.d.ts +1 -0
- package/dist/src/editor/utils/element.d.ts +1 -0
- package/dist/src/editor/utils/index.d.ts +2 -0
- package/package.json +1 -1
|
@@ -44,6 +44,7 @@ export declare class Command {
|
|
|
44
44
|
executeCancelMergeTableCell: CommandAdapt['cancelMergeTableCell'];
|
|
45
45
|
executeTableTdVerticalAlign: CommandAdapt['tableTdVerticalAlign'];
|
|
46
46
|
executeTableBorderType: CommandAdapt['tableBorderType'];
|
|
47
|
+
executeTableBorderColor: CommandAdapt['tableBorderColor'];
|
|
47
48
|
executeTableTdBorderType: CommandAdapt['tableTdBorderType'];
|
|
48
49
|
executeTableTdSlashType: CommandAdapt['tableTdSlashType'];
|
|
49
50
|
executeTableTdBackgroundColor: CommandAdapt['tableTdBackgroundColor'];
|
|
@@ -66,6 +67,7 @@ export declare class Command {
|
|
|
66
67
|
executeSaveAsImageElement: CommandAdapt['saveAsImageElement'];
|
|
67
68
|
executeChangeImageDisplay: CommandAdapt['changeImageDisplay'];
|
|
68
69
|
executePageMode: CommandAdapt['pageMode'];
|
|
70
|
+
executePageScale: CommandAdapt['pageScale'];
|
|
69
71
|
executePageScaleRecovery: CommandAdapt['pageScaleRecovery'];
|
|
70
72
|
executePageScaleMinus: CommandAdapt['pageScaleMinus'];
|
|
71
73
|
executePageScaleAdd: CommandAdapt['pageScaleAdd'];
|
|
@@ -73,6 +75,8 @@ export declare class Command {
|
|
|
73
75
|
executePaperDirection: CommandAdapt['paperDirection'];
|
|
74
76
|
executeSetPaperMargin: CommandAdapt['setPaperMargin'];
|
|
75
77
|
executeInsertElementList: CommandAdapt['insertElementList'];
|
|
78
|
+
executeInsertArea: CommandAdapt['insertArea'];
|
|
79
|
+
executeSetAreaProperties: CommandAdapt['setAreaProperties'];
|
|
76
80
|
executeAppendElementList: CommandAdapt['appendElementList'];
|
|
77
81
|
executeUpdateElementById: CommandAdapt['updateElementById'];
|
|
78
82
|
executeSetValue: CommandAdapt['setValue'];
|
|
@@ -98,6 +102,7 @@ export declare class Command {
|
|
|
98
102
|
getImage: CommandAdapt['getImage'];
|
|
99
103
|
getOptions: CommandAdapt['getOptions'];
|
|
100
104
|
getValue: CommandAdapt['getValue'];
|
|
105
|
+
getAreaValue: CommandAdapt['getAreaValue'];
|
|
101
106
|
getHTML: CommandAdapt['getHTML'];
|
|
102
107
|
getText: CommandAdapt['getText'];
|
|
103
108
|
getWordCount: CommandAdapt['getWordCount'];
|
|
@@ -11,7 +11,7 @@ import { IGetControlValueOption, IGetControlValueResult, ILocationControlOption,
|
|
|
11
11
|
import { IAppendElementListOption, IDrawImagePayload, IForceUpdateOption, IGetImageOption, IGetValueOption, IPainterOption } from '../../interface/Draw';
|
|
12
12
|
import { IEditorData, IEditorHTML, IEditorOption, IEditorResult, IEditorText, IFocusOption, ISetValueOption, IUpdateOption } from '../../interface/Editor';
|
|
13
13
|
import { IElement, IElementPosition, IGetElementByIdOption, IUpdateElementByIdOption } from '../../interface/Element';
|
|
14
|
-
import { IPasteOption, IPositionContextByEvent } from '../../interface/Event';
|
|
14
|
+
import { ICopyOption, IPasteOption, IPositionContextByEvent } from '../../interface/Event';
|
|
15
15
|
import { IMargin } from '../../interface/Margin';
|
|
16
16
|
import { IRange, RangeContext } from '../../interface/Range';
|
|
17
17
|
import { ISearchResultContext } from '../../interface/Search';
|
|
@@ -20,6 +20,7 @@ import { IGetTitleValueOption, IGetTitleValueResult } from '../../interface/Titl
|
|
|
20
20
|
import { IWatermark } from '../../interface/Watermark';
|
|
21
21
|
import { Draw } from '../draw/Draw';
|
|
22
22
|
import { INavigateInfo } from '../draw/interactive/Search';
|
|
23
|
+
import { IGetAreaValueOption, IGetAreaValueResult, IInsertAreaOption, ISetAreaPropertiesOption } from '../../interface/Area';
|
|
23
24
|
export declare class CommandAdapt {
|
|
24
25
|
private draw;
|
|
25
26
|
private range;
|
|
@@ -36,7 +37,7 @@ export declare class CommandAdapt {
|
|
|
36
37
|
constructor(draw: Draw);
|
|
37
38
|
mode(payload: EditorMode): void;
|
|
38
39
|
cut(): void;
|
|
39
|
-
copy(): void;
|
|
40
|
+
copy(payload?: ICopyOption): void;
|
|
40
41
|
paste(payload?: IPasteOption): void;
|
|
41
42
|
selectAll(): void;
|
|
42
43
|
backspace(): void;
|
|
@@ -78,6 +79,7 @@ export declare class CommandAdapt {
|
|
|
78
79
|
cancelMergeTableCell(): void;
|
|
79
80
|
tableTdVerticalAlign(payload: VerticalAlign): void;
|
|
80
81
|
tableBorderType(payload: TableBorder): void;
|
|
82
|
+
tableBorderColor(payload: string): void;
|
|
81
83
|
tableTdBorderType(payload: TdBorder): void;
|
|
82
84
|
tableTdSlashType(payload: TdSlash): void;
|
|
83
85
|
tableTdBackgroundColor(payload: string): void;
|
|
@@ -104,6 +106,7 @@ export declare class CommandAdapt {
|
|
|
104
106
|
getImage(payload?: IGetImageOption): Promise<string[]>;
|
|
105
107
|
getOptions(): DeepRequired<IEditorOption>;
|
|
106
108
|
getValue(options?: IGetValueOption): IEditorResult;
|
|
109
|
+
getAreaValue(options?: IGetAreaValueOption): IGetAreaValueResult | null;
|
|
107
110
|
getHTML(): IEditorHTML;
|
|
108
111
|
getText(): IEditorText;
|
|
109
112
|
getWordCount(): Promise<number>;
|
|
@@ -116,6 +119,7 @@ export declare class CommandAdapt {
|
|
|
116
119
|
getKeywordRangeList(payload: string): IRange[];
|
|
117
120
|
getKeywordContext(payload: string): ISearchResultContext[] | null;
|
|
118
121
|
pageMode(payload: PageMode): void;
|
|
122
|
+
pageScale(scale: number): void;
|
|
119
123
|
pageScaleRecovery(): void;
|
|
120
124
|
pageScaleMinus(): void;
|
|
121
125
|
pageScaleAdd(): void;
|
|
@@ -154,4 +158,6 @@ export declare class CommandAdapt {
|
|
|
154
158
|
getPositionContextByEvent(evt: MouseEvent): IPositionContextByEvent | null;
|
|
155
159
|
insertTitle(payload: IElement): void;
|
|
156
160
|
focus(payload?: IFocusOption): void;
|
|
161
|
+
insertArea(payload: IInsertAreaOption): string | null;
|
|
162
|
+
setAreaProperties(payload: ISetAreaPropertiesOption): void;
|
|
157
163
|
}
|
|
@@ -37,6 +37,7 @@ import { Override } from '../override/Override';
|
|
|
37
37
|
import { LineBreakParticle } from './particle/LineBreakParticle';
|
|
38
38
|
import { ITd } from '../../interface/table/Td';
|
|
39
39
|
import { TableOperate } from './particle/table/TableOperate';
|
|
40
|
+
import { Area } from './interactive/Area';
|
|
40
41
|
export declare class Draw {
|
|
41
42
|
private container;
|
|
42
43
|
private pageContainer;
|
|
@@ -61,6 +62,7 @@ export declare class Draw {
|
|
|
61
62
|
private background;
|
|
62
63
|
private search;
|
|
63
64
|
private group;
|
|
65
|
+
private area;
|
|
64
66
|
private underline;
|
|
65
67
|
private strikeout;
|
|
66
68
|
private highlight;
|
|
@@ -150,6 +152,7 @@ export declare class Draw {
|
|
|
150
152
|
getOptions(): DeepRequired<IEditorOption>;
|
|
151
153
|
getSearch(): Search;
|
|
152
154
|
getGroup(): Group;
|
|
155
|
+
getArea(): Area;
|
|
153
156
|
getHistoryManager(): HistoryManager;
|
|
154
157
|
getPosition(): Position;
|
|
155
158
|
getZone(): Zone;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IControlContext, IControlHighlight, IControlInitOption, IControlInstance, IGetControlValueOption, IGetControlValueResult, IInitNextControlOption, INextControlContext, IRepaintControlOption, ISetControlExtensionOption, ISetControlProperties, ISetControlRowFlexOption, ISetControlValueOption } from '../../../interface/Control';
|
|
1
|
+
import { IControl, IControlContext, IControlHighlight, IControlInitOption, IControlInstance, IDestroyControlOption, IGetControlValueOption, IGetControlValueResult, IInitNextControlOption, INextControlContext, IRepaintControlOption, ISetControlExtensionOption, ISetControlProperties, ISetControlRowFlexOption, ISetControlValueOption } from '../../../interface/Control';
|
|
2
2
|
import { IElement, IElementPosition } from '../../../interface/Element';
|
|
3
3
|
import { IRange } from '../../../interface/Range';
|
|
4
4
|
import { Draw } from '../Draw';
|
|
@@ -16,6 +16,7 @@ export declare class Control {
|
|
|
16
16
|
private options;
|
|
17
17
|
private controlOptions;
|
|
18
18
|
private activeControl;
|
|
19
|
+
private activeControlValue;
|
|
19
20
|
constructor(draw: Draw);
|
|
20
21
|
setHighlightList(payload: IControlHighlight[]): void;
|
|
21
22
|
computeHighlightList(): void;
|
|
@@ -35,8 +36,9 @@ export declare class Control {
|
|
|
35
36
|
getRange(): IRange;
|
|
36
37
|
shrinkBoundary(context?: IControlContext): void;
|
|
37
38
|
getActiveControl(): IControlInstance | null;
|
|
39
|
+
updateActiveControlValue(): void;
|
|
38
40
|
initControl(): void;
|
|
39
|
-
destroyControl(): void;
|
|
41
|
+
destroyControl(options?: IDestroyControlOption): void;
|
|
40
42
|
repaintControl(options?: IRepaintControlOption): void;
|
|
41
43
|
reAwakeControl(): void;
|
|
42
44
|
moveCursor(position: IControlInitOption): IMoveCursorResult;
|
|
@@ -44,6 +46,7 @@ export declare class Control {
|
|
|
44
46
|
removePlaceholder(startIndex: number, context?: IControlContext): void;
|
|
45
47
|
addPlaceholder(startIndex: number, context?: IControlContext): void;
|
|
46
48
|
setValue(data: IElement[]): number;
|
|
49
|
+
setControlProperties(properties: Partial<IControl>, context?: IControlContext): void;
|
|
47
50
|
keydown(evt: KeyboardEvent): number | null;
|
|
48
51
|
cut(): number;
|
|
49
52
|
getValueById(payload: IGetControlValueOption): IGetControlValueResult;
|
|
@@ -7,13 +7,16 @@ export declare class SelectControl implements IControlInstance {
|
|
|
7
7
|
private isPopup;
|
|
8
8
|
private selectDom;
|
|
9
9
|
private options;
|
|
10
|
+
private VALUE_DELIMITER;
|
|
11
|
+
private DEFAULT_MULTI_SELECT_DELIMITER;
|
|
10
12
|
constructor(element: IElement, control: Control);
|
|
11
13
|
setElement(element: IElement): void;
|
|
12
14
|
getElement(): IElement;
|
|
13
15
|
getIsPopup(): boolean;
|
|
14
|
-
|
|
16
|
+
getCodes(): string[];
|
|
17
|
+
getText(codes: string[]): string | null;
|
|
15
18
|
getValue(context?: IControlContext): IElement[];
|
|
16
|
-
setValue(): number;
|
|
19
|
+
setValue(data: IElement[], context?: IControlContext, options?: IControlRuleOption): number;
|
|
17
20
|
keydown(evt: KeyboardEvent): number | null;
|
|
18
21
|
cut(): number;
|
|
19
22
|
clearSelect(context?: IControlContext, options?: IControlRuleOption): number;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Draw } from '../Draw';
|
|
2
|
+
import { IAreaInfo, IGetAreaValueOption, IGetAreaValueResult, IInsertAreaOption, ISetAreaPropertiesOption } from '../../../interface/Area';
|
|
3
|
+
export declare class Area {
|
|
4
|
+
private draw;
|
|
5
|
+
private zone;
|
|
6
|
+
private range;
|
|
7
|
+
private position;
|
|
8
|
+
private areaInfoMap;
|
|
9
|
+
constructor(draw: Draw);
|
|
10
|
+
getActiveAreaId(): string | null;
|
|
11
|
+
getActiveAreaInfo(): IAreaInfo | null;
|
|
12
|
+
isReadonly(): boolean;
|
|
13
|
+
insertArea(payload: IInsertAreaOption): string | null;
|
|
14
|
+
render(ctx: CanvasRenderingContext2D, pageNo: number): void;
|
|
15
|
+
compute(): void;
|
|
16
|
+
getAreaValue(options?: IGetAreaValueOption): IGetAreaValueResult | null;
|
|
17
|
+
setAreaProperties(payload: ISetAreaPropertiesOption): void;
|
|
18
|
+
}
|
|
@@ -22,6 +22,7 @@ export declare class TableOperate {
|
|
|
22
22
|
cancelMergeTableCell(): void;
|
|
23
23
|
tableTdVerticalAlign(payload: VerticalAlign): void;
|
|
24
24
|
tableBorderType(payload: TableBorder): void;
|
|
25
|
+
tableBorderColor(payload: string): void;
|
|
25
26
|
tableTdBorderType(payload: TdBorder): void;
|
|
26
27
|
tableTdSlashType(payload: TdSlash): void;
|
|
27
28
|
tableTdBackgroundColor(payload: string): void;
|
|
@@ -2,6 +2,7 @@ import { IElement, IElementPosition } from '../../interface/Element';
|
|
|
2
2
|
import { ICurrentPosition, IPositionContext } from '../../interface/Position';
|
|
3
3
|
import { Draw } from '../draw/Draw';
|
|
4
4
|
import { IRange } from '../../interface/Range';
|
|
5
|
+
import { ICopyOption } from '../../interface/Event';
|
|
5
6
|
export interface ICompositionInfo {
|
|
6
7
|
elementList: IElement[];
|
|
7
8
|
startIndex: number;
|
|
@@ -42,7 +43,7 @@ export declare class CanvasEvent {
|
|
|
42
43
|
threeClick(): void;
|
|
43
44
|
input(data: string): void;
|
|
44
45
|
cut(): void;
|
|
45
|
-
copy(): void;
|
|
46
|
+
copy(options?: ICopyOption): void;
|
|
46
47
|
compositionstart(): void;
|
|
47
48
|
compositionend(evt: CompositionEvent): void;
|
|
48
49
|
drop(evt: DragEvent): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IControlContext } from '../../interface/Control';
|
|
2
2
|
import { IElement } from '../../interface/Element';
|
|
3
|
-
import { IRange, IRangeParagraphInfo, RangeRowArray, RangeRowMap } from '../../interface/Range';
|
|
3
|
+
import { IRange, IRangeElementStyle, IRangeParagraphInfo, RangeRowArray, RangeRowMap } from '../../interface/Range';
|
|
4
4
|
import { Draw } from '../draw/Draw';
|
|
5
5
|
export declare class RangeManager {
|
|
6
6
|
private draw;
|
|
@@ -10,9 +10,13 @@ export declare class RangeManager {
|
|
|
10
10
|
private eventBus;
|
|
11
11
|
private position;
|
|
12
12
|
private historyManager;
|
|
13
|
+
private defaultStyle;
|
|
13
14
|
constructor(draw: Draw);
|
|
14
15
|
getRange(): IRange;
|
|
15
16
|
clearRange(): void;
|
|
17
|
+
setDefaultStyle(style: IRangeElementStyle | null): void;
|
|
18
|
+
getDefaultStyle(): IRangeElementStyle | null;
|
|
19
|
+
getRangeAnchorStyle(elementList: IElement[], anchorIndex: number): IElement | null;
|
|
16
20
|
getIsCollapsed(): boolean;
|
|
17
21
|
getIsSelection(): boolean;
|
|
18
22
|
getSelection(): IElement[] | null;
|
|
@@ -12,6 +12,7 @@ export declare const TITLE_CONTEXT_ATTR: Array<keyof IElement>;
|
|
|
12
12
|
export declare const LIST_CONTEXT_ATTR: Array<keyof IElement>;
|
|
13
13
|
export declare const CONTROL_CONTEXT_ATTR: Array<keyof IElement>;
|
|
14
14
|
export declare const CONTROL_STYLE_ATTR: Array<keyof IControlStyle>;
|
|
15
|
+
export declare const AREA_CONTEXT_ATTR: Array<keyof IElement>;
|
|
15
16
|
export declare const EDITOR_ELEMENT_CONTEXT_ATTR: Array<keyof IElement>;
|
|
16
17
|
export declare const TEXTLIKE_ELEMENT_TYPE: ElementType[];
|
|
17
18
|
export declare const IMAGE_ELEMENT_TYPE: ElementType[];
|
|
@@ -8,6 +8,8 @@ export declare enum ControlType {
|
|
|
8
8
|
export declare enum ControlComponent {
|
|
9
9
|
PREFIX = "prefix",
|
|
10
10
|
POSTFIX = "postfix",
|
|
11
|
+
PRE_TEXT = "preText",
|
|
12
|
+
POST_TEXT = "postText",
|
|
11
13
|
PLACEHOLDER = "placeholder",
|
|
12
14
|
VALUE = "value",
|
|
13
15
|
CHECKBOX = "checkbox",
|
|
@@ -17,3 +19,7 @@ export declare enum ControlIndentation {
|
|
|
17
19
|
ROW_START = "rowStart",
|
|
18
20
|
VALUE_START = "valueStart"
|
|
19
21
|
}
|
|
22
|
+
export declare enum ControlState {
|
|
23
|
+
ACTIVE = "active",
|
|
24
|
+
INACTIVE = "inactive"
|
|
25
|
+
}
|
|
@@ -11,7 +11,7 @@ import { IContextMenuContext, IRegisterContextMenu } from './interface/contextme
|
|
|
11
11
|
import { EditorComponent, EditorZone, EditorMode, PageMode, PaperDirection, WordBreak, RenderMode } from './dataset/enum/Editor';
|
|
12
12
|
import { EDITOR_CLIPBOARD, EDITOR_COMPONENT } from './dataset/constant/Editor';
|
|
13
13
|
import { IWatermark } from './interface/Watermark';
|
|
14
|
-
import { ControlIndentation, ControlType } from './dataset/enum/Control';
|
|
14
|
+
import { ControlIndentation, ControlState, ControlType } from './dataset/enum/Control';
|
|
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';
|
|
@@ -36,6 +36,7 @@ import { createDomFromElementList, getElementListByHTML, getTextFromElementList,
|
|
|
36
36
|
import { BackgroundRepeat, BackgroundSize } from './dataset/enum/Background';
|
|
37
37
|
import { TextDecorationStyle } from './dataset/enum/Text';
|
|
38
38
|
import { LineNumberType } from './dataset/enum/LineNumber';
|
|
39
|
+
import { AreaMode } from './dataset/enum/Area';
|
|
39
40
|
export default class Editor {
|
|
40
41
|
command: Command;
|
|
41
42
|
listener: Listener;
|
|
@@ -48,5 +49,5 @@ export default class Editor {
|
|
|
48
49
|
}
|
|
49
50
|
export { splitText, createDomFromElementList, getElementListByHTML, getTextFromElementList };
|
|
50
51
|
export { EDITOR_COMPONENT, LETTER_CLASS, INTERNAL_CONTEXT_MENU_KEY, EDITOR_CLIPBOARD };
|
|
51
|
-
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,
|
|
52
|
-
export type { IElement, IEditorData, IEditorOption, IEditorResult, IContextMenuContext, IRegisterContextMenu, IWatermark, INavigateInfo, IBlock, ILang, ICatalog, ICatalogItem, IRange, IRangeStyle };
|
|
52
|
+
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, AreaMode, ControlState };
|
|
53
|
+
export type { IElement, IEditorData, IEditorOption, IEditorResult, IContextMenuContext, IRegisterContextMenu, IWatermark, INavigateInfo, IBlock, ILang, ICatalog, ICatalogItem, IRange, IRangeStyle, IGetElementListByHTMLOption };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { AreaMode } from '../dataset/enum/Area';
|
|
2
|
+
import { LocationPosition } from '../dataset/enum/Common';
|
|
3
|
+
import { IElement, IElementPosition } from './Element';
|
|
4
|
+
export interface IAreaBasic {
|
|
5
|
+
extension?: unknown;
|
|
6
|
+
}
|
|
7
|
+
export interface IAreaStyle {
|
|
8
|
+
top?: number;
|
|
9
|
+
borderColor?: string;
|
|
10
|
+
backgroundColor?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface IAreaRule {
|
|
13
|
+
mode?: AreaMode;
|
|
14
|
+
}
|
|
15
|
+
export type IArea = IAreaBasic & IAreaStyle & IAreaRule;
|
|
16
|
+
export interface IInsertAreaOption {
|
|
17
|
+
id?: string;
|
|
18
|
+
area: IArea;
|
|
19
|
+
value: IElement[];
|
|
20
|
+
position?: LocationPosition;
|
|
21
|
+
}
|
|
22
|
+
export interface ISetAreaPropertiesOption {
|
|
23
|
+
id?: string;
|
|
24
|
+
properties: IArea;
|
|
25
|
+
}
|
|
26
|
+
export interface IGetAreaValueOption {
|
|
27
|
+
id?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface IGetAreaValueResult {
|
|
30
|
+
id?: string;
|
|
31
|
+
area: IArea;
|
|
32
|
+
startPageNo: number;
|
|
33
|
+
endPageNo: number;
|
|
34
|
+
value: IElement[];
|
|
35
|
+
}
|
|
36
|
+
export interface IAreaInfo {
|
|
37
|
+
id: string;
|
|
38
|
+
area: IArea;
|
|
39
|
+
elementList: IElement[];
|
|
40
|
+
positionList: IElementPosition[];
|
|
41
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LocationPosition } from '../dataset/enum/Common';
|
|
2
|
-
import { ControlType, ControlIndentation } from '../dataset/enum/Control';
|
|
2
|
+
import { ControlType, ControlIndentation, ControlState } from '../dataset/enum/Control';
|
|
3
3
|
import { EditorZone } from '../dataset/enum/Editor';
|
|
4
4
|
import { MoveDirection } from '../dataset/enum/Observer';
|
|
5
5
|
import { RowFlex } from '../dataset/enum/Row';
|
|
@@ -15,6 +15,11 @@ export interface IValueSet {
|
|
|
15
15
|
export interface IControlSelect {
|
|
16
16
|
code: string | null;
|
|
17
17
|
valueSets: IValueSet[];
|
|
18
|
+
isMultiSelect?: boolean;
|
|
19
|
+
multiSelectDelimiter?: string;
|
|
20
|
+
selectExclusiveOptions?: {
|
|
21
|
+
inputAble?: boolean;
|
|
22
|
+
};
|
|
18
23
|
}
|
|
19
24
|
export interface IControlCheckbox {
|
|
20
25
|
code: string | null;
|
|
@@ -57,6 +62,8 @@ export interface IControlBasic {
|
|
|
57
62
|
extension?: unknown;
|
|
58
63
|
indentation?: ControlIndentation;
|
|
59
64
|
rowFlex?: RowFlex;
|
|
65
|
+
preText?: string;
|
|
66
|
+
postText?: string;
|
|
60
67
|
}
|
|
61
68
|
export interface IControlStyle {
|
|
62
69
|
font?: string;
|
|
@@ -89,7 +96,7 @@ export interface IControlInitResult {
|
|
|
89
96
|
export interface IControlInstance {
|
|
90
97
|
setElement(element: IElement): void;
|
|
91
98
|
getElement(): IElement;
|
|
92
|
-
getValue(): IElement[];
|
|
99
|
+
getValue(context?: IControlContext): IElement[];
|
|
93
100
|
setValue(data: IElement[], context?: IControlContext, options?: IControlRuleOption): number;
|
|
94
101
|
keydown(evt: KeyboardEvent): number | null;
|
|
95
102
|
cut(): number;
|
|
@@ -105,6 +112,7 @@ export interface IControlRuleOption {
|
|
|
105
112
|
export interface IGetControlValueOption {
|
|
106
113
|
id?: string;
|
|
107
114
|
conceptId?: string;
|
|
115
|
+
areaId?: string;
|
|
108
116
|
}
|
|
109
117
|
export type IGetControlValueResult = (Omit<IControl, 'value'> & {
|
|
110
118
|
value: string | null;
|
|
@@ -115,17 +123,20 @@ export type IGetControlValueResult = (Omit<IControl, 'value'> & {
|
|
|
115
123
|
export interface ISetControlValueOption {
|
|
116
124
|
id?: string;
|
|
117
125
|
conceptId?: string;
|
|
126
|
+
areaId?: string;
|
|
118
127
|
value: string | IElement[];
|
|
119
128
|
}
|
|
120
129
|
export interface ISetControlExtensionOption {
|
|
121
130
|
id?: string;
|
|
122
131
|
conceptId?: string;
|
|
132
|
+
areaId?: string;
|
|
123
133
|
extension: unknown;
|
|
124
134
|
}
|
|
125
135
|
export type ISetControlHighlightOption = IControlHighlight[];
|
|
126
136
|
export type ISetControlProperties = {
|
|
127
137
|
id?: string;
|
|
128
138
|
conceptId?: string;
|
|
139
|
+
areaId?: string;
|
|
129
140
|
properties: Partial<Omit<IControl, 'value'>>;
|
|
130
141
|
};
|
|
131
142
|
export type IRepaintControlOption = Pick<IDrawOption, 'curIndex' | 'isCompute' | 'isSubmitHistory' | 'isSetCursor'>;
|
|
@@ -145,3 +156,11 @@ export interface ISetControlRowFlexOption {
|
|
|
145
156
|
availableWidth: number;
|
|
146
157
|
controlRealWidth: number;
|
|
147
158
|
}
|
|
159
|
+
export interface IControlChangeResult {
|
|
160
|
+
state: ControlState;
|
|
161
|
+
control: IControl;
|
|
162
|
+
controlId: string;
|
|
163
|
+
}
|
|
164
|
+
export interface IDestroyControlOption {
|
|
165
|
+
isEmitEvent?: boolean;
|
|
166
|
+
}
|
|
@@ -5,6 +5,7 @@ import { ListStyle, ListType } from '../dataset/enum/List';
|
|
|
5
5
|
import { RowFlex } from '../dataset/enum/Row';
|
|
6
6
|
import { TitleLevel } from '../dataset/enum/Title';
|
|
7
7
|
import { TableBorder } from '../dataset/enum/table/Table';
|
|
8
|
+
import { IArea } from './Area';
|
|
8
9
|
import { IBlock } from './Block';
|
|
9
10
|
import { ICheckbox } from './Checkbox';
|
|
10
11
|
import { IControl } from './Control';
|
|
@@ -56,6 +57,7 @@ export interface ITableAttr {
|
|
|
56
57
|
colgroup?: IColgroup[];
|
|
57
58
|
trList?: ITr[];
|
|
58
59
|
borderType?: TableBorder;
|
|
60
|
+
borderColor?: string;
|
|
59
61
|
}
|
|
60
62
|
export interface ITableElement {
|
|
61
63
|
tdId?: string;
|
|
@@ -106,7 +108,12 @@ export interface IImageElement {
|
|
|
106
108
|
export interface IBlockElement {
|
|
107
109
|
block?: IBlock;
|
|
108
110
|
}
|
|
109
|
-
export
|
|
111
|
+
export interface IAreaElement {
|
|
112
|
+
valueList?: IElement[];
|
|
113
|
+
areaId?: string;
|
|
114
|
+
area?: IArea;
|
|
115
|
+
}
|
|
116
|
+
export type IElement = IElementBasic & IElementStyle & IElementGroup & ITable & IHyperlinkElement & ISuperscriptSubscript & ISeparator & IControlElement & ICheckboxElement & IRadioElement & ILaTexElement & IDateElement & IImageElement & IBlockElement & ITitleElement & IListElement & IAreaElement;
|
|
110
117
|
export interface IElementMetrics {
|
|
111
118
|
width: number;
|
|
112
119
|
height: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EditorZone, ElementType, ListStyle, ListType, PageMode, TitleLevel } from '..';
|
|
2
2
|
import { RowFlex } from '../dataset/enum/Row';
|
|
3
|
-
import {
|
|
3
|
+
import { IControlChangeResult } from './Control';
|
|
4
4
|
import { IEditorResult } from './Editor';
|
|
5
5
|
import { IPositionContext } from './Position';
|
|
6
6
|
import { ITextDecoration } from './Text';
|
|
@@ -34,7 +34,7 @@ export type IPageSizeChange = (payload: number) => void;
|
|
|
34
34
|
export type IPageScaleChange = (payload: number) => void;
|
|
35
35
|
export type ISaved = (payload: IEditorResult) => void;
|
|
36
36
|
export type IContentChange = () => void;
|
|
37
|
-
export type IControlChange = (payload:
|
|
37
|
+
export type IControlChange = (payload: IControlChangeResult) => void;
|
|
38
38
|
export type IPageModeChange = (payload: PageMode) => void;
|
|
39
39
|
export type IZoneChange = (payload: EditorZone) => void;
|
|
40
40
|
export type IMouseEventChange = (evt: MouseEvent) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EditorZone } from '../dataset/enum/Editor';
|
|
2
|
-
import { IElement, IElementFillRect } from './Element';
|
|
2
|
+
import { IElement, IElementFillRect, IElementStyle } from './Element';
|
|
3
3
|
export interface IRange {
|
|
4
4
|
startIndex: number;
|
|
5
5
|
endIndex: number;
|
|
@@ -35,3 +35,4 @@ export interface IRangeParagraphInfo {
|
|
|
35
35
|
elementList: IElement[];
|
|
36
36
|
startIndex: number;
|
|
37
37
|
}
|
|
38
|
+
export type IRangeElementStyle = Pick<IElementStyle, 'bold' | 'color' | 'highlight' | 'font' | 'size' | 'italic' | 'underline' | 'strikeout'>;
|
|
@@ -14,6 +14,7 @@ interface IPickElementOption {
|
|
|
14
14
|
export declare function pickElementAttr(payload: IElement, option?: IPickElementOption): IElement;
|
|
15
15
|
interface IZipElementListOption {
|
|
16
16
|
extraPickAttrs?: Array<keyof IElement>;
|
|
17
|
+
isClassifyArea?: boolean;
|
|
17
18
|
}
|
|
18
19
|
export declare function zipElementList(payload: IElement[], options?: IZipElementListOption): IElement[];
|
|
19
20
|
export declare function convertTextAlignToRowFlex(node: HTMLElement): RowFlex;
|
|
@@ -22,3 +22,5 @@ export declare function findScrollContainer(element: HTMLElement): HTMLElement;
|
|
|
22
22
|
export declare function isArrayEqual(arr1: unknown[], arr2: unknown[]): boolean;
|
|
23
23
|
export declare function isObjectEqual(obj1: unknown, obj2: unknown): boolean;
|
|
24
24
|
export declare function isRectIntersect(rect1: IElementFillRect, rect2: IElementFillRect): boolean;
|
|
25
|
+
export declare function isNonValue(value: unknown): boolean;
|
|
26
|
+
export declare function normalizeLineBreak(text: string): string;
|