@hufe921/canvas-editor 0.9.137 → 1.0.1

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.
Files changed (65) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/README.md +11 -8
  3. package/dist/assets/catalog-B-cbxN0s.js.map +1 -1
  4. package/dist/assets/value-CLcLo2uw.js.map +1 -0
  5. package/dist/assets/wordCount-BWZRHbSB.js.map +1 -0
  6. package/dist/canvas-editor.js +5783 -2872
  7. package/dist/canvas-editor.js.map +1 -1
  8. package/dist/canvas-editor.umd.cjs +54 -38
  9. package/dist/canvas-editor.umd.cjs.map +1 -1
  10. package/dist/src/editor/core/cascade/CascadeManager.d.ts +28 -0
  11. package/dist/src/editor/core/cascade/expression/evaluator.d.ts +14 -0
  12. package/dist/src/editor/core/cascade/expression/parser.d.ts +36 -0
  13. package/dist/src/editor/core/cascade/expression/tokenizer.d.ts +19 -0
  14. package/dist/src/editor/core/command/Command.d.ts +11 -0
  15. package/dist/src/editor/core/command/CommandAdapt.d.ts +10 -1
  16. package/dist/src/editor/core/draw/Draw.d.ts +54 -9
  17. package/dist/src/editor/core/draw/column/ColumnManager.d.ts +4 -3
  18. package/dist/src/editor/core/draw/control/Control.d.ts +4 -0
  19. package/dist/src/editor/core/draw/frame/Footer.d.ts +9 -7
  20. package/dist/src/editor/core/draw/frame/Header.d.ts +9 -7
  21. package/dist/src/editor/core/draw/frame/PageBorder.d.ts +1 -1
  22. package/dist/src/editor/core/draw/frame/Watermark.d.ts +1 -1
  23. package/dist/src/editor/core/draw/interactive/Search.d.ts +1 -0
  24. package/dist/src/editor/core/draw/particle/HintParticle.d.ts +23 -0
  25. package/dist/src/editor/core/draw/particle/ListParticle.d.ts +10 -0
  26. package/dist/src/editor/core/draw/particle/TraceParticle.d.ts +40 -0
  27. package/dist/src/editor/core/draw/particle/table/TableOperate.d.ts +3 -0
  28. package/dist/src/editor/core/draw/particle/table/TablePaging.d.ts +13 -0
  29. package/dist/src/editor/core/draw/particle/table/TableParticle.d.ts +19 -2
  30. package/dist/src/editor/core/draw/particle/table/TableTool.d.ts +2 -0
  31. package/dist/src/editor/core/draw/ruler/Ruler.d.ts +43 -0
  32. package/dist/src/editor/core/event/GlobalEvent.d.ts +1 -0
  33. package/dist/src/editor/core/macro/MacroManager.d.ts +25 -0
  34. package/dist/src/editor/core/position/Position.d.ts +8 -1
  35. package/dist/src/editor/core/validate/Validate.d.ts +19 -0
  36. package/dist/src/editor/dataset/constant/ContextMenu.d.ts +2 -0
  37. package/dist/src/editor/dataset/constant/Element.d.ts +2 -0
  38. package/dist/src/editor/dataset/constant/Hint.d.ts +2 -0
  39. package/dist/src/editor/dataset/constant/Ruler.d.ts +2 -0
  40. package/dist/src/editor/dataset/constant/Trace.d.ts +2 -0
  41. package/dist/src/editor/dataset/enum/Editor.d.ts +2 -1
  42. package/dist/src/editor/dataset/enum/Macro.d.ts +4 -0
  43. package/dist/src/editor/dataset/enum/Trace.d.ts +4 -0
  44. package/dist/src/editor/index.d.ts +4 -1
  45. package/dist/src/editor/interface/Compare.d.ts +5 -0
  46. package/dist/src/editor/interface/Control.d.ts +46 -0
  47. package/dist/src/editor/interface/Draw.d.ts +1 -0
  48. package/dist/src/editor/interface/Editor.d.ts +6 -1
  49. package/dist/src/editor/interface/Element.d.ts +28 -3
  50. package/dist/src/editor/interface/Hint.d.ts +7 -0
  51. package/dist/src/editor/interface/Macro.d.ts +19 -0
  52. package/dist/src/editor/interface/Row.d.ts +10 -1
  53. package/dist/src/editor/interface/Ruler.d.ts +4 -0
  54. package/dist/src/editor/interface/Trace.d.ts +11 -0
  55. package/dist/src/editor/interface/i18n/I18n.d.ts +4 -0
  56. package/dist/src/editor/interface/i18n/Trace.d.ts +7 -0
  57. package/dist/src/editor/interface/i18n/Validate.d.ts +15 -0
  58. package/dist/src/editor/interface/table/Td.d.ts +1 -0
  59. package/dist/src/editor/utils/diff.d.ts +7 -0
  60. package/dist/src/editor/utils/element.d.ts +21 -2
  61. package/dist/src/editor/utils/print.d.ts +1 -0
  62. package/dist/src/editor/utils/table.d.ts +4 -0
  63. package/package.json +9 -9
  64. package/dist/assets/value-DeIsXod0.js.map +0 -1
  65. package/dist/assets/wordCount-Osi0e4qK.js.map +0 -1
@@ -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
+ }
@@ -9,6 +9,7 @@ export declare class GlobalEvent {
9
9
  private previewer;
10
10
  private tableTool;
11
11
  private hyperlinkParticle;
12
+ private hintParticle;
12
13
  private control;
13
14
  private magnifier;
14
15
  private dateParticle;
@@ -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): import("../../interface/table/Td").ITd | null;
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
+ }
@@ -56,5 +56,7 @@ export declare const INTERNAL_CONTEXT_MENU_KEY: {
56
56
  DELETE_TABLE: string;
57
57
  MERGE_CELL: string;
58
58
  CANCEL_MERGE_CELL: string;
59
+ AUTO_FIT_TO_CONTENT: string;
60
+ AUTO_FIT_TO_PAGE: string;
59
61
  };
60
62
  };
@@ -4,6 +4,8 @@ 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>;
8
+ export declare const EDITOR_HINT_ATTR: Array<keyof IElement>;
7
9
  export declare const EDITOR_ELEMENT_PARAGRAPH_STYLE_ATTR: Array<keyof IElement>;
8
10
  export declare const EDITOR_ELEMENT_COPY_ATTR: Array<keyof IElement>;
9
11
  export declare const EDITOR_ELEMENT_ZIP_ATTR: Array<keyof IElement>;
@@ -0,0 +1,2 @@
1
+ import { IHintOption } from '../../interface/Hint';
2
+ export declare const defaultHintOption: Readonly<Required<IHintOption>>;
@@ -0,0 +1,2 @@
1
+ import { IRulerOption } from '../../interface/Ruler';
2
+ export declare const defaultRulerOption: Readonly<Required<IRulerOption>>;
@@ -0,0 +1,2 @@
1
+ import { ITraceOption } from '../../interface/Trace';
2
+ export declare const defaultTraceOption: Readonly<Required<ITraceOption>>;
@@ -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",
@@ -0,0 +1,4 @@
1
+ export declare enum MacroType {
2
+ RECORDED = "recorded",
3
+ SCRIPT = "script"
4
+ }
@@ -0,0 +1,4 @@
1
+ export declare enum TraceType {
2
+ INSERTED = "inserted",
3
+ DELETED = "deleted"
4
+ }
@@ -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 };
@@ -0,0 +1,5 @@
1
+ import { IElement } from './Element';
2
+ export interface IComparePayload {
3
+ oldData: IElement[];
4
+ newData?: IElement[];
5
+ }
@@ -56,6 +56,7 @@ export interface IControlRule {
56
56
  disabled?: boolean;
57
57
  pasteDisabled?: boolean;
58
58
  hide?: boolean;
59
+ required?: boolean;
59
60
  }
60
61
  export interface IControlBasic {
61
62
  type: ControlType;
@@ -73,6 +74,9 @@ export interface IControlBasic {
73
74
  rowFlex?: RowFlex;
74
75
  preText?: string;
75
76
  postText?: string;
77
+ cascade?: IControlCascadeRule[];
78
+ validation?: IControlValidation;
79
+ compute?: string;
76
80
  }
77
81
  export interface IControlStyle {
78
82
  font?: string;
@@ -94,6 +98,7 @@ export interface IControlOption {
94
98
  disabledBackgroundColor?: string;
95
99
  existValueBackgroundColor?: string;
96
100
  noValueBackgroundColor?: string;
101
+ errorBackgroundColor?: string;
97
102
  }
98
103
  export interface IControlInitOption {
99
104
  index: number;
@@ -196,3 +201,44 @@ export interface IRemoveControlOption {
196
201
  id?: string;
197
202
  conceptId?: string;
198
203
  }
204
+ export type CascadeTargetType = 'control' | 'title';
205
+ export interface ICascadeAction {
206
+ controlId?: string;
207
+ conceptId?: string;
208
+ targetType?: CascadeTargetType;
209
+ effects: {
210
+ hide?: boolean;
211
+ required?: boolean;
212
+ disabled?: boolean;
213
+ deletable?: boolean;
214
+ };
215
+ }
216
+ export interface IControlCascadeRule {
217
+ expression: string;
218
+ actions: ICascadeAction[];
219
+ elseActions?: ICascadeAction[];
220
+ }
221
+ export interface IControlValidation {
222
+ minLength?: number;
223
+ maxLength?: number;
224
+ pattern?: string;
225
+ min?: number;
226
+ max?: number;
227
+ integer?: boolean;
228
+ precision?: number;
229
+ minDate?: string;
230
+ maxDate?: string;
231
+ minChecked?: number;
232
+ maxChecked?: number;
233
+ message?: string;
234
+ }
235
+ export interface IValidateOption {
236
+ zone?: EditorZone;
237
+ errorBackgroundColor?: string;
238
+ }
239
+ export interface IControlValidateResult {
240
+ controlId: string;
241
+ conceptId?: string;
242
+ control: IControl;
243
+ errors: string[];
244
+ }
@@ -34,6 +34,7 @@ export interface IDrawRowPayload {
34
34
  zone?: EditorZone;
35
35
  isDrawLineBreak?: boolean;
36
36
  isDrawWhiteSpace?: boolean;
37
+ isDrawRange?: boolean;
37
38
  }
38
39
  export interface IDrawFloatPayload {
39
40
  pageNo: number;
@@ -30,6 +30,9 @@ import { IGraffitiData, IGraffitiOption } from './Graffiti';
30
30
  import { IWhiteSpaceOption } from './WhiteSpace';
31
31
  import { IMagnifierOption } from './Magnifier';
32
32
  import { IAccessibilityOption } from './Accessibility';
33
+ import { ITraceOption } from './Trace';
34
+ import { IRulerOption } from './Ruler';
35
+ import { IHintOption } from './Hint';
33
36
  export interface IEditorData {
34
37
  header?: IElement[];
35
38
  main: IElement[];
@@ -110,6 +113,9 @@ export interface IEditorOption {
110
113
  magnifier?: IMagnifierOption;
111
114
  accessibility?: IAccessibilityOption;
112
115
  column?: IColumnOption;
116
+ trace?: ITraceOption;
117
+ ruler?: IRulerOption;
118
+ hint?: IHintOption;
113
119
  }
114
120
  export interface IEditorResult {
115
121
  version: string;
@@ -136,7 +142,6 @@ export interface IPrintModeRule {
136
142
  imagePreviewerDisabled?: boolean;
137
143
  backgroundDisabled?: boolean;
138
144
  filterEmptyControl?: boolean;
139
- filterHideElementRow?: boolean;
140
145
  areaHideDisabled?: boolean;
141
146
  }
142
147
  export interface IReadonlyModeRule {
@@ -1,6 +1,8 @@
1
1
  import { ImageDisplay } from '../dataset/enum/Common';
2
2
  import { ControlComponent } from '../dataset/enum/Control';
3
+ import { PaperDirection } from '../dataset/enum/Editor';
3
4
  import { ElementType } from '../dataset/enum/Element';
5
+ import { TraceType } from '../dataset/enum/Trace';
4
6
  import { ListStyle, ListType } from '../dataset/enum/List';
5
7
  import { RowFlex } from '../dataset/enum/Row';
6
8
  import { TitleLevel } from '../dataset/enum/Title';
@@ -14,6 +16,7 @@ import { IRadio } from './Radio';
14
16
  import { ITextDecoration } from './Text';
15
17
  import { ITitle } from './Title';
16
18
  import { IColgroup } from './table/Colgroup';
19
+ import { ITd } from './table/Td';
17
20
  import { ITr } from './table/Tr';
18
21
  export interface IElementBasic {
19
22
  id?: string;
@@ -21,6 +24,7 @@ export interface IElementBasic {
21
24
  value: string;
22
25
  extension?: unknown;
23
26
  externalId?: string;
27
+ hint?: string;
24
28
  }
25
29
  export interface IElementStyle {
26
30
  font?: string;
@@ -46,6 +50,14 @@ export interface IElementRule {
46
50
  export interface IElementGroup {
47
51
  groupIds?: string[];
48
52
  }
53
+ export interface ITraceRecord {
54
+ type: TraceType;
55
+ author?: string;
56
+ timestamp?: number;
57
+ }
58
+ export interface IElementTrace {
59
+ trace?: ITraceRecord[];
60
+ }
49
61
  export interface ITitleElement {
50
62
  valueList?: IElement[];
51
63
  level?: TitleLevel;
@@ -58,6 +70,7 @@ export interface IListElement {
58
70
  listStyle?: ListStyle;
59
71
  listId?: string;
60
72
  listWrap?: boolean;
73
+ listLevel?: number;
61
74
  }
62
75
  export interface ITableAttr {
63
76
  colgroup?: IColgroup[];
@@ -76,8 +89,6 @@ export interface ITableElement {
76
89
  trId?: string;
77
90
  tableId?: string;
78
91
  conceptId?: string;
79
- pagingId?: string;
80
- pagingIndex?: number;
81
92
  }
82
93
  export type ITable = ITableAttr & ITableRule & ITableElement;
83
94
  export interface IHyperlinkElement {
@@ -166,7 +177,10 @@ export interface ILabelElement {
166
177
  padding?: IPadding;
167
178
  };
168
179
  }
169
- export type IElement = IElementBasic & IElementStyle & IElementRule & IElementGroup & ITable & IHyperlinkElement & ISuperscriptSubscript & ISeparator & IControlElement & ICheckboxElement & IRadioElement & ILaTexElement & IDateElement & IImageElement & IBlockElement & ITitleElement & IListElement & IAreaElement & ILabelElement;
180
+ export interface IPageBreakElement {
181
+ paperDirection?: PaperDirection;
182
+ }
183
+ export type IElement = IElementBasic & IElementStyle & IElementRule & IElementGroup & IElementTrace & ITable & IHyperlinkElement & ISuperscriptSubscript & ISeparator & IControlElement & ICheckboxElement & IRadioElement & ILaTexElement & IDateElement & IImageElement & IBlockElement & ITitleElement & IListElement & IAreaElement & ILabelElement & IPageBreakElement;
170
184
  export interface IElementMetrics {
171
185
  width: number;
172
186
  height: number;
@@ -186,6 +200,7 @@ export interface IElementPosition {
186
200
  isFirstLetter: boolean;
187
201
  isLastLetter: boolean;
188
202
  columnIndex?: number;
203
+ tableFragment?: ITableRowFragment;
189
204
  coordinate: {
190
205
  leftTop: number[];
191
206
  leftBottom: number[];
@@ -193,6 +208,16 @@ export interface IElementPosition {
193
208
  rightBottom: number[];
194
209
  };
195
210
  }
211
+ export interface ITableRowFragment {
212
+ startTrIndex: number;
213
+ endTrIndex: number;
214
+ skipHeight: number;
215
+ repeatHeight: number;
216
+ repeatTrIndexes?: number[];
217
+ startSplitTrOffset?: number;
218
+ endSplitTrHeight?: number;
219
+ carriedTds?: ITd[];
220
+ }
196
221
  export interface IElementFillRect {
197
222
  x: number;
198
223
  y: number;
@@ -0,0 +1,7 @@
1
+ export interface IHintOption {
2
+ disabled?: boolean;
3
+ backgroundColor?: string;
4
+ color?: string;
5
+ fontSize?: number;
6
+ maxWidth?: number;
7
+ }
@@ -0,0 +1,19 @@
1
+ import { MacroType } from '../dataset/enum/Macro';
2
+ export interface IMacroStep {
3
+ command: string;
4
+ args: unknown[];
5
+ }
6
+ export interface IRecordedMacro {
7
+ id: string;
8
+ name: string;
9
+ type: MacroType.RECORDED;
10
+ steps: IMacroStep[];
11
+ }
12
+ export type IMacroHandler = (...args: unknown[]) => void | Promise<void>;
13
+ export interface IScriptMacro {
14
+ id: string;
15
+ name: string;
16
+ type: MacroType.SCRIPT;
17
+ handler: IMacroHandler;
18
+ }
19
+ export type IMacro = IRecordedMacro | IScriptMacro;
@@ -1,5 +1,7 @@
1
+ import { PaperDirection } from '../dataset/enum/Editor';
1
2
  import { RowFlex } from '../dataset/enum/Row';
2
- import { IElement, IElementMetrics } from './Element';
3
+ import { IElement, IElementMetrics, IElementPosition, ITableRowFragment } from './Element';
4
+ import { ITd } from './table/Td';
3
5
  export type IRowElement = IElement & {
4
6
  metrics: IElementMetrics;
5
7
  style: string;
@@ -12,6 +14,7 @@ export interface IRow {
12
14
  rowFlex?: RowFlex;
13
15
  startIndex: number;
14
16
  isPageBreak?: boolean;
17
+ paperDirection?: PaperDirection;
15
18
  isList?: boolean;
16
19
  listIndex?: number;
17
20
  offsetX?: number;
@@ -21,4 +24,10 @@ export interface IRow {
21
24
  rowIndex: number;
22
25
  isSurround?: boolean;
23
26
  columnIndex?: number;
27
+ tableFragment?: ITableRowFragment;
28
+ fragmentPosition?: IElementPosition;
29
+ repeatTdPositionList?: {
30
+ td: ITd;
31
+ positionList: IElementPosition[];
32
+ }[];
24
33
  }
@@ -0,0 +1,4 @@
1
+ export interface IRulerOption {
2
+ disabled?: boolean;
3
+ height?: number;
4
+ }
@@ -0,0 +1,11 @@
1
+ export interface ITraceOption {
2
+ disabled?: boolean;
3
+ insertColor?: string;
4
+ deleteColor?: string;
5
+ author?: string;
6
+ lineWidth?: number;
7
+ }
8
+ export interface IMarkElementListDeletedOption {
9
+ isIgnoreDeletedRule?: boolean;
10
+ tdDeletable?: boolean;
11
+ }
@@ -1,8 +1,12 @@
1
1
  import { IDatePickerLang } from '../../core/draw/particle/date/DatePicker';
2
2
  import { IContextmenuLang } from '../contextmenu/ContextMenu';
3
3
  import { IAccessibilityLang } from './Accessibility';
4
+ import { ITraceLang } from './Trace';
5
+ import { IValidateLang } from './Validate';
4
6
  export interface ILang {
5
7
  contextmenu: IContextmenuLang;
6
8
  datePicker: IDatePickerLang;
7
9
  accessibility: IAccessibilityLang;
10
+ trace: ITraceLang;
11
+ validate: IValidateLang;
8
12
  }
@@ -0,0 +1,7 @@
1
+ export interface ITraceLang {
2
+ insert: string;
3
+ delete: string;
4
+ author: string;
5
+ time: string;
6
+ unknownAuthor: string;
7
+ }
@@ -0,0 +1,15 @@
1
+ export interface IValidateLang {
2
+ required: string;
3
+ minLength: string;
4
+ maxLength: string;
5
+ pattern: string;
6
+ invalidNumber: string;
7
+ min: string;
8
+ max: string;
9
+ integer: string;
10
+ precision: string;
11
+ minDate: string;
12
+ maxDate: string;
13
+ minChecked: string;
14
+ maxChecked: string;
15
+ }
@@ -32,4 +32,5 @@ export interface ITd {
32
32
  realMinHeight?: number;
33
33
  disabled?: boolean;
34
34
  deletable?: boolean;
35
+ hint?: string;
35
36
  }
@@ -0,0 +1,7 @@
1
+ import { IElement } from '../interface/Element';
2
+ export interface IDiffOp {
3
+ type: 'equal' | 'insert' | 'delete';
4
+ value: string;
5
+ }
6
+ export declare function diffText(oldText: string, newText: string): IDiffOp[];
7
+ export declare function compareElementList(oldList: IElement[], newList: IElement[]): IElement[];
@@ -3,6 +3,9 @@ import { RowFlex } from '../dataset/enum/Row';
3
3
  import { DeepRequired } from '../interface/Common';
4
4
  import { IEditorOption } from '../interface/Editor';
5
5
  import { IElement } from '../interface/Element';
6
+ export declare function isElementTraceDeleted(element: IElement): boolean;
7
+ export declare function getNonDeletedElementList(elementList: IElement[]): IElement[];
8
+ export declare function getNonTraceElementList(elementList: IElement[]): IElement[];
6
9
  export declare function unzipElementList(elementList: IElement[]): IElement[];
7
10
  interface IFormatElementListOption {
8
11
  isHandleFirstElement?: boolean;
@@ -19,6 +22,7 @@ interface IZipElementListOption {
19
22
  extraPickAttrs?: Array<keyof IElement>;
20
23
  isClassifyArea?: boolean;
21
24
  isClone?: boolean;
25
+ isListValue?: boolean;
22
26
  }
23
27
  export declare function zipElementList(payload: IElement[], options?: IZipElementListOption): IElement[];
24
28
  export declare function convertTextAlignToRowFlex(node: HTMLElement): RowFlex;
@@ -47,11 +51,26 @@ export interface IGetElementListByHTMLOption {
47
51
  innerWidth: number;
48
52
  }
49
53
  export declare function getElementListByHTML(htmlText: string, options: IGetElementListByHTMLOption): IElement[];
50
- export declare function getTextFromElementList(elementList: IElement[]): string;
54
+ export declare function getTextFromElementList(elementList: IElement[], options?: {
55
+ isClone?: boolean;
56
+ }): string;
51
57
  export declare function getSlimCloneElementList(elementList: IElement[]): IElement[];
52
58
  export declare function getIsBlockElement(element?: IElement): boolean;
53
59
  export declare function replaceHTMLElementTag(oldDom: HTMLElement, tagName: keyof HTMLElementTagNameMap): HTMLElement;
54
60
  export declare function pickSurroundElementList(elementList: IElement[]): IElement[];
55
61
  export declare function deleteSurroundElementList(elementList: IElement[], pageNo: number): void;
56
- export declare function getNonHideElementIndex(elementList: IElement[], index: number, position?: LocationPosition): number;
62
+ export declare function getNonHideElementIndex(elementList: IElement[], index: number, position?: LocationPosition, isHidden?: (element: IElement) => boolean): number;
63
+ /**
64
+ * 嵌套感知的边界步进:从 index 按方向移动一位。
65
+ * 若落点 controlId 与 ownerId 相同,返回落点;
66
+ * 若落点 controlId 不同(进入了内层控件段),持续同向步进直到回到 ownerId 或越界。
67
+ * 用于替换边界扫描循环里的 i++ / i--。
68
+ */
69
+ export declare function scanToOwner(elementList: IElement[], index: number, direction: 1 | -1, ownerId: string): number;
70
+ /**
71
+ * 查找位置所属的最外层控件 controlId。
72
+ * 通过向左扫找到当前控件的 PREFIX,递归检查 PREFIX 前一位是否仍在另一控件段内。
73
+ */
74
+ export declare function getOutermostOwner(elementList: IElement[], index: number): string | null;
75
+ export declare function visitElementTree(elementList: IElement[], visitor: (element: IElement) => void): void;
57
76
  export {};
@@ -4,6 +4,7 @@ interface IPrintOption {
4
4
  width: number;
5
5
  height: number;
6
6
  direction?: PaperDirection;
7
+ pageDirections?: PaperDirection[];
7
8
  iframeInfoList?: IIframeInfo[][];
8
9
  }
9
10
  export declare function print(base64List: string[], options: IPrintOption): Promise<void>;
@@ -0,0 +1,4 @@
1
+ import { IColgroup } from '../interface/table/Colgroup';
2
+ export declare function getColgroupWidth(colgroup: IColgroup[]): number;
3
+ export declare function shrinkColgroupToWidth(colgroup: IColgroup[], maxWidth: number, minWidth: number): void;
4
+ export declare function scaleColgroupToWidth(colgroup: IColgroup[], targetWidth: number): void;