@hufe921/canvas-editor 0.9.48 → 0.9.50
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 +50 -0
- package/README.md +20 -8
- package/dist/canvas-editor.es.js +312 -41
- package/dist/canvas-editor.es.js.map +1 -1
- package/dist/canvas-editor.umd.js +29 -29
- package/dist/canvas-editor.umd.js.map +1 -1
- package/dist/src/editor/core/command/Command.d.ts +3 -0
- package/dist/src/editor/core/command/CommandAdapt.d.ts +5 -1
- package/dist/src/editor/core/draw/control/Control.d.ts +3 -1
- package/dist/src/editor/core/draw/control/checkbox/CheckboxControl.d.ts +2 -2
- package/dist/src/editor/core/draw/control/select/SelectControl.d.ts +3 -3
- package/dist/src/editor/core/draw/control/text/TextControl.d.ts +3 -2
- package/dist/src/editor/core/draw/frame/Background.d.ts +1 -0
- package/dist/src/editor/core/draw/particle/table/TableParticle.d.ts +1 -0
- package/dist/src/editor/core/event/CanvasEvent.d.ts +1 -0
- package/dist/src/editor/dataset/enum/table/Table.d.ts +4 -0
- package/dist/src/editor/index.d.ts +2 -2
- package/dist/src/editor/interface/Control.d.ts +16 -0
- package/dist/src/editor/interface/Editor.d.ts +1 -0
- package/dist/src/editor/interface/table/Td.d.ts +2 -1
- package/dist/src/editor/utils/index.d.ts +1 -1
- package/dist/src/editor/utils/ua.d.ts +1 -0
- package/package.json +1 -1
|
@@ -42,6 +42,7 @@ export declare class Command {
|
|
|
42
42
|
executeTableTdVerticalAlign: CommandAdapt['tableTdVerticalAlign'];
|
|
43
43
|
executeTableBorderType: CommandAdapt['tableBorderType'];
|
|
44
44
|
executeTableTdBorderType: CommandAdapt['tableTdBorderType'];
|
|
45
|
+
executeTableTdSlashType: CommandAdapt['tableTdSlashType'];
|
|
45
46
|
executeTableTdBackgroundColor: CommandAdapt['tableTdBackgroundColor'];
|
|
46
47
|
executeTableSelectAll: CommandAdapt['tableSelectAll'];
|
|
47
48
|
executeImage: CommandAdapt['image'];
|
|
@@ -79,6 +80,7 @@ export declare class Command {
|
|
|
79
80
|
executeSetGroup: CommandAdapt['setGroup'];
|
|
80
81
|
executeDeleteGroup: CommandAdapt['deleteGroup'];
|
|
81
82
|
executeLocationGroup: CommandAdapt['locationGroup'];
|
|
83
|
+
executeSetControlValue: CommandAdapt['setControlValue'];
|
|
82
84
|
getCatalog: CommandAdapt['getCatalog'];
|
|
83
85
|
getImage: CommandAdapt['getImage'];
|
|
84
86
|
getOptions: CommandAdapt['getOptions'];
|
|
@@ -94,5 +96,6 @@ export declare class Command {
|
|
|
94
96
|
getSearchNavigateInfo: CommandAdapt['getSearchNavigateInfo'];
|
|
95
97
|
getLocale: CommandAdapt['getLocale'];
|
|
96
98
|
getGroupIds: CommandAdapt['getGroupIds'];
|
|
99
|
+
getControlValue: CommandAdapt['getControlValue'];
|
|
97
100
|
constructor(adapt: CommandAdapt);
|
|
98
101
|
}
|
|
@@ -2,11 +2,12 @@ import { ImageDisplay } from '../../dataset/enum/Control';
|
|
|
2
2
|
import { EditorMode, PageMode, PaperDirection } from '../../dataset/enum/Editor';
|
|
3
3
|
import { ListStyle, ListType } from '../../dataset/enum/List';
|
|
4
4
|
import { RowFlex } from '../../dataset/enum/Row';
|
|
5
|
-
import { TableBorder, TdBorder } from '../../dataset/enum/table/Table';
|
|
5
|
+
import { TableBorder, TdBorder, TdSlash } from '../../dataset/enum/table/Table';
|
|
6
6
|
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, ISetControlOption } from '../../interface/Control';
|
|
10
11
|
import { IAppendElementListOption, IDrawImagePayload, IForceUpdateOption, IGetImageOption, IGetValueOption, IPainterOption } from '../../interface/Draw';
|
|
11
12
|
import { IEditorData, IEditorHTML, IEditorOption, IEditorResult, IEditorText } from '../../interface/Editor';
|
|
12
13
|
import { IElement } from '../../interface/Element';
|
|
@@ -70,6 +71,7 @@ export declare class CommandAdapt {
|
|
|
70
71
|
tableTdVerticalAlign(payload: VerticalAlign): void;
|
|
71
72
|
tableBorderType(payload: TableBorder): void;
|
|
72
73
|
tableTdBorderType(payload: TdBorder): void;
|
|
74
|
+
tableTdSlashType(payload: TdSlash): void;
|
|
73
75
|
tableTdBackgroundColor(payload: string): void;
|
|
74
76
|
tableSelectAll(): void;
|
|
75
77
|
hyperlink(payload: IElement): void;
|
|
@@ -123,4 +125,6 @@ export declare class CommandAdapt {
|
|
|
123
125
|
deleteGroup(groupId: string): void;
|
|
124
126
|
getGroupIds(): Promise<string[]>;
|
|
125
127
|
locationGroup(groupId: string): void;
|
|
128
|
+
getControlValue(payload: IGetControlValueOption): IGetControlValueResult | null;
|
|
129
|
+
setControlValue(payload: ISetControlOption): void;
|
|
126
130
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IControlInitOption, IControlInstance } from '../../../interface/Control';
|
|
1
|
+
import { IControlInitOption, IControlInstance, IGetControlValueOption, IGetControlValueResult, ISetControlOption } from '../../../interface/Control';
|
|
2
2
|
import { IEditorData } from '../../../interface/Editor';
|
|
3
3
|
import { IElement, IElementPosition } from '../../../interface/Element';
|
|
4
4
|
import { IRange } from '../../../interface/Range';
|
|
@@ -37,5 +37,7 @@ export declare class Control {
|
|
|
37
37
|
setValue(data: IElement[]): number;
|
|
38
38
|
keydown(evt: KeyboardEvent): number;
|
|
39
39
|
cut(): number;
|
|
40
|
+
getValueByConceptId(payload: IGetControlValueOption): IGetControlValueResult;
|
|
41
|
+
setValueByConceptId(payload: ISetControlOption): void;
|
|
40
42
|
}
|
|
41
43
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IControlInstance } from '../../../../interface/Control';
|
|
1
|
+
import { IControlContext, IControlInstance } from '../../../../interface/Control';
|
|
2
2
|
import { IElement } from '../../../../interface/Element';
|
|
3
3
|
import { Control } from '../Control';
|
|
4
4
|
export declare class CheckboxControl implements IControlInstance {
|
|
@@ -9,7 +9,7 @@ export declare class CheckboxControl implements IControlInstance {
|
|
|
9
9
|
getCode(): string | null;
|
|
10
10
|
getValue(): IElement[];
|
|
11
11
|
setValue(): number;
|
|
12
|
-
setSelect(): void;
|
|
12
|
+
setSelect(context?: IControlContext): void;
|
|
13
13
|
keydown(evt: KeyboardEvent): number;
|
|
14
14
|
cut(): number;
|
|
15
15
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IControlInstance } from '../../../../interface/Control';
|
|
1
|
+
import { IControlContext, IControlInstance } from '../../../../interface/Control';
|
|
2
2
|
import { IElement } from '../../../../interface/Element';
|
|
3
3
|
import { Control } from '../Control';
|
|
4
4
|
export declare class SelectControl implements IControlInstance {
|
|
@@ -13,8 +13,8 @@ export declare class SelectControl implements IControlInstance {
|
|
|
13
13
|
setValue(): number;
|
|
14
14
|
keydown(evt: KeyboardEvent): number;
|
|
15
15
|
cut(): number;
|
|
16
|
-
clearSelect(): number;
|
|
17
|
-
setSelect(code: string): void;
|
|
16
|
+
clearSelect(context?: IControlContext): number;
|
|
17
|
+
setSelect(code: string, context?: IControlContext): void;
|
|
18
18
|
private _createSelectPopupDom;
|
|
19
19
|
awake(): void;
|
|
20
20
|
destroy(): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IControlInstance } from '../../../../interface/Control';
|
|
1
|
+
import { IControlContext, IControlInstance } from '../../../../interface/Control';
|
|
2
2
|
import { IElement } from '../../../../interface/Element';
|
|
3
3
|
import { Control } from '../Control';
|
|
4
4
|
export declare class TextControl implements IControlInstance {
|
|
@@ -7,7 +7,8 @@ export declare class TextControl implements IControlInstance {
|
|
|
7
7
|
constructor(element: IElement, control: Control);
|
|
8
8
|
getElement(): IElement;
|
|
9
9
|
getValue(): IElement[];
|
|
10
|
-
setValue(data: IElement[]): number;
|
|
10
|
+
setValue(data: IElement[], context?: IControlContext): number;
|
|
11
|
+
clearValue(context?: IControlContext): number;
|
|
11
12
|
keydown(evt: KeyboardEvent): number;
|
|
12
13
|
cut(): number;
|
|
13
14
|
}
|
|
@@ -10,6 +10,7 @@ export declare class TableParticle {
|
|
|
10
10
|
getTrListGroupByCol(payload: ITr[]): ITr[];
|
|
11
11
|
getRangeRowCol(): ITd[][] | null;
|
|
12
12
|
private _drawOuterBorder;
|
|
13
|
+
private _drawSlash;
|
|
13
14
|
private _drawBorder;
|
|
14
15
|
private _drawBackgroundColor;
|
|
15
16
|
computeRowColInfo(element: IElement): void;
|
|
@@ -17,7 +17,7 @@ import { BlockType } from './dataset/enum/Block';
|
|
|
17
17
|
import { IBlock } from './interface/Block';
|
|
18
18
|
import { ILang } from './interface/i18n/I18n';
|
|
19
19
|
import { VerticalAlign } from './dataset/enum/VerticalAlign';
|
|
20
|
-
import { TableBorder, TdBorder } from './dataset/enum/table/Table';
|
|
20
|
+
import { TableBorder, TdBorder, TdSlash } from './dataset/enum/table/Table';
|
|
21
21
|
import { MaxHeightRatio, NumberType } from './dataset/enum/Common';
|
|
22
22
|
import { TitleLevel } from './dataset/enum/Title';
|
|
23
23
|
import { ListStyle, ListType } from './dataset/enum/List';
|
|
@@ -38,5 +38,5 @@ export default class Editor {
|
|
|
38
38
|
use: UsePlugin;
|
|
39
39
|
constructor(container: HTMLDivElement, data: IEditorData | IElement[], options?: IEditorOption);
|
|
40
40
|
}
|
|
41
|
-
export { EDITOR_COMPONENT, LETTER_CLASS, Editor, RowFlex, VerticalAlign, EditorZone, EditorMode, ElementType, ControlType, EditorComponent, PageMode, ImageDisplay, Command, KeyMap, BlockType, PaperDirection, TableBorder, TdBorder, MaxHeightRatio, NumberType, TitleLevel, ListType, ListStyle, WordBreak };
|
|
41
|
+
export { EDITOR_COMPONENT, LETTER_CLASS, Editor, RowFlex, VerticalAlign, EditorZone, EditorMode, ElementType, ControlType, EditorComponent, PageMode, ImageDisplay, Command, KeyMap, BlockType, PaperDirection, TableBorder, TdBorder, TdSlash, MaxHeightRatio, NumberType, TitleLevel, ListType, ListStyle, WordBreak };
|
|
42
42
|
export type { IElement, IEditorData, IEditorOption, IEditorResult, IContextMenuContext, IRegisterContextMenu, IWatermark, INavigateInfo, IBlock, ILang, ICatalog, ICatalogItem, IRangeStyle };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ControlType } from '../dataset/enum/Control';
|
|
2
2
|
import { ICheckbox } from './Checkbox';
|
|
3
3
|
import { IElement } from './Element';
|
|
4
|
+
import { IRange } from './Range';
|
|
4
5
|
export interface IValueSet {
|
|
5
6
|
value: string;
|
|
6
7
|
code: string;
|
|
@@ -50,3 +51,18 @@ export interface IControlInstance {
|
|
|
50
51
|
keydown(evt: KeyboardEvent): number;
|
|
51
52
|
cut(): number;
|
|
52
53
|
}
|
|
54
|
+
export interface IControlContext {
|
|
55
|
+
range?: IRange;
|
|
56
|
+
elementList?: IElement[];
|
|
57
|
+
}
|
|
58
|
+
export interface IGetControlValueOption {
|
|
59
|
+
conceptId: string;
|
|
60
|
+
}
|
|
61
|
+
export declare type IGetControlValueResult = {
|
|
62
|
+
value: string | null;
|
|
63
|
+
innerText: string | null;
|
|
64
|
+
}[];
|
|
65
|
+
export interface ISetControlOption {
|
|
66
|
+
conceptId: string;
|
|
67
|
+
value: string;
|
|
68
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VerticalAlign } from '../../dataset/enum/VerticalAlign';
|
|
2
|
-
import { TdBorder } from '../../dataset/enum/table/Table';
|
|
2
|
+
import { TdBorder, TdSlash } from '../../dataset/enum/table/Table';
|
|
3
3
|
import { IElement, IElementPosition } from '../Element';
|
|
4
4
|
import { IRow } from '../Row';
|
|
5
5
|
export interface ITd {
|
|
@@ -21,6 +21,7 @@ export interface ITd {
|
|
|
21
21
|
verticalAlign?: VerticalAlign;
|
|
22
22
|
backgroundColor?: string;
|
|
23
23
|
borderType?: TdBorder;
|
|
24
|
+
slashType?: TdSlash;
|
|
24
25
|
mainHeight?: number;
|
|
25
26
|
realHeight?: number;
|
|
26
27
|
realMinHeight?: number;
|
|
@@ -12,7 +12,7 @@ export declare function mergeObject<T>(source: T, target: T): T;
|
|
|
12
12
|
export declare function nextTick(fn: Function): void;
|
|
13
13
|
export declare function convertNumberToChinese(num: number): string;
|
|
14
14
|
export declare function cloneProperty<T>(properties: (keyof T)[], sourceElement: T, targetElement: T): void;
|
|
15
|
-
export declare function omitObject<T>(object: T,
|
|
15
|
+
export declare function omitObject<T>(object: T, omitKeys: (keyof T)[]): T;
|
|
16
16
|
export declare function convertStringToBase64(input: string): string;
|
|
17
17
|
export declare function findScrollContainer(element: HTMLElement): HTMLElement;
|
|
18
18
|
export declare function isArrayEqual(arr1: unknown[], arr2: unknown[]): boolean;
|