@hailin-zheng/editor-core 1.1.17 → 1.1.19

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.
@@ -48,7 +48,7 @@ export declare class DocumentChange {
48
48
  */
49
49
  newInputTrackChanges(data: InputData, startControl: LeafElement, startOffset: number): void;
50
50
  /**
51
- * 创建新的留痕块,并返回留痕块输入定位文本
51
+ * 创建新留痕块,并返回留痕块输入定位文本
52
52
  * @param startControl
53
53
  * @param startOffset
54
54
  * @param trackType
@@ -218,6 +218,7 @@ export declare class DocumentChange {
218
218
  static setTextStyle(ss: SelectionState, setterFunc: (text: TextGroupElement) => void): void;
219
219
  private static recursionSetRangeTextStyle;
220
220
  static setParaAlign(ss: SelectionState, setterFunc: (tp: ParagraphProps) => void): void;
221
+ static setParaStyle(ss: SelectionState, setterFunc: (tp: ParagraphProps) => void): void;
221
222
  /**
222
223
  * 复制
223
224
  * @param evt
@@ -151,7 +151,7 @@ export declare class DocumentEvent {
151
151
  * @param eventStage
152
152
  * @param docCtx
153
153
  */
154
- static invokeEvent(type: EventTypes, sourceElement: Element, event: ElementEvent, eventStage: EventStage, docCtx: EditorContext): ElementEvent | null;
154
+ static invokeEvent(type: EventTypes, sourceElement: Element, event: ElementEvent, eventStage: EventStage): ElementEvent | null;
155
155
  /**
156
156
  * 发布当前的点击信息
157
157
  */
@@ -63,6 +63,7 @@ export declare class SelectionState {
63
63
  cursorPos: Rect | null;
64
64
  enableTrackChanges: boolean;
65
65
  constructor();
66
+ destroy(): void;
66
67
  clear(): void;
67
68
  /**
68
69
  * 当前选区是否发生改变
@@ -357,4 +357,8 @@ export interface ICreateRenderData {
357
357
  options: ViewOptions;
358
358
  renderCtx: RenderContextType;
359
359
  }
360
+ export interface FontBoundingBox {
361
+ fontBoundingBoxAscent: number;
362
+ fontBoundingBoxDescent: number;
363
+ }
360
364
  export {};
@@ -3,7 +3,7 @@ import { LeafRenderObject, RenderObject } from "./render-define";
3
3
  import { EditorContext } from "./document-context";
4
4
  import { TrackRunTypeEnum } from "./impl/text/track-run-impl";
5
5
  export declare type EventStage = 'All' | 'Capture' | 'Bubbling';
6
- export declare type EventTypes = 'ElementMousedown' | 'ElementMousemove' | 'ElementClick' | 'ElementDblClick' | 'ElementMouseEnter' | 'ElementMouseLeave' | 'BackspaceKey' | 'DeleteKey' | 'ElementShown' | 'ElementContextMenu' | 'GotCursor' | 'LostCursor' | 'ElementKeyDown' | 'ElementDrop' | 'ElementTabKey' | 'GetTrackTips';
6
+ export declare type EventTypes = 'ElementMousedown' | 'ElementMousemove' | 'ElementClick' | 'ElementDblClick' | 'ElementMouseEnter' | 'ElementMouseLeave' | 'BackspaceKey' | 'DeleteKey' | 'ElementShown' | 'ElementContextMenu' | 'GotCursor' | 'LostCursor' | 'ElementKeyDown' | 'ElementDrop' | 'ElementTabKey' | 'GetTrackTips' | 'ElementInput';
7
7
  export declare type HitRegion = 'header' | 'body' | 'footer' | 'review';
8
8
  export interface HitEventInfo {
9
9
  relativeRect: Rect;
@@ -57,6 +57,9 @@ export declare class ContentMenuItem {
57
57
  */
58
58
  export declare class MouseElementEvent extends ElementEvent {
59
59
  }
60
+ export declare class InputElementEvent extends ElementEvent {
61
+ data: string;
62
+ }
60
63
  export declare class MousedownElementEvent extends ElementEvent {
61
64
  }
62
65
  export declare class KeyboradElementEvent extends ElementEvent {
@@ -79,6 +79,8 @@ export declare class CheckBoxProps extends INotifyPropertyChanged {
79
79
  size: number;
80
80
  isChecked: boolean;
81
81
  groupName: string | null;
82
+ trueChar: string;
83
+ falseChar: string;
82
84
  clone(dest: CheckBoxProps): CheckBoxProps;
83
85
  getSerializeProps(viewOptions: ViewOptions): {
84
86
  size: number;
@@ -163,7 +165,6 @@ export declare class DataEleBaseProps extends INotifyPropertyChanged {
163
165
  editable: boolean;
164
166
  deleteable: boolean;
165
167
  minLength: number;
166
- type: DataEleTypes;
167
168
  underline: boolean;
168
169
  expression: string;
169
170
  hidden: boolean;
@@ -219,13 +220,21 @@ export declare class CommProps extends INotifyPropertyChanged {
219
220
  markType: "start" | "end";
220
221
  };
221
222
  }
223
+ export declare const trueChar = "\u2713";
224
+ export declare const falseChar = "\u00D7";
222
225
  export declare class DataEleCheckProps extends DataEleBaseProps {
223
226
  constructor();
227
+ border: boolean;
224
228
  size: number;
225
229
  checked: boolean;
226
230
  checkedValue: string;
227
231
  groupName: string;
228
232
  multiSelect: boolean;
233
+ drawStateChar: boolean;
234
+ trueChar: string;
235
+ falseChar: string;
236
+ trueStateColor: string;
237
+ falseStateColor: string;
229
238
  clone(dest: DataEleCheckProps | null): DataEleCheckProps;
230
239
  getSerializeProps(options: ViewOptions): any;
231
240
  updateProps(props: DataEleCheckProps): void;
@@ -241,7 +250,6 @@ export declare class DataEleImageProps extends DataEleBaseProps {
241
250
  updateProps(props: DataEleImageProps): void;
242
251
  }
243
252
  export declare class DataEleDateProps extends DataEleBaseTextProps {
244
- constructor();
245
253
  minValue?: Date;
246
254
  maxValue?: Date;
247
255
  format?: string;
@@ -387,5 +387,6 @@ export declare class ElementUtil {
387
387
  * @returns
388
388
  */
389
389
  static getDataElement(ele: Element): DataElementInlineGroup | null;
390
+ static getOSPlatform(): 'Windows' | 'Mac' | 'Linux';
390
391
  }
391
392
  export {};
@@ -1,9 +1,10 @@
1
1
  import { TextProps } from "../../element-props";
2
2
  import { IRenderData, LeafRenderObject, RenderObject } from "../../render-define";
3
- import { LeafElement, ElementFactory, Element, SerializeProps, ViewOptions, ICreateRenderData } from "../../element-define";
3
+ import { LeafElement, ElementFactory, Element, SerializeProps, ViewOptions, ICreateRenderData, FontBoundingBox } from "../../element-define";
4
4
  import { TextUnits } from "../../render-context";
5
5
  export declare class TextGroupElement extends LeafElement<TextProps> {
6
6
  textMeasures: Array<TextUnits>;
7
+ fontBoundingBox: FontBoundingBox;
7
8
  isMeasure: boolean;
8
9
  constructor();
9
10
  set text(val: string);
@@ -35,17 +35,19 @@ export declare class ParagraphMeasure {
35
35
  private arrangeInlineItems;
36
36
  arrangeLeafElement(parentLine: MeasureLine, ele: LeafElement): void;
37
37
  arrangeLeafRender(parentLine: MeasureLine, render: LeafRenderObject): void;
38
- cutTextRender(render: TextGroupRenderObject, limitWidth: number, lineEmpty: boolean): ICutLineData;
38
+ cutTextRender(render: TextGroupRenderObject, limitWidth: number, lineEmpty: boolean, isCloseToBody: any): ICutLineData;
39
39
  /**
40
40
  * 处理前置标点,前置标点不能出现在末尾
41
41
  * @param render
42
42
  * @param i
43
+ * @param lineEmpty
43
44
  */
44
45
  private patchHandleLeadingPunctuation;
45
46
  /**
46
47
  * 处理后置标点,后置标点不能出现在行首
47
48
  * @param render
48
49
  * @param i
50
+ * @param inCloseBody
49
51
  * @param lineEmpty
50
52
  */
51
53
  private patchHandlePostPunctuation;
@@ -77,6 +79,7 @@ interface MeasureLine {
77
79
  applyNewLine(): void;
78
80
  applyNewPara(): void;
79
81
  parent: MeasureLine | null;
82
+ isCloseToBody: boolean;
80
83
  arrange(): void;
81
84
  }
82
85
  interface ICutLineData {
@@ -54,13 +54,23 @@ export declare class PaintContent {
54
54
  clear(): void;
55
55
  drawText(text: string, textProps: TextProps, x: number, y: number, width: number, height: number): void;
56
56
  fillCircular(x: number, y: number, r: number, color?: string): void;
57
- drawTextUnits(textGroupRender: TextGroupRenderObject, x: number, y: number): void;
57
+ drawTextUnits(textGroupRender: TextGroupRenderObject, x: number, y: number, baseLine: number): void;
58
+ drawText2(str: string, font: string, color: string, x: number, y: number, width: number, height: number): void;
58
59
  getParaLineHeight(textEle: TextGroupElement): number;
59
60
  measureText(text: string, textProps: TextProps): {
60
61
  width: number;
61
62
  height: number;
62
63
  };
63
- measureText2(text: string, font: {
64
+ measureTextMetrics(font: string, str?: string): {
65
+ fontBoundingBoxAscent: number;
66
+ fontBoundingBoxDescent: number;
67
+ width: number;
68
+ actualBoundingBoxAscent: number;
69
+ actualBoundingBoxDescent: number;
70
+ actualBoundingBoxLeft: number;
71
+ actualBoundingBoxRight: number;
72
+ };
73
+ measureTextWidth(text: string, font: {
64
74
  fontSize: number;
65
75
  fontName: string;
66
76
  }): number;
@@ -1,7 +1,7 @@
1
1
  import { ContentMenuItem } from './framework/element-event-define';
2
2
  import { ElementReader } from './framework/element-reader';
3
3
  import { SelectionState } from './framework/document-selection';
4
- import { BranchElement, Element, ICancelTokenFn, LeafElement, MarginProps, OrientType, PageLayoutMode, Position, Rect, TextAlign, ViewOptions } from './framework/element-define';
4
+ import { BranchElement, Element, ICancelTokenFn, LeafElement, MarginProps, OrientType, PageLayoutMode, Position, Rect, ViewOptions } from './framework/element-define';
5
5
  import { DataElementInlineGroup, DataElementLeaf, DocumentElement, ParagraphElement, TableCellElement, TableElement, TableRowElement } from './framework/impl';
6
6
  import { CellDiagonal, ParagraphNumberType, ParagraphProps, TextProps } from './framework/element-props';
7
7
  import { EditorContext } from './framework/document-context';
@@ -15,8 +15,7 @@ import { Menu } from "../controls/Menu";
15
15
  * 2.在多页模式下,文档最小宽度为单个文档宽度+合适的外边距
16
16
  */
17
17
  export declare class CanvasTextEditor extends AbsolutePanel {
18
- private editCanvas;
19
- private editInput;
18
+ private container;
20
19
  private contentCtx;
21
20
  viewOptions: ViewOptions;
22
21
  docCtx: EditorContext;
@@ -40,7 +39,11 @@ export declare class CanvasTextEditor extends AbsolutePanel {
40
39
  onScrollViewEvent: Subject<number>;
41
40
  onDocChangedEvent: Subject<void>;
42
41
  onBeforeRefreshDocument: Subject<void>;
43
- constructor(editCanvas: HTMLCanvasElement, editInput: HTMLInputElement);
42
+ private editCanvas;
43
+ private editInput;
44
+ constructor(container: string);
45
+ private createDocDOM;
46
+ private destroyDOM;
44
47
  /**
45
48
  * 设置标尺
46
49
  */
@@ -185,10 +188,10 @@ export declare class CanvasTextEditor extends AbsolutePanel {
185
188
  */
186
189
  enableFormatBrush(): ICancelTokenFn | null;
187
190
  /**
188
- * 设置段落对齐
189
- * @param align
191
+ * 设置段落样式
192
+ * @param newProps
190
193
  */
191
- switchParaAlign(align: TextAlign): void;
194
+ setParaStyle(newProps: Partial<ParagraphProps>): void;
192
195
  combineCell(): void;
193
196
  /**
194
197
  * 切换当前段落项目符号状态
@@ -381,7 +384,6 @@ export declare class CanvasTextEditor extends AbsolutePanel {
381
384
  * @param insertRowIndex
382
385
  */
383
386
  insertNewRow(tb: TableElement, insertRowIndex: number): TableRowElement;
384
- private generatorDoc;
385
387
  }
386
388
  export interface IReaderManager {
387
389
  }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "author": "hailin-zheng",
5
5
  "private": false,
6
6
  "license": "ISC",
7
- "version": "1.1.17",
7
+ "version": "1.1.19",
8
8
  "scripts": {},
9
9
  "dependencies": {
10
10
  "bwip-js": "^3.0.5",
@@ -30,6 +30,7 @@ export declare class TemperaturePoint extends NodeCore {
30
30
  private renderOral;
31
31
  }
32
32
  export declare class HeartRatePoint extends NodeCore {
33
+ value: string;
33
34
  constructor();
34
35
  renderOutline(renderCtx: ViewPaint): void;
35
36
  render(e: IRenderData): void;
@@ -6,6 +6,7 @@ export declare class TimelineControl extends AbsolutePanel {
6
6
  constructor();
7
7
  measureOverride(e: IMeasureEvent, availableSize: Size): Size;
8
8
  protected arrangeOverride(e: IArrangeEvent, finalSize: Size): Size;
9
+ rebuild(): void;
9
10
  }
10
11
  /**
11
12
  * 中间网格数据绘制区域
@@ -53,6 +54,7 @@ export declare class TimelineGridControl extends TimelineBaseControl {
53
54
  heartRateData: Array<HearRateTemperatureUnit>;
54
55
  temperatureTimeLineValueModel: Array<TimelineValueModel>;
55
56
  heartRateTimeLineValueModel: Array<TimelineValueModel>;
57
+ eventData: Array<TimeLineEventUnit>;
56
58
  private _isShowTemperature;
57
59
  private _isShowHeartRate;
58
60
  private mousePos;
@@ -66,6 +68,7 @@ export declare class TimelineGridControl extends TimelineBaseControl {
66
68
  private buildTemperature;
67
69
  private setExceededValueTip;
68
70
  private buildHearRate;
71
+ private buildStampUnit;
69
72
  }
70
73
  /**
71
74
  * 心率数值标尺控件
@@ -93,4 +96,11 @@ interface HearRateTemperatureUnit {
93
96
  date: Date;
94
97
  value: number;
95
98
  }
99
+ /**
100
+ * 用于图章号
101
+ */
102
+ export interface TimeLineEventUnit {
103
+ date: Date;
104
+ value: string;
105
+ }
96
106
  export {};
@@ -24,6 +24,7 @@ export declare const timelineConfig: {
24
24
  heartRatePointSize: number;
25
25
  temperatureModels: number[];
26
26
  heartRateModels: number[];
27
+ valueRuleCounts: number;
27
28
  /**
28
29
  * 时刻头部高度
29
30
  */