@hufe921/canvas-editor 1.0.4 → 1.0.6

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 (30) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/dist/assets/value-93HzxRrf.js.map +1 -0
  3. package/dist/canvas-editor.js +2660 -2097
  4. package/dist/canvas-editor.js.map +1 -1
  5. package/dist/canvas-editor.umd.cjs +38 -38
  6. package/dist/canvas-editor.umd.cjs.map +1 -1
  7. package/dist/src/editor/core/command/Command.d.ts +4 -0
  8. package/dist/src/editor/core/command/CommandAdapt.d.ts +4 -0
  9. package/dist/src/editor/core/draw/Draw.d.ts +14 -0
  10. package/dist/src/editor/core/draw/IncrementalRowComputer.d.ts +43 -0
  11. package/dist/src/editor/core/draw/interactive/Area.d.ts +12 -0
  12. package/dist/src/editor/core/draw/interactive/AreaTool.d.ts +18 -0
  13. package/dist/src/editor/core/draw/particle/date/DatePicker.d.ts +1 -0
  14. package/dist/src/editor/core/draw/particle/table/TableOperate.d.ts +2 -0
  15. package/dist/src/editor/core/event/GlobalEvent.d.ts +1 -0
  16. package/dist/src/editor/core/position/Position.d.ts +3 -2
  17. package/dist/src/editor/dataset/enum/Common.d.ts +4 -0
  18. package/dist/src/editor/index.d.ts +2 -2
  19. package/dist/src/editor/interface/Area.d.ts +8 -0
  20. package/dist/src/editor/interface/Checkbox.d.ts +3 -0
  21. package/dist/src/editor/interface/Control.d.ts +6 -1
  22. package/dist/src/editor/interface/Draw.d.ts +22 -1
  23. package/dist/src/editor/interface/Editor.d.ts +9 -0
  24. package/dist/src/editor/interface/Element.d.ts +2 -0
  25. package/dist/src/editor/interface/Listener.d.ts +2 -0
  26. package/dist/src/editor/interface/Position.d.ts +3 -0
  27. package/dist/src/editor/interface/Row.d.ts +25 -0
  28. package/dist/src/editor/interface/table/Td.d.ts +2 -0
  29. package/package.json +11 -10
  30. package/dist/assets/value-CLcLo2uw.js.map +0 -1
@@ -33,6 +33,8 @@ export declare class Command {
33
33
  executeList: CommandAdapt['list'];
34
34
  executeRowFlex: CommandAdapt['rowFlex'];
35
35
  executeRowMargin: CommandAdapt['rowMargin'];
36
+ executeSpacingBefore: CommandAdapt['spacingBefore'];
37
+ executeSpacingAfter: CommandAdapt['spacingAfter'];
36
38
  executeInsertTable: CommandAdapt['insertTable'];
37
39
  executeInsertTableTopRow: CommandAdapt['insertTableTopRow'];
38
40
  executeInsertTableBottomRow: CommandAdapt['insertTableBottomRow'];
@@ -49,6 +51,8 @@ export declare class Command {
49
51
  executeTableBorderType: CommandAdapt['tableBorderType'];
50
52
  executeTableBorderColor: CommandAdapt['tableBorderColor'];
51
53
  executeTableTdBorderType: CommandAdapt['tableTdBorderType'];
54
+ executeTableTdBorderColor: CommandAdapt['tableTdBorderColor'];
55
+ executeTableTdBorderWidth: CommandAdapt['tableTdBorderWidth'];
52
56
  executeTableTdSlashType: CommandAdapt['tableTdSlashType'];
53
57
  executeTableTdBackgroundColor: CommandAdapt['tableTdBackgroundColor'];
54
58
  executeTableAutoFitToContent: CommandAdapt['tableAutoFitToContent'];
@@ -75,6 +75,8 @@ export declare class CommandAdapt {
75
75
  list(listType: ListType | null, listStyle?: ListStyle): void;
76
76
  rowFlex(payload: RowFlex): void;
77
77
  rowMargin(payload: number): void;
78
+ spacingBefore(payload: number): void;
79
+ spacingAfter(payload: number): void;
78
80
  insertTable(row: number, col: number): void;
79
81
  insertTableTopRow(): void;
80
82
  insertTableBottomRow(): void;
@@ -91,6 +93,8 @@ export declare class CommandAdapt {
91
93
  tableBorderType(payload: TableBorder): void;
92
94
  tableBorderColor(payload: string): void;
93
95
  tableTdBorderType(payload: TdBorder): void;
96
+ tableTdBorderColor(payload: string): void;
97
+ tableTdBorderWidth(payload: number): void;
94
98
  tableTdSlashType(payload: TdSlash): void;
95
99
  tableTdBackgroundColor(payload: string): void;
96
100
  tableAutoFitToContent(): void;
@@ -5,6 +5,7 @@ import { IMarkElementListDeletedOption } from '../../interface/Trace';
5
5
  import { IRow } from '../../interface/Row';
6
6
  import { IColumnLayout, IColumnOption } from '../../interface/Column';
7
7
  import { ColumnManager } from './column/ColumnManager';
8
+ import { IncrementalRowComputer } from './IncrementalRowComputer';
8
9
  import { Cursor } from '../cursor/Cursor';
9
10
  import { CanvasEvent } from '../event/CanvasEvent';
10
11
  import { GlobalEvent } from '../event/GlobalEvent';
@@ -52,6 +53,7 @@ import { LineBreakParticle } from './particle/LineBreakParticle';
52
53
  import { ITd } from '../../interface/table/Td';
53
54
  import { TableOperate } from './particle/table/TableOperate';
54
55
  import { Area } from './interactive/Area';
56
+ import { AreaTool } from './interactive/AreaTool';
55
57
  import { Badge } from './frame/Badge';
56
58
  import { Graffiti } from './graffiti/Graffiti';
57
59
  import { Magnifier } from './interactive/Magnifier';
@@ -85,6 +87,7 @@ export declare class Draw {
85
87
  private spellcheck;
86
88
  private group;
87
89
  private area;
90
+ private areaTool;
88
91
  private underline;
89
92
  private strikeout;
90
93
  private highlight;
@@ -131,6 +134,9 @@ export declare class Draw {
131
134
  private LETTER_REG;
132
135
  private WORD_LIKE_REG;
133
136
  private rowList;
137
+ private rawRowList;
138
+ private incrementalRowComputer;
139
+ private isElementListTruncated;
134
140
  private pageRowList;
135
141
  private pageDirectionList;
136
142
  private painterStyle;
@@ -215,6 +221,7 @@ export declare class Draw {
215
221
  getSpellcheck(): Spellcheck;
216
222
  getGroup(): Group;
217
223
  getArea(): Area;
224
+ getAreaTool(): AreaTool;
218
225
  getBadge(): Badge;
219
226
  getMagnifier(): Magnifier;
220
227
  getHistoryManager(): HistoryManager;
@@ -232,12 +239,19 @@ export declare class Draw {
232
239
  getTableElementList(sourceElementList: IElement[]): IElement[];
233
240
  getElementList(): IElement[];
234
241
  getMainElementList(): IElement[];
242
+ getRawRowList(): IRow[];
243
+ getMainRowList(): IRow[];
244
+ getIncrementalRowComputer(): IncrementalRowComputer;
245
+ getIsElementListTruncated(): boolean;
246
+ getIsControlMinWidthPlaceholder(): boolean;
235
247
  getOriginalElementList(): IElement[];
236
248
  getOriginalMainElementList(): IElement[];
237
249
  getFooterElementList(): IElement[];
238
250
  getTd(): ITd | null;
239
251
  insertElementList(payload: IElement[], options?: IInsertElementListOption): void;
240
252
  appendElementList(elementList: IElement[], options?: IAppendElementListOption): void;
253
+ setElementProperty(elementList: IElement | IElement[], properties: Partial<IElement>): void;
254
+ deleteElementProperty(elementList: IElement | IElement[], keys: (keyof IElement)[]): void;
241
255
  spliceElementList(elementList: IElement[], start: number, deleteCount: number, items?: IElement[], options?: ISpliceElementListOption): void;
242
256
  getCanvasEvent(): CanvasEvent;
243
257
  getGlobalEvent(): GlobalEvent;
@@ -0,0 +1,43 @@
1
+ import type { IComputeRange, IComputeRowListPayload, IIncrementalRowListResult } from '../../interface/Draw';
2
+ import type { IElement } from '../../interface/Element';
3
+ import type { IRow, IRowComputeState } from '../../interface/Row';
4
+ import type { Draw } from './Draw';
5
+ /**
6
+ * 行级增量行计算器。
7
+ *
8
+ * 行边界是断行依赖链的重置点(行首 x 由容器状态决定),因此编辑只需从受影响行
9
+ * 断点续算,与某个旧行结构状态收敛即停(通常 1~3 行),其后旧行原样复用。
10
+ * y/pageNo 等位置状态不影响行内容,过期快照依然安全。
11
+ *
12
+ * 门控不满足时返回 null,调用方退回全量,行为与未开启时一致。
13
+ */
14
+ export declare class IncrementalRowComputer {
15
+ private draw;
16
+ private readonly snapshotMap;
17
+ private lastLayoutSignature;
18
+ private dirtyElementList;
19
+ private dirtyStartIndex;
20
+ private dirtyEndIndex;
21
+ private isLayoutDirty;
22
+ constructor(draw: Draw);
23
+ recordSnapshot(row: IRow, snapshot: IRowComputeState, firstElement?: IElement): void;
24
+ /**
25
+ * 记录主文档元素列表的一次修改区间(脏区间,增量续算提示)。
26
+ * splice/delete 助手自动记录;少数直接 splice 的场景需显式调用。
27
+ */
28
+ markRangeDirty(elementList: IElement[], start: number, deleteCount: number, insertCount: number): void;
29
+ markFullDirty(): void;
30
+ consumeDirtyRange(): IComputeRange | undefined;
31
+ findPageNoOfRow(row: IRow): number | undefined;
32
+ /**
33
+ * 尝试增量计算。成功返回合并后的行列表与首个变动行
34
+ * (拆分跨页表格前的原始行列表),失败返回 null(调用方走全量)。
35
+ */
36
+ tryCompute(range: IComputeRange | undefined, payload: IComputeRowListPayload): IIncrementalRowListResult | null;
37
+ observeLayout(): void;
38
+ private getLayoutSignature;
39
+ private _findRowIndexOfElement;
40
+ private _isComplexElement;
41
+ private _isStructuralEqual;
42
+ private static readonly MAX_CASCADE_ELEMENT;
43
+ }
@@ -1,6 +1,7 @@
1
1
  import { Draw } from '../Draw';
2
2
  import { IAreaInfo, IDeleteAreaOption, IGetAreaValueOption, IGetAreaValueResult, IInsertAreaOption, ILocationAreaOption, ISetAreaPropertiesOption, ISetAreaValueOption } from '../../../interface/Area';
3
3
  import { IRange } from '../../../interface/Range';
4
+ import { IRow } from '../../../interface/Row';
4
5
  import { IElementPosition } from '../../../interface/Element';
5
6
  export declare class Area {
6
7
  private draw;
@@ -17,8 +18,19 @@ export declare class Area {
17
18
  insertArea(payload: IInsertAreaOption): string | null;
18
19
  render(ctx: CanvasRenderingContext2D, pageNo: number): void;
19
20
  compute(): void;
21
+ /**
22
+ * 收集区域补高的跨页延续段:
23
+ * 结转标记在区域后续行时,起点 = 结转行内容顶部 - 本行全部偏移(即页内容区顶部);
24
+ * 结转标记在区域末行自身时(区域位于文档末尾),延续段位于下一空白页顶部
25
+ */
26
+ private computePaddingSegmentList;
20
27
  private computeAreaInfo;
21
28
  private computeTableAreaInfo;
29
+ /**
30
+ * 应用区域最小高度:按区域分组连续行累计内容高度,
31
+ * 不足 minHeight 时将差值补充到区域末行行高(区域顶部间距不计入内容高度)
32
+ */
33
+ applyMinHeight(rowList: IRow[]): void;
22
34
  getAreaValue(options?: IGetAreaValueOption): IGetAreaValueResult | null;
23
35
  getContextByAreaId(areaId: string, options?: ILocationAreaOption): {
24
36
  range: IRange;
@@ -0,0 +1,18 @@
1
+ import { Draw } from '../Draw';
2
+ export declare class AreaTool {
3
+ private readonly BORDER_VALUE;
4
+ private readonly MIN_AREA_HEIGHT;
5
+ private draw;
6
+ private canvas;
7
+ private options;
8
+ private container;
9
+ private toolBorder;
10
+ private anchorLine;
11
+ private mousedownY;
12
+ private lastAnchorKey;
13
+ constructor(draw: Draw);
14
+ dispose(): void;
15
+ render(): void;
16
+ private _mousedown;
17
+ private _mousemove;
18
+ }
@@ -59,6 +59,7 @@ export declare class DatePicker {
59
59
  private _bindEvent;
60
60
  private _setPosition;
61
61
  isInvalidDate(value: Date): boolean;
62
+ parseDate(value: string, format: string): Date | null;
62
63
  private _setValue;
63
64
  private _getDatePickerType;
64
65
  private _getLang;
@@ -26,6 +26,8 @@ export declare class TableOperate {
26
26
  tableBorderType(payload: TableBorder): void;
27
27
  tableBorderColor(payload: string): void;
28
28
  tableTdBorderType(payload: TdBorder): void;
29
+ tableTdBorderColor(payload: string): void;
30
+ tableTdBorderWidth(payload: number): void;
29
31
  tableTdSlashType(payload: TdSlash): void;
30
32
  tableTdBackgroundColor(payload: string): void;
31
33
  private _measureTdContentWidth;
@@ -8,6 +8,7 @@ export declare class GlobalEvent {
8
8
  private range;
9
9
  private previewer;
10
10
  private tableTool;
11
+ private areaTool;
11
12
  private hyperlinkParticle;
12
13
  private hintParticle;
13
14
  private control;
@@ -1,4 +1,4 @@
1
- import { IComputePageRowPositionPayload, IComputePageRowPositionResult, IComputeRowPositionPayload, IFloatPosition, IGetFloatPositionByXYPayload, ISetSurroundPositionPayload } from '../../interface/Position';
1
+ import { IComputePageRowPositionPayload, IComputePageRowPositionResult, IComputePositionListPayload, IComputeRowPositionPayload, IFloatPosition, IGetFloatPositionByXYPayload, ISetSurroundPositionPayload } from '../../interface/Position';
2
2
  import { IElement, IElementPosition } from '../../interface/Element';
3
3
  import { ITd } from '../../interface/table/Td';
4
4
  import { ICurrentPosition, IGetPositionByXYPayload, IPositionContext } from '../../interface/Position';
@@ -10,6 +10,7 @@ export declare class Position {
10
10
  private tablePagingPositionList;
11
11
  private tablePagingPositionMap;
12
12
  private floatPositionList;
13
+ private pagePositionCacheList;
13
14
  private draw;
14
15
  private eventBus;
15
16
  private options;
@@ -37,7 +38,7 @@ export declare class Position {
37
38
  };
38
39
  computePageRowPosition(payload: IComputePageRowPositionPayload): IComputePageRowPositionResult;
39
40
  private _offsetTdPositionByVerticalAlign;
40
- computePositionList(): void;
41
+ computePositionList(payload?: IComputePositionListPayload): void;
41
42
  computeRowPosition(payload: IComputeRowPositionPayload): IElementPosition[];
42
43
  setCursorPosition(position: IElementPosition | null): void;
43
44
  getCursorPosition(): IElementPosition | null;
@@ -28,3 +28,7 @@ export declare enum FlexDirection {
28
28
  ROW = "row",
29
29
  COLUMN = "column"
30
30
  }
31
+ export declare enum CheckboxMarkType {
32
+ CHECK = "check",
33
+ CROSS = "cross"
34
+ }
@@ -4,7 +4,7 @@ import { IElement } from './interface/Element';
4
4
  import { Command } from './core/command/Command';
5
5
  import { Listener } from './core/listener/Listener';
6
6
  import { RowFlex } from './dataset/enum/Row';
7
- import { FlexDirection, ImageDisplay, LocationPosition, SurroundPosition } from './dataset/enum/Common';
7
+ import { FlexDirection, CheckboxMarkType, ImageDisplay, LocationPosition, SurroundPosition } from './dataset/enum/Common';
8
8
  import { ElementType } from './dataset/enum/Element';
9
9
  import { Register } from './core/register/Register';
10
10
  import { IContextMenuContext, IRegisterContextMenu } from './interface/contextmenu/ContextMenu';
@@ -56,5 +56,5 @@ export default class Editor {
56
56
  }
57
57
  export { splitText, createDomFromElementList, getElementListByHTML, getTextFromElementList };
58
58
  export { EDITOR_COMPONENT, LETTER_CLASS, INTERNAL_CONTEXT_MENU_KEY, INTERNAL_SHORTCUT_KEY, EDITOR_CLIPBOARD };
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, SurroundPosition, 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, SurroundPosition, AreaMode, ControlState, FlexDirection, CheckboxMarkType, WatermarkType, WatermarkLayer };
60
60
  export type { IElement, IEditorData, IEditorOption, IEditorResult, IContextMenuContext, IRegisterContextMenu, IWatermark, INavigateInfo, IBlock, ILang, ICatalog, ICatalogItem, IRange, IRangeStyle, RangeRect, IBadge, IGetElementListByHTMLOption };
@@ -10,6 +10,7 @@ export interface IAreaBasic {
10
10
  }
11
11
  export interface IAreaStyle {
12
12
  top?: number;
13
+ minHeight?: number;
13
14
  borderColor?: string;
14
15
  backgroundColor?: string;
15
16
  }
@@ -17,6 +18,7 @@ export interface IAreaRule {
17
18
  mode?: AreaMode;
18
19
  hide?: boolean;
19
20
  deletable?: boolean;
21
+ resizable?: boolean;
20
22
  }
21
23
  export type IArea = IAreaBasic & IAreaStyle & IAreaRule;
22
24
  export interface IInsertAreaOption {
@@ -44,6 +46,11 @@ export interface IGetAreaValueResult {
44
46
  endPageNo: number;
45
47
  value: IElement[];
46
48
  }
49
+ export interface IAreaPaddingSegment {
50
+ pageNo: number;
51
+ y: number;
52
+ height: number;
53
+ }
47
54
  export interface IAreaInfo {
48
55
  id: string;
49
56
  area: IArea;
@@ -54,6 +61,7 @@ export interface IAreaInfo {
54
61
  td: ITd;
55
62
  tablePosition: IElementPosition;
56
63
  };
64
+ paddingSegmentList?: IAreaPaddingSegment[];
57
65
  }
58
66
  export interface ILocationAreaOption {
59
67
  position: LocationPosition;
@@ -1,8 +1,10 @@
1
+ import { CheckboxMarkType } from '../dataset/enum/Common';
1
2
  import { VerticalAlign } from '../dataset/enum/VerticalAlign';
2
3
  export interface ICheckbox {
3
4
  value: boolean | null;
4
5
  code?: string;
5
6
  disabled?: boolean;
7
+ markType?: CheckboxMarkType;
6
8
  }
7
9
  export interface ICheckboxOption {
8
10
  width?: number;
@@ -14,5 +16,6 @@ export interface ICheckboxOption {
14
16
  checkFillStyle?: string;
15
17
  checkStrokeStyle?: string;
16
18
  checkMarkColor?: string;
19
+ markType?: CheckboxMarkType;
17
20
  verticalAlign?: VerticalAlign;
18
21
  }
@@ -1,4 +1,4 @@
1
- import { FlexDirection, LocationPosition } from '../dataset/enum/Common';
1
+ import { CheckboxMarkType, FlexDirection, LocationPosition } from '../dataset/enum/Common';
2
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';
@@ -27,6 +27,7 @@ export interface IControlCheckbox {
27
27
  max?: number;
28
28
  flexDirection: FlexDirection;
29
29
  valueSets: IValueSet[];
30
+ markType?: CheckboxMarkType;
30
31
  }
31
32
  export interface IControlRadio {
32
33
  code: string | null;
@@ -77,6 +78,10 @@ export interface IControlBasic {
77
78
  cascade?: IControlCascadeRule[];
78
79
  validation?: IControlValidation;
79
80
  compute?: string;
81
+ activeBackgroundColor?: string;
82
+ disabledBackgroundColor?: string;
83
+ existValueBackgroundColor?: string;
84
+ noValueBackgroundColor?: string;
80
85
  }
81
86
  export interface IControlStyle {
82
87
  font?: string;
@@ -1,7 +1,7 @@
1
1
  import { ImageDisplay } from '../dataset/enum/Common';
2
2
  import { EditorMode, EditorZone } from '../dataset/enum/Editor';
3
3
  import { IElement, IElementPosition } from './Element';
4
- import { IRow } from './Row';
4
+ import { IRow, IRowComputeState, IRowElement } from './Row';
5
5
  export interface IDrawOption {
6
6
  curIndex?: number;
7
7
  isSetCursor?: boolean;
@@ -12,6 +12,10 @@ export interface IDrawOption {
12
12
  isSourceHistory?: boolean;
13
13
  isFirstRender?: boolean;
14
14
  }
15
+ export interface IComputeRange {
16
+ startIndex: number;
17
+ endIndex: number;
18
+ }
15
19
  export interface IForceUpdateOption {
16
20
  isSubmitHistory?: boolean;
17
21
  }
@@ -72,4 +76,21 @@ export interface IComputeRowListPayload {
72
76
  isPagingMode?: boolean;
73
77
  pageHeight?: number;
74
78
  surroundElementList?: IElement[];
79
+ /**
80
+ * 断点续算:从 state 对应的行首元素(startIndex)重新参与断行,
81
+ * 到与某个旧行状态收敛(converge 返回 true)或文档末尾即止,
82
+ * 收敛点之后的旧行对象可原样复用。
83
+ */
84
+ resume?: IComputeRowListResume;
85
+ }
86
+ export interface IComputeRowListResume {
87
+ startIndex: number;
88
+ state: IRowComputeState;
89
+ preRowLastElement?: IRowElement;
90
+ shouldAbort?: (element: IElement, index: number) => boolean;
91
+ converge?: (state: IRowComputeState, firstElement: IElement, startIndex: number) => boolean;
92
+ }
93
+ export interface IIncrementalRowListResult {
94
+ rowList: IRow[];
95
+ firstChangedRow: IRow;
75
96
  }
@@ -34,6 +34,14 @@ import { ITraceOption } from './Trace';
34
34
  import { IRulerOption } from './Ruler';
35
35
  import { IHintOption } from './Hint';
36
36
  import type { ISpellcheckOption } from './Spellcheck';
37
+ export interface ILabOption {
38
+ /**
39
+ * 行级增量行计算:编辑时仅从受影响行断点续算,区间外行复用。
40
+ * 复杂结构(表格/控件/浮动图/分栏/minWidth 控件占位等)自动退化全量。
41
+ * 默认:false
42
+ */
43
+ incrementalCompute?: boolean;
44
+ }
37
45
  export interface IEditorData {
38
46
  header?: IElement[];
39
47
  main: IElement[];
@@ -86,6 +94,7 @@ export interface IEditorOption {
86
94
  scrollContainerSelector?: string;
87
95
  pageOuterSelectionDisable?: boolean;
88
96
  wordBreak?: WordBreak;
97
+ lab?: ILabOption;
89
98
  table?: ITableOption;
90
99
  header?: IHeader;
91
100
  footer?: IFooter;
@@ -39,6 +39,8 @@ export interface IElementStyle {
39
39
  strikeout?: boolean;
40
40
  rowFlex?: RowFlex;
41
41
  rowMargin?: number;
42
+ spacingBefore?: number;
43
+ spacingAfter?: number;
42
44
  level?: TitleLevel;
43
45
  title?: ITitle;
44
46
  letterSpacing?: number;
@@ -24,6 +24,8 @@ export interface IRangeStyle {
24
24
  highlight: string | null;
25
25
  rowFlex: RowFlex | null;
26
26
  rowMargin: number;
27
+ spacingBefore: number;
28
+ spacingAfter: number;
27
29
  dashArray: number[];
28
30
  level: TitleLevel | null;
29
31
  listType: ListType | null;
@@ -88,6 +88,9 @@ export interface IComputePageRowPositionResult {
88
88
  y: number;
89
89
  index: number;
90
90
  }
91
+ export interface IComputePositionListPayload {
92
+ fromPageNo?: number;
93
+ }
91
94
  export interface IFloatPosition {
92
95
  pageNo: number;
93
96
  element: IElement;
@@ -1,6 +1,7 @@
1
1
  import { PaperDirection } from '../dataset/enum/Editor';
2
2
  import { RowFlex } from '../dataset/enum/Row';
3
3
  import { IElement, IElementMetrics, IElementPosition, ITableRowFragment } from './Element';
4
+ import { IMargin } from './Margin';
4
5
  import { ITd } from './table/Td';
5
6
  export type IRowElement = IElement & {
6
7
  metrics: IElementMetrics;
@@ -19,6 +20,15 @@ export interface IRow {
19
20
  listIndex?: number;
20
21
  offsetX?: number;
21
22
  offsetY?: number;
23
+ spacingAfter?: number;
24
+ areaPadding?: {
25
+ areaId: string;
26
+ height: number;
27
+ };
28
+ areaPaddingCarry?: {
29
+ areaId: string;
30
+ height: number;
31
+ };
22
32
  elementList: IRowElement[];
23
33
  isWidthNotEnough?: boolean;
24
34
  rowIndex: number;
@@ -31,3 +41,18 @@ export interface IRow {
31
41
  positionList: IElementPosition[];
32
42
  }[];
33
43
  }
44
+ export interface IRowComputeState {
45
+ rowIndex: number;
46
+ x: number;
47
+ y: number;
48
+ pageNo: number;
49
+ pageStartY: number;
50
+ direction: PaperDirection;
51
+ margins: IMargin;
52
+ innerWidth: number;
53
+ startX: number;
54
+ pageHeight: number;
55
+ column: number;
56
+ controlRealWidth: number;
57
+ listIndexMap: Map<string, number>;
58
+ }
@@ -25,6 +25,8 @@ export interface ITd {
25
25
  positionList?: IElementPosition[];
26
26
  verticalAlign?: VerticalAlign;
27
27
  backgroundColor?: string;
28
+ borderColor?: string;
29
+ borderWidth?: number;
28
30
  borderTypes?: TdBorder[];
29
31
  slashTypes?: TdSlash[];
30
32
  mainHeight?: number;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@hufe921/canvas-editor",
3
3
  "author": "Hufe",
4
4
  "license": "MIT",
5
- "version": "1.0.4",
5
+ "version": "1.0.6",
6
6
  "description": "A Canvas/SVG-based rich text editor",
7
7
  "publishConfig": {
8
8
  "registry": "https://registry.npmjs.org/",
@@ -45,32 +45,33 @@
45
45
  "docs:dev": "vitepress dev docs",
46
46
  "docs:build": "vitepress build docs",
47
47
  "docs:preview": "vitepress preview docs",
48
- "pre-release": "node scripts/pre-release.js"
48
+ "pre-release": "node scripts/pre-release.js",
49
+ "prepublishOnly": "npm run lib && npm run pre-release"
49
50
  },
50
51
  "devDependencies": {
51
52
  "@eslint/js": "^10.0.1",
52
53
  "@rollup/plugin-typescript": "^12.3.0",
53
54
  "@types/jsdom": "^28.0.3",
54
- "@types/node": "^24.13.6",
55
+ "@types/node": "^24.19.2",
55
56
  "@types/prismjs": "^1.26.6",
56
- "@typescript-eslint/eslint-plugin": "^8.70.1",
57
- "@typescript-eslint/parser": "^8.70.1",
57
+ "@typescript-eslint/eslint-plugin": "^8.71.2",
58
+ "@typescript-eslint/parser": "^8.71.2",
58
59
  "@vitest/coverage-v8": "^4.1.11",
59
60
  "cypress": "^15.21.1",
60
61
  "cypress-file-upload": "^5.0.8",
61
- "eslint": "^10.11.0",
62
- "globals": "^17.12.0",
62
+ "eslint": "^10.12.0",
63
+ "globals": "^17.13.0",
63
64
  "jsdom": "^29.1.1",
64
65
  "simple-git-hooks": "^2.14.0",
65
66
  "tslib": "^2.8.1",
66
67
  "typescript": "^6.0.3",
67
- "typescript-eslint": "^8.70.1",
68
- "vite": "^8.3.0",
68
+ "typescript-eslint": "^8.71.2",
69
+ "vite": "^8.3.4",
69
70
  "vite-plugin-css-injected-by-js": "^5.0.1",
70
71
  "vitepress": "^1.6.4",
71
72
  "vitest": "^4.1.11",
72
73
  "vitest-canvas-mock": "^1.2.0",
73
- "vue": "^3.5.43"
74
+ "vue": "^3.5.44"
74
75
  },
75
76
  "simple-git-hooks": {
76
77
  "pre-commit": "npm run lint && npm run type:check",