@hufe921/canvas-editor 0.9.78 → 0.9.80
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 +51 -0
- package/dist/canvas-editor.es.js +2431 -1725
- package/dist/canvas-editor.es.js.map +1 -1
- package/dist/canvas-editor.umd.js +36 -36
- package/dist/canvas-editor.umd.js.map +1 -1
- package/dist/src/editor/core/command/Command.d.ts +1 -0
- package/dist/src/editor/core/command/CommandAdapt.d.ts +1 -0
- package/dist/src/editor/core/draw/control/Control.d.ts +4 -1
- package/dist/src/editor/core/draw/control/date/DateControl.d.ts +24 -0
- package/dist/src/editor/core/draw/particle/date/DatePicker.d.ts +8 -7
- package/dist/src/editor/dataset/constant/Element.d.ts +1 -1
- package/dist/src/editor/dataset/enum/Control.d.ts +2 -1
- package/dist/src/editor/interface/Control.d.ts +13 -5
- package/dist/src/editor/interface/Draw.d.ts +1 -0
- package/dist/src/editor/interface/Element.d.ts +1 -0
- package/dist/src/editor/utils/element.d.ts +9 -2
- package/package.json +1 -1
|
@@ -89,6 +89,7 @@ export declare class Command {
|
|
|
89
89
|
executeSetControlProperties: CommandAdapt['setControlProperties'];
|
|
90
90
|
executeSetControlHighlight: CommandAdapt['setControlHighlight'];
|
|
91
91
|
executeUpdateOptions: CommandAdapt['updateOptions'];
|
|
92
|
+
executeInsertTitle: CommandAdapt['insertTitle'];
|
|
92
93
|
getCatalog: CommandAdapt['getCatalog'];
|
|
93
94
|
getImage: CommandAdapt['getImage'];
|
|
94
95
|
getOptions: CommandAdapt['getOptions'];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IControlContext, IControlHighlight, IControlInitOption, IControlInstance, IGetControlValueOption, IGetControlValueResult, IRepaintControlOption, ISetControlExtensionOption, ISetControlProperties, ISetControlValueOption } from '../../../interface/Control';
|
|
1
|
+
import { IControlContext, IControlHighlight, IControlInitOption, IControlInstance, IGetControlValueOption, IGetControlValueResult, IInitNextControlOption, INextControlContext, IRepaintControlOption, ISetControlExtensionOption, ISetControlProperties, 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';
|
|
@@ -51,5 +51,8 @@ export declare class Control {
|
|
|
51
51
|
getList(): IElement[];
|
|
52
52
|
recordBorderInfo(x: number, y: number, width: number, height: number): void;
|
|
53
53
|
drawBorder(ctx: CanvasRenderingContext2D): void;
|
|
54
|
+
getPreControlContext(): INextControlContext | null;
|
|
55
|
+
getNextControlContext(): INextControlContext | null;
|
|
56
|
+
initNextControl(option?: IInitNextControlOption): void;
|
|
54
57
|
}
|
|
55
58
|
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { IControlContext, IControlInstance, IControlRuleOption } from '../../../../interface/Control';
|
|
2
|
+
import { IElement } from '../../../../interface/Element';
|
|
3
|
+
import { Control } from '../Control';
|
|
4
|
+
export declare class DateControl implements IControlInstance {
|
|
5
|
+
private draw;
|
|
6
|
+
private element;
|
|
7
|
+
private control;
|
|
8
|
+
private isPopup;
|
|
9
|
+
private datePicker;
|
|
10
|
+
constructor(element: IElement, control: Control);
|
|
11
|
+
setElement(element: IElement): void;
|
|
12
|
+
getElement(): IElement;
|
|
13
|
+
getIsPopup(): boolean;
|
|
14
|
+
getValueRange(context?: IControlContext): [number, number] | null;
|
|
15
|
+
getValue(context?: IControlContext): IElement[];
|
|
16
|
+
setValue(data: IElement[], context?: IControlContext, options?: IControlRuleOption): number;
|
|
17
|
+
clearSelect(context?: IControlContext, options?: IControlRuleOption): number;
|
|
18
|
+
setSelect(date: string, context?: IControlContext, options?: IControlRuleOption): void;
|
|
19
|
+
keydown(evt: KeyboardEvent): number | null;
|
|
20
|
+
cut(): number;
|
|
21
|
+
awake(): void;
|
|
22
|
+
destroy(): void;
|
|
23
|
+
private _setDate;
|
|
24
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IElementPosition } from '../../../../interface/Element';
|
|
2
|
+
import { Draw } from '../../Draw';
|
|
2
3
|
export interface IDatePickerLang {
|
|
3
4
|
now: string;
|
|
4
5
|
confirm: string;
|
|
@@ -20,17 +21,15 @@ export interface IDatePickerLang {
|
|
|
20
21
|
second: string;
|
|
21
22
|
}
|
|
22
23
|
export interface IDatePickerOption {
|
|
23
|
-
mountDom?: HTMLElement;
|
|
24
24
|
onSubmit?: (date: string) => any;
|
|
25
|
-
getLang?: () => IDatePickerLang;
|
|
26
25
|
}
|
|
27
26
|
interface IRenderOption {
|
|
28
27
|
value: string;
|
|
29
|
-
element: IElement;
|
|
30
28
|
position: IElementPosition;
|
|
31
|
-
|
|
29
|
+
dateFormat?: string;
|
|
32
30
|
}
|
|
33
31
|
export declare class DatePicker {
|
|
32
|
+
private draw;
|
|
34
33
|
private options;
|
|
35
34
|
private now;
|
|
36
35
|
private dom;
|
|
@@ -38,13 +37,14 @@ export declare class DatePicker {
|
|
|
38
37
|
private isDatePicker;
|
|
39
38
|
private pickDate;
|
|
40
39
|
private lang;
|
|
41
|
-
constructor(options?: IDatePickerOption);
|
|
40
|
+
constructor(draw: Draw, options?: IDatePickerOption);
|
|
42
41
|
private _createDom;
|
|
43
42
|
private _bindEvent;
|
|
44
43
|
private _setPosition;
|
|
45
44
|
isInvalidDate(value: Date): boolean;
|
|
46
45
|
private _setValue;
|
|
47
|
-
private
|
|
46
|
+
private _getLang;
|
|
47
|
+
private _setLangChange;
|
|
48
48
|
private _update;
|
|
49
49
|
private _toggleDateTimePicker;
|
|
50
50
|
private _setDatePick;
|
|
@@ -60,5 +60,6 @@ export declare class DatePicker {
|
|
|
60
60
|
formatDate(date: Date, format?: string): string;
|
|
61
61
|
render(option: IRenderOption): void;
|
|
62
62
|
dispose(): void;
|
|
63
|
+
destroy(): void;
|
|
63
64
|
}
|
|
64
65
|
export {};
|
|
@@ -15,6 +15,6 @@ export declare const CONTROL_STYLE_ATTR: Array<keyof IControlStyle>;
|
|
|
15
15
|
export declare const EDITOR_ELEMENT_CONTEXT_ATTR: Array<keyof IElement>;
|
|
16
16
|
export declare const TEXTLIKE_ELEMENT_TYPE: ElementType[];
|
|
17
17
|
export declare const IMAGE_ELEMENT_TYPE: ElementType[];
|
|
18
|
-
export declare const
|
|
18
|
+
export declare const BLOCK_ELEMENT_TYPE: ElementType[];
|
|
19
19
|
export declare const INLINE_NODE_NAME: string[];
|
|
20
20
|
export declare const VIRTUAL_ELEMENT_TYPE: ElementType[];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ControlType, ControlIndentation } from '../dataset/enum/Control';
|
|
2
2
|
import { EditorZone } from '../dataset/enum/Editor';
|
|
3
|
-
import {
|
|
3
|
+
import { MoveDirection } from '../dataset/enum/Observer';
|
|
4
4
|
import { IDrawOption } from './Draw';
|
|
5
5
|
import { IElement } from './Element';
|
|
6
|
-
import {
|
|
6
|
+
import { IPositionContext } from './Position';
|
|
7
7
|
import { IRange } from './Range';
|
|
8
8
|
export interface IValueSet {
|
|
9
9
|
value: string;
|
|
@@ -18,12 +18,13 @@ export interface IControlCheckbox {
|
|
|
18
18
|
min?: number;
|
|
19
19
|
max?: number;
|
|
20
20
|
valueSets: IValueSet[];
|
|
21
|
-
checkbox?: ICheckbox;
|
|
22
21
|
}
|
|
23
22
|
export interface IControlRadio {
|
|
24
23
|
code: string | null;
|
|
25
24
|
valueSets: IValueSet[];
|
|
26
|
-
|
|
25
|
+
}
|
|
26
|
+
export interface IControlDate {
|
|
27
|
+
dateFormat?: string;
|
|
27
28
|
}
|
|
28
29
|
export interface IControlHighlightRule {
|
|
29
30
|
keyword: string;
|
|
@@ -59,7 +60,7 @@ export interface IControlStyle {
|
|
|
59
60
|
italic?: boolean;
|
|
60
61
|
strikeout?: boolean;
|
|
61
62
|
}
|
|
62
|
-
export type IControl = IControlBasic & IControlRule & Partial<IControlSelect> & Partial<IControlCheckbox> & Partial<IControlRadio> & Partial<
|
|
63
|
+
export type IControl = IControlBasic & IControlRule & Partial<IControlStyle> & Partial<IControlSelect> & Partial<IControlCheckbox> & Partial<IControlRadio> & Partial<IControlDate>;
|
|
63
64
|
export interface IControlOption {
|
|
64
65
|
placeholderColor?: string;
|
|
65
66
|
bracketColor?: string;
|
|
@@ -116,3 +117,10 @@ export type ISetControlProperties = {
|
|
|
116
117
|
properties: Partial<Omit<IControl, 'value'>>;
|
|
117
118
|
};
|
|
118
119
|
export type IRepaintControlOption = Pick<IDrawOption, 'curIndex' | 'isCompute' | 'isSubmitHistory'>;
|
|
120
|
+
export interface INextControlContext {
|
|
121
|
+
positionContext: IPositionContext;
|
|
122
|
+
nextIndex: number;
|
|
123
|
+
}
|
|
124
|
+
export interface IInitNextControlOption {
|
|
125
|
+
direction?: MoveDirection;
|
|
126
|
+
}
|
|
@@ -9,7 +9,9 @@ export declare function formatElementList(elementList: IElement[], options: IFor
|
|
|
9
9
|
export declare function isSameElementExceptValue(source: IElement, target: IElement): boolean;
|
|
10
10
|
export declare function pickElementAttr(payload: IElement): IElement;
|
|
11
11
|
export declare function zipElementList(payload: IElement[]): IElement[];
|
|
12
|
-
export declare function
|
|
12
|
+
export declare function convertTextAlignToRowFlex(node: HTMLElement): RowFlex;
|
|
13
|
+
export declare function convertRowFlexToTextAlign(rowFlex: RowFlex): RowFlex.LEFT | RowFlex.CENTER | RowFlex.RIGHT | RowFlex.JUSTIFY | "justify";
|
|
14
|
+
export declare function convertRowFlexToJustifyContent(rowFlex: RowFlex): "center" | "flex-start" | "flex-end" | "space-between";
|
|
13
15
|
export declare function isTextLikeElement(element: IElement): boolean;
|
|
14
16
|
export declare function getAnchorElement(elementList: IElement[], anchorIndex: number): IElement | null;
|
|
15
17
|
export interface IFormatElementContextOption {
|
|
@@ -18,6 +20,11 @@ export interface IFormatElementContextOption {
|
|
|
18
20
|
export declare function formatElementContext(sourceElementList: IElement[], formatElementList: IElement[], anchorIndex: number, options?: IFormatElementContextOption): void;
|
|
19
21
|
export declare function convertElementToDom(element: IElement, options: DeepRequired<IEditorOption>): HTMLElement;
|
|
20
22
|
export declare function splitListElement(elementList: IElement[]): Map<number, IElement[]>;
|
|
23
|
+
export interface IElementListGroupRowFlex {
|
|
24
|
+
rowFlex: RowFlex | null;
|
|
25
|
+
data: IElement[];
|
|
26
|
+
}
|
|
27
|
+
export declare function groupElementListByRowFlex(elementList: IElement[]): IElementListGroupRowFlex[];
|
|
21
28
|
export declare function createDomFromElementList(elementList: IElement[], options: DeepRequired<IEditorOption>): HTMLDivElement;
|
|
22
29
|
export declare function convertTextNodeToElement(textNode: Element | Node): IElement | null;
|
|
23
30
|
interface IGetElementListByHTMLOption {
|
|
@@ -26,5 +33,5 @@ interface IGetElementListByHTMLOption {
|
|
|
26
33
|
export declare function getElementListByHTML(htmlText: string, options: IGetElementListByHTMLOption): IElement[];
|
|
27
34
|
export declare function getTextFromElementList(elementList: IElement[]): string;
|
|
28
35
|
export declare function getSlimCloneElementList(elementList: IElement[]): IElement[];
|
|
29
|
-
export declare function
|
|
36
|
+
export declare function getIsBlockElement(element?: IElement): boolean;
|
|
30
37
|
export {};
|