@hailin-zheng/editor-core 2.2.20 → 2.2.21

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.
@@ -50,6 +50,7 @@ export declare class DocEditor {
50
50
  private editInput;
51
51
  private scrollContainer;
52
52
  onKeyDownEvent: Subject<KeyboardEvent>;
53
+ private searchPanel;
53
54
  constructor(svgContainer: HTMLElement);
54
55
  private createCanvasContext;
55
56
  private renderRoot;
@@ -164,7 +165,7 @@ export declare class DocEditor {
164
165
  * @param evt
165
166
  */
166
167
  onContextMenu(evt: MouseEvent): void;
167
- resetViewer(type?: 'demand' | 'force' | undefined): void;
168
+ resetViewer(): void;
168
169
  /**
169
170
  * 缩放视图
170
171
  * @param scale
@@ -12,35 +12,163 @@ export declare class DocRule {
12
12
  private docCtx;
13
13
  private options;
14
14
  private ruleHeight;
15
+ private thumbWidth;
15
16
  private thumbX;
16
17
  private mouseDownPos;
17
- private indentThumbPoints;
18
- private hangThumbPoints;
19
18
  private mouseDownThumbType;
20
19
  viewOptions: ViewOptions;
21
20
  ss: SelectionState;
22
- private nodes;
23
21
  constructor(docCtx: EditorContext);
24
22
  destroy(): void;
25
23
  setRuleOptions(options: RuleOptions): void;
26
- private fillRectSvg;
27
- private drawIndentThumbSvg;
28
- private drawHangThumbSvg;
29
- private drawLineSvg;
30
- private drawTextSvg;
31
24
  refreshRuleSvg(): IVNodeRenderFunc;
32
- private canvasMousedown;
33
- private getMousePos;
34
- private canvasMousemove;
35
- private canvasMouseup;
36
- private pointInPoly;
37
- /**
38
- * 绘制
39
- */
40
- private drawRuleSvg;
25
+ getRuleSVG(): any;
41
26
  private getRuleMarksPos;
42
27
  private getCurrPara;
43
- private setParentMarksPosSvg;
44
- private drawCellMarkSvg;
28
+ private drawCellMark;
29
+ /**
30
+ * 绘制首行缩进thumb
31
+ * @returns
32
+ */
33
+ createTopThumb(): {
34
+ sel: string;
35
+ data: {
36
+ on: {
37
+ mousedown: (evt: any) => void;
38
+ };
39
+ style: {
40
+ left: string;
41
+ };
42
+ };
43
+ children: {
44
+ sel: string;
45
+ data: {};
46
+ children: {
47
+ sel: string;
48
+ data: {
49
+ ns: string;
50
+ attrs: {
51
+ width: number;
52
+ height: number;
53
+ viewBox: string;
54
+ fill: string;
55
+ "stroke-width": number;
56
+ };
57
+ };
58
+ children: ({
59
+ sel: string;
60
+ data: {
61
+ ns: string;
62
+ attrs: {
63
+ stroke: string;
64
+ fill: string;
65
+ };
66
+ };
67
+ children: {
68
+ sel: string;
69
+ data: {
70
+ ns: string;
71
+ attrs: {
72
+ d: string;
73
+ stroke: string;
74
+ };
75
+ };
76
+ }[];
77
+ } | {
78
+ sel: string;
79
+ data: {
80
+ ns: string;
81
+ attrs: {
82
+ stroke: string;
83
+ fill: string;
84
+ };
85
+ };
86
+ children: {
87
+ sel: string;
88
+ data: {
89
+ ns: string;
90
+ attrs: {
91
+ d: string;
92
+ fill: string;
93
+ "vector-effect": string;
94
+ };
95
+ };
96
+ }[];
97
+ })[];
98
+ }[];
99
+ }[];
100
+ };
101
+ /**
102
+ * 绘制悬挂缩进thumb
103
+ * @returns
104
+ */
105
+ createLeftThumb(): {
106
+ sel: string;
107
+ data: {
108
+ on: {
109
+ mousedown: (evt: MouseEvent) => void;
110
+ };
111
+ style: {
112
+ left: string;
113
+ };
114
+ };
115
+ children: {
116
+ sel: string;
117
+ data: {};
118
+ children: {
119
+ sel: string;
120
+ data: {
121
+ ns: string;
122
+ attrs: {
123
+ width: number;
124
+ height: number;
125
+ viewBox: string;
126
+ fill: string;
127
+ "stroke-width": number;
128
+ };
129
+ };
130
+ children: ({
131
+ sel: string;
132
+ data: {
133
+ ns: string;
134
+ attrs: {
135
+ stroke: string;
136
+ fill: string;
137
+ };
138
+ };
139
+ children: {
140
+ sel: string;
141
+ data: {
142
+ ns: string;
143
+ attrs: {
144
+ d: string;
145
+ stroke: string;
146
+ };
147
+ };
148
+ }[];
149
+ } | {
150
+ sel: string;
151
+ data: {
152
+ ns: string;
153
+ attrs: {
154
+ stroke: string;
155
+ fill: string;
156
+ };
157
+ };
158
+ children: {
159
+ sel: string;
160
+ data: {
161
+ ns: string;
162
+ attrs: {
163
+ d: string;
164
+ fill: string;
165
+ "vector-effect": string;
166
+ };
167
+ };
168
+ }[];
169
+ })[];
170
+ }[];
171
+ }[];
172
+ };
45
173
  }
46
174
  export {};
@@ -7,6 +7,7 @@ export declare class DynamicExecute {
7
7
  current?: Element;
8
8
  depItems?: Map<string, RefCtxValue>;
9
9
  constructor(doc: BranchElement, ss: SelectionState);
10
+ create(): DynamicExecute;
10
11
  setCurrentCtx(ele: Element, depItems: Map<string, RefCtxValue>): void;
11
12
  clearCurrentCtx(): void;
12
13
  cacheList: ReturnType<DocumentContext['getDataElementModelList']>;
@@ -1,13 +1,16 @@
1
1
  import { LeafRenderObject, RenderObject } from "../render-define";
2
2
  import { FillNullSpaceRenderObject, ParagraphElement, ParagraphRenderObject, TextGroupRenderObject } from "../impl";
3
- import { Element, InlineGroupElement, LeafElement, ViewOptions } from "../element-define";
3
+ import { Element, ICreateRenderData, InlineGroupElement, LeafElement, ViewOptions } from "../element-define";
4
4
  import { RenderContextType } from "../render-context";
5
5
  import { DynamicExecute } from "../code-interpreter/dynamic-execute";
6
+ import { EditorContext } from "../document-context";
6
7
  export declare class ParagraphMeasure {
7
- options: ViewOptions;
8
+ docCtx: EditorContext;
8
9
  renderCtx: RenderContextType;
9
10
  execute: DynamicExecute;
10
- constructor(options: ViewOptions, renderCtx: RenderContextType, execute: DynamicExecute);
11
+ options: ViewOptions;
12
+ createData: ICreateRenderData;
13
+ constructor(docCtx: EditorContext, renderCtx: RenderContextType, execute: DynamicExecute);
11
14
  /**
12
15
  * 段落排版:
13
16
  * 1.当前段落不存在项目符号,按照缩进和悬挂处理
@@ -321,7 +321,7 @@ export declare class DocumentChange {
321
321
  * 移除空行内标签
322
322
  * @param ele
323
323
  */
324
- removeEmtpyInlineBlock(ele: Element): void;
324
+ removeEmptyInlineBlock(ele: Element): void;
325
325
  /**
326
326
  * 插入Tab制表位
327
327
  */
@@ -33,7 +33,7 @@ export declare class EditorContext {
33
33
  * 编辑器文档刷新后回调(DOM渲染完成后回调)
34
34
  * @param cb
35
35
  */
36
- onNextView(cb?: (() => void)): void;
36
+ onNextView(cb?: VoidFunction): void;
37
37
  get document(): DocumentElement;
38
38
  set document(value: DocumentElement);
39
39
  clear(): void;
@@ -71,7 +71,6 @@ export declare class DocumentContext {
71
71
  includeChildren: boolean;
72
72
  }): Array<DataElementInlineGroup | DataElementLeaf>;
73
73
  getControlById(id: string): DataElementInlineGroup | DataElementLeaf;
74
- isDataEle(ele: Element): boolean;
75
74
  getControlByName(name: string): DataElementInlineGroup | DataElementLeaf;
76
75
  /**
77
76
  * 获取数据元值集合
@@ -126,6 +125,7 @@ interface DataEleBaseModel {
126
125
  id: string;
127
126
  name: string;
128
127
  fieldName: string;
128
+ caption: string;
129
129
  getValue: () => any;
130
130
  setValue: (val: any) => void;
131
131
  }
@@ -74,6 +74,7 @@ export declare abstract class Element<P extends object = any> {
74
74
  disposed: boolean;
75
75
  loaded: boolean;
76
76
  visibleExpr?: IParserExpress;
77
+ effectExpr?: IParserExpress;
77
78
  attribute?: ElementAttribute;
78
79
  private _parent;
79
80
  get parent(): BranchElement;
@@ -176,6 +177,7 @@ export interface SelectionContentRange {
176
177
  isFullSelected: boolean;
177
178
  startOffset: number;
178
179
  endOffset: number;
180
+ rangeColor?: string;
179
181
  selectedChildren: Array<SelectionContentRange>;
180
182
  }
181
183
  /**
@@ -285,8 +287,6 @@ export declare class ViewOptions {
285
287
  virtualViewMode: boolean;
286
288
  trackInsColor: string;
287
289
  trackDelColor: string;
288
- showLineRect: boolean;
289
- showCharRect: boolean;
290
290
  showTabChar: boolean;
291
291
  showSpaceChar: boolean;
292
292
  showLineBreak: boolean;
@@ -294,7 +294,6 @@ export declare class ViewOptions {
294
294
  devMode: boolean;
295
295
  showParaSymbol: boolean;
296
296
  showDebug: boolean;
297
- resourceMode: 'lazy' | 'immediate';
298
297
  secretBrowse: boolean;
299
298
  chineseLayout: boolean;
300
299
  enableTrackHistory: boolean;
@@ -341,7 +340,7 @@ export declare class ViewOptions {
341
340
  textRowLineMode: boolean;
342
341
  editUser: DocUser;
343
342
  trackChangePeriod: number;
344
- onChange: Subject<'demand' | 'force'>;
343
+ onChange: Subject<void>;
345
344
  printMode: 'normal' | 'continuation';
346
345
  enableSuggestions: boolean;
347
346
  constructor();
@@ -410,6 +409,7 @@ export interface ICreateRenderData {
410
409
  options: ViewOptions;
411
410
  renderCtx: RenderContextType;
412
411
  execute: DynamicExecute;
412
+ onNextView: (cb: VoidFunction) => void;
413
413
  }
414
414
  export interface FontBoundingBox {
415
415
  fontBoundingBoxAscent: number;
@@ -431,5 +431,6 @@ export interface IParserExpress {
431
431
  }
432
432
  export interface ElementAttribute {
433
433
  visibleExpr?: string;
434
+ effectExpr?: string;
434
435
  }
435
436
  export {};
@@ -86,7 +86,7 @@ export declare class CheckBoxProps extends INotifyPropertyChanged {
86
86
  getSerializeProps(viewOptions: ViewOptions): {
87
87
  size: number;
88
88
  isChecked: boolean;
89
- groupName: string | null;
89
+ groupName: string;
90
90
  };
91
91
  }
92
92
  export declare class RadioBoxProps extends INotifyPropertyChanged {
@@ -338,5 +338,6 @@ export declare class BodyPartProps extends INotifyPropertyChanged {
338
338
  export interface SelectionEffectObject {
339
339
  selectionEleSets: Map<Element, SelectionContentRange>;
340
340
  commRangeSets: Map<Element, SelectionContentRange>;
341
+ otherRangeSets: Map<Element, Array<SelectionContentRange>>;
341
342
  }
342
343
  export {};
@@ -8,7 +8,7 @@ export declare class ElementSerialize {
8
8
  */
9
9
  static serialize(element: Element, viewOptions: ViewOptions): SerializeProps | null;
10
10
  static serializeString(element: Element, options?: {
11
- all: boolean;
11
+ includeRunDel: boolean;
12
12
  }): string;
13
13
  static serializeObject(obj: object | undefined | null): any;
14
14
  /**
@@ -57,7 +57,7 @@ export declare abstract class DataElementInlineGroup<P extends DataEleBaseProps
57
57
  beginMeasure(data: IBeginMeasureData): void;
58
58
  private parserExpress;
59
59
  /**
60
- * 解析可见性表达式
60
+ * 解析表达式
61
61
  * @param ele
62
62
  * @param execute
63
63
  * @private
@@ -7,6 +7,7 @@ import { DocumentFooterElement } from "./doc-footer-impl";
7
7
  import { SelectionState } from "../../selection/document-selection";
8
8
  import { CommentElement } from "../comments/comment-element-impl";
9
9
  import { EditorContext } from "../../document-context";
10
+ import { Subject } from "../../infrastructure/event-subject";
10
11
  export declare class DocumentElement extends BlockContainerElement<DocumentProps> {
11
12
  viewOptions: ViewOptions;
12
13
  bodyElement: DocumentBodyElement;
@@ -46,6 +47,12 @@ export declare class DocumentElement extends BlockContainerElement<DocumentProps
46
47
  * 清除所有批注
47
48
  */
48
49
  clearAllComms(): void;
50
+ onRefreshEvent: Subject<void>;
51
+ /**
52
+ * 元素内容或者属性发生改变,需要根据当前节点所在的树路径,设置脏标记,同时触发渲染
53
+ * @param ele
54
+ */
55
+ invokeChange(ele: Element): void;
49
56
  }
50
57
  export declare class DocumentRenderObject extends BlockContainerRenderObject {
51
58
  constructor(ele: Element);
@@ -0,0 +1,31 @@
1
+ import { DocEditor } from 'src/med_editor/doc-editor';
2
+ import { TextGroupElement } from '../impl';
3
+ import { SelectionContentRange } from '../element-define';
4
+ export declare class SearchPanel {
5
+ private editor;
6
+ searchQuery: string;
7
+ currentIndex: number;
8
+ totalMatches: number;
9
+ searchResults: searchResult[];
10
+ searchRangeColor: string;
11
+ currentRangeColor: string;
12
+ inputRef: HTMLInputElement;
13
+ state: 'close' | 'open';
14
+ constructor(editor: DocEditor);
15
+ render(): import("snabbdom").VNode;
16
+ searchNext(): void;
17
+ searchPrevious(): void;
18
+ nagivateToShow(): void;
19
+ onKeydown(e: KeyboardEvent): void;
20
+ searchInDocument(e: KeyboardEvent): any[];
21
+ clear(): void;
22
+ destroy(): void;
23
+ findMatches(inputString: string, pattern: string): number[];
24
+ switchVisible(): void;
25
+ }
26
+ interface searchResult {
27
+ index: number;
28
+ ele: TextGroupElement;
29
+ range?: SelectionContentRange;
30
+ }
31
+ export {};
@@ -1,17 +1,21 @@
1
1
  import { SelectionState } from "./document-selection";
2
2
  import { Element, SelectionContentRange } from "../element-define";
3
+ import { SelectionEffectObject } from "../element-props";
3
4
  /**
4
5
  * 用于处理选区拖蓝
5
6
  */
6
- export declare class SelectionOverlays {
7
+ export declare class SelectionOverlays implements SelectionEffectObject {
7
8
  private selectionState;
8
9
  private selectionRange;
9
10
  selectionEleSets: Map<Element, SelectionContentRange>;
10
11
  commRangeSets: Map<Element, SelectionContentRange>;
12
+ otherRangeSets: Map<Element, SelectionContentRange[]>;
11
13
  constructor(selectionState: SelectionState);
12
14
  getSelectionTreeData(): void;
13
15
  private convertSelectRangeToSet;
14
16
  static addToSets(range: SelectionContentRange, set: Map<Element, SelectionContentRange>): void;
17
+ addToOtherRangeSets(range: SelectionContentRange): void;
18
+ clearOtherRangeSets(): void;
15
19
  /**
16
20
  * 添加到批注集合
17
21
  * @param range
@@ -71,6 +71,7 @@ export declare class CommonUtil {
71
71
  static btoa(str: string): string;
72
72
  static isEqual(a: any, b: any): boolean;
73
73
  static getValue(val: any, defaultValue: any): any;
74
+ static getKeyCombination(event: KeyboardEvent): string;
74
75
  }
75
76
  declare type AnyFunction = (...args: any[]) => any;
76
77
  export {};
@@ -285,12 +285,15 @@ export declare class ElementUtil {
285
285
  /**
286
286
  * 递归向前寻找最近的元素
287
287
  * @param currElement
288
- * @param inPara 是否在同一段落中寻找
289
- * @param forCursor 查找结果是否用于光标定位
290
288
  * @param viewOptions
291
289
  * @returns
292
290
  */
293
- static getRecursionPrevSiblingElement(currElement: Element | null, inPara: boolean | undefined, forCursor: boolean | undefined, viewOptions: ViewOptions): LeafElement | null;
291
+ static getRecursionPrevSiblingElement(currElement: Element | null, viewOptions: ViewOptions): CursorPositionInfo | null;
292
+ /**
293
+ * 递归元素里面向前寻找可以定位的元素
294
+ */
295
+ static getRecursionSiblingElementCursorPosition(ele: Element, viewOptions: ViewOptions, direction: 'left' | 'right'): CursorPositionInfo | null;
296
+ static getElementPositionCursor(ele: LeafElement, viewOptions: ViewOptions, direction: 'left' | 'right'): CursorPositionInfo | null;
294
297
  /**
295
298
  * 循环向前寻找可定位的数据元
296
299
  * @param currElement
@@ -299,7 +302,7 @@ export declare class ElementUtil {
299
302
  /**
300
303
  * 递归向后寻找最近的元素
301
304
  */
302
- static getRecursionNextSiblingElement(currElement: Element | null, inPara: boolean | undefined, forCursor: boolean | undefined, viewOptions: ViewOptions): LeafElement | null;
305
+ static getRecursionNextSiblingElement(currElement: Element | null, viewOptions: ViewOptions): CursorPositionInfo | null;
303
306
  /**
304
307
  * 获取行内最大渲染单元格高度,主要处理纵向合并单元格问题
305
308
  * @param row
@@ -379,10 +382,10 @@ export declare class ElementUtil {
379
382
  */
380
383
  static getDataElement(ele: Element): DataElementInlineGroup | null;
381
384
  /**
382
- * 向上查找类型为数据元的父级
383
- * @param ele
384
- * @returns
385
- */
385
+ * 向上查找类型为数据元的父级
386
+ * @param ele
387
+ * @returns
388
+ */
386
389
  static getDataGroupElement(ele: Element): DataElementGroupElement | null;
387
390
  static getOSPlatform(): 'Windows' | 'Mac' | 'Linux';
388
391
  static getCheckboxPath(x: number, y: number, width: number, height: number): Array<Position>;
@@ -413,5 +416,13 @@ export declare class ElementUtil {
413
416
  static getEleAttribute(ele: Element, attr: string): any;
414
417
  static removeEleAttribute(ele: Element, attr: string): void;
415
418
  static getMatchItems(item: Element, predicate: (item: Element) => boolean): Element<any>[];
419
+ static isDataEle(ele: Element): boolean;
420
+ }
421
+ /**
422
+ * 用于光标定位的信息
423
+ */
424
+ interface CursorPositionInfo {
425
+ ele: LeafElement;
426
+ offset: number;
416
427
  }
417
428
  export {};
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "author": "hailin-zheng",
5
5
  "private": false,
6
6
  "license": "ISC",
7
- "version": "2.2.20",
7
+ "version": "2.2.21",
8
8
  "scripts": {},
9
9
  "dependencies": {
10
10
  "moment": "^2.29.3",
@@ -16,4 +16,4 @@
16
16
  "snabbdom-to-html": "^7.1.0",
17
17
  "jsbarcode": "^3.11.5"
18
18
  }
19
- }
19
+ }