@hufe921/canvas-editor 0.9.136 → 1.0.0

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 (61) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/README.md +11 -8
  3. package/dist/assets/catalog-B-cbxN0s.js.map +1 -1
  4. package/dist/assets/value-B0aX9J3d.js.map +1 -0
  5. package/dist/assets/wordCount-BWZRHbSB.js.map +1 -0
  6. package/dist/canvas-editor.js +5105 -2340
  7. package/dist/canvas-editor.js.map +1 -1
  8. package/dist/canvas-editor.umd.cjs +41 -37
  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 +12 -0
  15. package/dist/src/editor/core/command/CommandAdapt.d.ts +14 -2
  16. package/dist/src/editor/core/draw/Draw.d.ts +33 -0
  17. package/dist/src/editor/core/draw/column/ColumnManager.d.ts +14 -0
  18. package/dist/src/editor/core/draw/control/Control.d.ts +3 -0
  19. package/dist/src/editor/core/draw/interactive/Area.d.ts +2 -0
  20. package/dist/src/editor/core/draw/interactive/Search.d.ts +1 -0
  21. package/dist/src/editor/core/draw/particle/ListParticle.d.ts +10 -0
  22. package/dist/src/editor/core/draw/particle/TraceParticle.d.ts +40 -0
  23. package/dist/src/editor/core/draw/particle/table/TableOperate.d.ts +3 -0
  24. package/dist/src/editor/core/draw/particle/table/TablePaging.d.ts +13 -0
  25. package/dist/src/editor/core/draw/particle/table/TableParticle.d.ts +19 -2
  26. package/dist/src/editor/core/draw/particle/table/TableTool.d.ts +2 -0
  27. package/dist/src/editor/core/draw/ruler/Ruler.d.ts +43 -0
  28. package/dist/src/editor/core/macro/MacroManager.d.ts +25 -0
  29. package/dist/src/editor/core/position/Position.d.ts +9 -1
  30. package/dist/src/editor/core/validate/Validate.d.ts +19 -0
  31. package/dist/src/editor/dataset/constant/Column.d.ts +2 -0
  32. package/dist/src/editor/dataset/constant/ContextMenu.d.ts +2 -0
  33. package/dist/src/editor/dataset/constant/Element.d.ts +1 -0
  34. package/dist/src/editor/dataset/constant/Ruler.d.ts +2 -0
  35. package/dist/src/editor/dataset/constant/Trace.d.ts +2 -0
  36. package/dist/src/editor/dataset/enum/Editor.d.ts +2 -1
  37. package/dist/src/editor/dataset/enum/Macro.d.ts +4 -0
  38. package/dist/src/editor/dataset/enum/Trace.d.ts +4 -0
  39. package/dist/src/editor/index.d.ts +4 -1
  40. package/dist/src/editor/interface/Area.d.ts +6 -0
  41. package/dist/src/editor/interface/Column.d.ts +14 -0
  42. package/dist/src/editor/interface/Compare.d.ts +5 -0
  43. package/dist/src/editor/interface/Control.d.ts +46 -0
  44. package/dist/src/editor/interface/Draw.d.ts +1 -0
  45. package/dist/src/editor/interface/Editor.d.ts +7 -1
  46. package/dist/src/editor/interface/Element.d.ts +24 -3
  47. package/dist/src/editor/interface/Macro.d.ts +19 -0
  48. package/dist/src/editor/interface/Print.d.ts +6 -0
  49. package/dist/src/editor/interface/Row.d.ts +9 -1
  50. package/dist/src/editor/interface/Ruler.d.ts +4 -0
  51. package/dist/src/editor/interface/Trace.d.ts +11 -0
  52. package/dist/src/editor/interface/i18n/I18n.d.ts +4 -0
  53. package/dist/src/editor/interface/i18n/Trace.d.ts +7 -0
  54. package/dist/src/editor/interface/i18n/Validate.d.ts +15 -0
  55. package/dist/src/editor/utils/diff.d.ts +7 -0
  56. package/dist/src/editor/utils/element.d.ts +21 -2
  57. package/dist/src/editor/utils/print.d.ts +2 -1
  58. package/dist/src/editor/utils/table.d.ts +4 -0
  59. package/package.json +1 -1
  60. package/dist/assets/value-By4_Dx3W.js.map +0 -1
  61. package/dist/assets/wordCount-Osi0e4qK.js.map +0 -1
@@ -0,0 +1,2 @@
1
+ import { IColumnOption } from '../../interface/Column';
2
+ export declare const defaultColumnOption: Readonly<Required<IColumnOption>>;
@@ -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,7 @@ 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>;
7
8
  export declare const EDITOR_ELEMENT_PARAGRAPH_STYLE_ATTR: Array<keyof IElement>;
8
9
  export declare const EDITOR_ELEMENT_COPY_ATTR: Array<keyof IElement>;
9
10
  export declare const EDITOR_ELEMENT_ZIP_ATTR: Array<keyof IElement>;
@@ -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 };
@@ -3,6 +3,7 @@ import { LocationPosition } from '../dataset/enum/Common';
3
3
  import { IElement, IElementPosition } from './Element';
4
4
  import { IPlaceholder } from './Placeholder';
5
5
  import { IRange } from './Range';
6
+ import { ITd } from './table/Td';
6
7
  export interface IAreaBasic {
7
8
  extension?: unknown;
8
9
  placeholder?: IPlaceholder;
@@ -48,6 +49,11 @@ export interface IAreaInfo {
48
49
  area: IArea;
49
50
  elementList: IElement[];
50
51
  positionList: IElementPosition[];
52
+ sourceElementList: IElement[];
53
+ tableCell?: {
54
+ td: ITd;
55
+ tablePosition: IElementPosition;
56
+ };
51
57
  }
52
58
  export interface ILocationAreaOption {
53
59
  position: LocationPosition;
@@ -0,0 +1,14 @@
1
+ export interface IColumnOption {
2
+ count: number;
3
+ gap?: number;
4
+ separator?: boolean;
5
+ separatorColor?: string;
6
+ separatorWidth?: number;
7
+ }
8
+ export interface IColumnLayout {
9
+ count: number;
10
+ width: number;
11
+ gap: number;
12
+ separator: boolean;
13
+ offsets: number[];
14
+ }
@@ -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;
@@ -1,4 +1,5 @@
1
1
  import { EditorMode, PageMode, PaperDirection, RenderMode, WordBreak } from '../dataset/enum/Editor';
2
+ import { IColumnOption } from './Column';
2
3
  import { IBackgroundOption } from './Background';
3
4
  import { ICheckboxOption } from './Checkbox';
4
5
  import { IRadioOption } from './Radio';
@@ -29,6 +30,8 @@ import { IGraffitiData, IGraffitiOption } from './Graffiti';
29
30
  import { IWhiteSpaceOption } from './WhiteSpace';
30
31
  import { IMagnifierOption } from './Magnifier';
31
32
  import { IAccessibilityOption } from './Accessibility';
33
+ import { ITraceOption } from './Trace';
34
+ import { IRulerOption } from './Ruler';
32
35
  export interface IEditorData {
33
36
  header?: IElement[];
34
37
  main: IElement[];
@@ -108,6 +111,9 @@ export interface IEditorOption {
108
111
  list?: IListOption;
109
112
  magnifier?: IMagnifierOption;
110
113
  accessibility?: IAccessibilityOption;
114
+ column?: IColumnOption;
115
+ trace?: ITraceOption;
116
+ ruler?: IRulerOption;
111
117
  }
112
118
  export interface IEditorResult {
113
119
  version: string;
@@ -134,7 +140,7 @@ export interface IPrintModeRule {
134
140
  imagePreviewerDisabled?: boolean;
135
141
  backgroundDisabled?: boolean;
136
142
  filterEmptyControl?: boolean;
137
- filterHideElementRow?: boolean;
143
+ areaHideDisabled?: boolean;
138
144
  }
139
145
  export interface IReadonlyModeRule {
140
146
  imagePreviewerDisabled?: boolean;
@@ -1,6 +1,7 @@
1
1
  import { ImageDisplay } from '../dataset/enum/Common';
2
2
  import { ControlComponent } from '../dataset/enum/Control';
3
3
  import { ElementType } from '../dataset/enum/Element';
4
+ import { TraceType } from '../dataset/enum/Trace';
4
5
  import { ListStyle, ListType } from '../dataset/enum/List';
5
6
  import { RowFlex } from '../dataset/enum/Row';
6
7
  import { TitleLevel } from '../dataset/enum/Title';
@@ -14,6 +15,7 @@ import { IRadio } from './Radio';
14
15
  import { ITextDecoration } from './Text';
15
16
  import { ITitle } from './Title';
16
17
  import { IColgroup } from './table/Colgroup';
18
+ import { ITd } from './table/Td';
17
19
  import { ITr } from './table/Tr';
18
20
  export interface IElementBasic {
19
21
  id?: string;
@@ -46,6 +48,14 @@ export interface IElementRule {
46
48
  export interface IElementGroup {
47
49
  groupIds?: string[];
48
50
  }
51
+ export interface ITraceRecord {
52
+ type: TraceType;
53
+ author?: string;
54
+ timestamp?: number;
55
+ }
56
+ export interface IElementTrace {
57
+ trace?: ITraceRecord[];
58
+ }
49
59
  export interface ITitleElement {
50
60
  valueList?: IElement[];
51
61
  level?: TitleLevel;
@@ -58,6 +68,7 @@ export interface IListElement {
58
68
  listStyle?: ListStyle;
59
69
  listId?: string;
60
70
  listWrap?: boolean;
71
+ listLevel?: number;
61
72
  }
62
73
  export interface ITableAttr {
63
74
  colgroup?: IColgroup[];
@@ -76,8 +87,6 @@ export interface ITableElement {
76
87
  trId?: string;
77
88
  tableId?: string;
78
89
  conceptId?: string;
79
- pagingId?: string;
80
- pagingIndex?: number;
81
90
  }
82
91
  export type ITable = ITableAttr & ITableRule & ITableElement;
83
92
  export interface IHyperlinkElement {
@@ -166,7 +175,7 @@ export interface ILabelElement {
166
175
  padding?: IPadding;
167
176
  };
168
177
  }
169
- export type IElement = IElementBasic & IElementStyle & IElementRule & IElementGroup & ITable & IHyperlinkElement & ISuperscriptSubscript & ISeparator & IControlElement & ICheckboxElement & IRadioElement & ILaTexElement & IDateElement & IImageElement & IBlockElement & ITitleElement & IListElement & IAreaElement & ILabelElement;
178
+ export type IElement = IElementBasic & IElementStyle & IElementRule & IElementGroup & IElementTrace & ITable & IHyperlinkElement & ISuperscriptSubscript & ISeparator & IControlElement & ICheckboxElement & IRadioElement & ILaTexElement & IDateElement & IImageElement & IBlockElement & ITitleElement & IListElement & IAreaElement & ILabelElement;
170
179
  export interface IElementMetrics {
171
180
  width: number;
172
181
  height: number;
@@ -185,6 +194,8 @@ export interface IElementPosition {
185
194
  metrics: IElementMetrics;
186
195
  isFirstLetter: boolean;
187
196
  isLastLetter: boolean;
197
+ columnIndex?: number;
198
+ tableFragment?: ITableRowFragment;
188
199
  coordinate: {
189
200
  leftTop: number[];
190
201
  leftBottom: number[];
@@ -192,6 +203,16 @@ export interface IElementPosition {
192
203
  rightBottom: number[];
193
204
  };
194
205
  }
206
+ export interface ITableRowFragment {
207
+ startTrIndex: number;
208
+ endTrIndex: number;
209
+ skipHeight: number;
210
+ repeatHeight: number;
211
+ repeatTrIndexes?: number[];
212
+ startSplitTrOffset?: number;
213
+ endSplitTrHeight?: number;
214
+ carriedTds?: ITd[];
215
+ }
195
216
  export interface IElementFillRect {
196
217
  x: number;
197
218
  y: number;
@@ -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;
@@ -0,0 +1,6 @@
1
+ import type { IEditorData, IEditorOption } from './Editor';
2
+ export interface IPrintOption {
3
+ offscreen?: boolean;
4
+ data?: IEditorData;
5
+ options?: IEditorOption;
6
+ }
@@ -1,5 +1,6 @@
1
1
  import { RowFlex } from '../dataset/enum/Row';
2
- import { IElement, IElementMetrics } from './Element';
2
+ import { IElement, IElementMetrics, IElementPosition, ITableRowFragment } from './Element';
3
+ import { ITd } from './table/Td';
3
4
  export type IRowElement = IElement & {
4
5
  metrics: IElementMetrics;
5
6
  style: string;
@@ -20,4 +21,11 @@ export interface IRow {
20
21
  isWidthNotEnough?: boolean;
21
22
  rowIndex: number;
22
23
  isSurround?: boolean;
24
+ columnIndex?: number;
25
+ tableFragment?: ITableRowFragment;
26
+ fragmentPosition?: IElementPosition;
27
+ repeatTdPositionList?: {
28
+ td: ITd;
29
+ positionList: IElementPosition[];
30
+ }[];
23
31
  }
@@ -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
+ }
@@ -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 {};
@@ -1,9 +1,10 @@
1
1
  import { PaperDirection } from '../dataset/enum/Editor';
2
2
  import { IIframeInfo } from '../interface/Block';
3
- export interface IPrintOption {
3
+ interface IPrintOption {
4
4
  width: number;
5
5
  height: number;
6
6
  direction?: PaperDirection;
7
7
  iframeInfoList?: IIframeInfo[][];
8
8
  }
9
9
  export declare function print(base64List: string[], options: IPrintOption): Promise<void>;
10
+ export {};
@@ -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;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@hufe921/canvas-editor",
3
3
  "author": "Hufe",
4
4
  "license": "MIT",
5
- "version": "0.9.136",
5
+ "version": "1.0.0",
6
6
  "description": "A Canvas/SVG-based rich text editor",
7
7
  "publishConfig": {
8
8
  "registry": "https://registry.npmjs.org/",