@hailin-zheng/editor-core 1.0.3 → 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.
- package/package.json +6 -2
- package/dist/doc-ruler.d.ts +0 -51
- package/dist/doc-ruler.js +0 -313
- package/dist/doc-ruler.js.map +0 -1
- package/dist/framework/common-util.d.ts +0 -63
- package/dist/framework/common-util.js +0 -178
- package/dist/framework/common-util.js.map +0 -1
- package/dist/framework/document-change.d.ts +0 -265
- package/dist/framework/document-change.js +0 -1342
- package/dist/framework/document-change.js.map +0 -1
- package/dist/framework/document-combine.d.ts +0 -24
- package/dist/framework/document-combine.js +0 -40
- package/dist/framework/document-combine.js.map +0 -1
- package/dist/framework/document-comment.d.ts +0 -46
- package/dist/framework/document-comment.js +0 -148
- package/dist/framework/document-comment.js.map +0 -1
- package/dist/framework/document-context.d.ts +0 -149
- package/dist/framework/document-context.js +0 -330
- package/dist/framework/document-context.js.map +0 -1
- package/dist/framework/document-eval-func.d.ts +0 -18
- package/dist/framework/document-eval-func.js +0 -48
- package/dist/framework/document-eval-func.js.map +0 -1
- package/dist/framework/document-event.d.ts +0 -213
- package/dist/framework/document-event.js +0 -1054
- package/dist/framework/document-event.js.map +0 -1
- package/dist/framework/document-history.d.ts +0 -26
- package/dist/framework/document-history.js +0 -65
- package/dist/framework/document-history.js.map +0 -1
- package/dist/framework/document-images-loader.d.ts +0 -16
- package/dist/framework/document-images-loader.js +0 -66
- package/dist/framework/document-images-loader.js.map +0 -1
- package/dist/framework/document-input-cursor.d.ts +0 -78
- package/dist/framework/document-input-cursor.js +0 -239
- package/dist/framework/document-input-cursor.js.map +0 -1
- package/dist/framework/document-paint.d.ts +0 -34
- package/dist/framework/document-paint.js +0 -103
- package/dist/framework/document-paint.js.map +0 -1
- package/dist/framework/document-print-offscreen.d.ts +0 -38
- package/dist/framework/document-print-offscreen.js +0 -128
- package/dist/framework/document-print-offscreen.js.map +0 -1
- package/dist/framework/document-print.d.ts +0 -60
- package/dist/framework/document-print.js +0 -203
- package/dist/framework/document-print.js.map +0 -1
- package/dist/framework/document-segmenter.d.ts +0 -2
- package/dist/framework/document-segmenter.js +0 -106
- package/dist/framework/document-segmenter.js.map +0 -1
- package/dist/framework/document-selection.d.ts +0 -89
- package/dist/framework/document-selection.js +0 -358
- package/dist/framework/document-selection.js.map +0 -1
- package/dist/framework/document-template.d.ts +0 -4
- package/dist/framework/document-template.js +0 -20
- package/dist/framework/document-template.js.map +0 -1
- package/dist/framework/document-textline-mode.d.ts +0 -7
- package/dist/framework/document-textline-mode.js +0 -30
- package/dist/framework/document-textline-mode.js.map +0 -1
- package/dist/framework/element-define.d.ts +0 -319
- package/dist/framework/element-define.js +0 -579
- package/dist/framework/element-define.js.map +0 -1
- package/dist/framework/element-event-define.d.ts +0 -99
- package/dist/framework/element-event-define.js +0 -108
- package/dist/framework/element-event-define.js.map +0 -1
- package/dist/framework/element-measure.d.ts +0 -97
- package/dist/framework/element-measure.js +0 -551
- package/dist/framework/element-measure.js.map +0 -1
- package/dist/framework/element-paint.d.ts +0 -42
- package/dist/framework/element-paint.js +0 -170
- package/dist/framework/element-paint.js.map +0 -1
- package/dist/framework/element-props.d.ts +0 -301
- package/dist/framework/element-props.js +0 -809
- package/dist/framework/element-props.js.map +0 -1
- package/dist/framework/element-reader.d.ts +0 -19
- package/dist/framework/element-reader.js +0 -151
- package/dist/framework/element-reader.js.map +0 -1
- package/dist/framework/element-render-cut.d.ts +0 -55
- package/dist/framework/element-render-cut.js +0 -449
- package/dist/framework/element-render-cut.js.map +0 -1
- package/dist/framework/element-serialize.d.ts +0 -30
- package/dist/framework/element-serialize.js +0 -113
- package/dist/framework/element-serialize.js.map +0 -1
- package/dist/framework/element-util.d.ts +0 -369
- package/dist/framework/element-util.js +0 -1463
- package/dist/framework/element-util.js.map +0 -1
- package/dist/framework/impl/checkbox/checkbox-impl.d.ts +0 -24
- package/dist/framework/impl/checkbox/checkbox-impl.js +0 -64
- package/dist/framework/impl/checkbox/checkbox-impl.js.map +0 -1
- package/dist/framework/impl/comments/comment-content-impl.d.ts +0 -40
- package/dist/framework/impl/comments/comment-content-impl.js +0 -105
- package/dist/framework/impl/comments/comment-content-impl.js.map +0 -1
- package/dist/framework/impl/comments/comment-element-impl.d.ts +0 -21
- package/dist/framework/impl/comments/comment-element-impl.js +0 -62
- package/dist/framework/impl/comments/comment-element-impl.js.map +0 -1
- package/dist/framework/impl/comments/comments-container-impl.d.ts +0 -22
- package/dist/framework/impl/comments/comments-container-impl.js +0 -62
- package/dist/framework/impl/comments/comments-container-impl.js.map +0 -1
- package/dist/framework/impl/comments/comments-util.d.ts +0 -12
- package/dist/framework/impl/comments/comments-util.js +0 -67
- package/dist/framework/impl/comments/comments-util.js.map +0 -1
- package/dist/framework/impl/comments/validate-msg-impl.d.ts +0 -21
- package/dist/framework/impl/comments/validate-msg-impl.js +0 -83
- package/dist/framework/impl/comments/validate-msg-impl.js.map +0 -1
- package/dist/framework/impl/data-element/data-decorate-impl.d.ts +0 -30
- package/dist/framework/impl/data-element/data-decorate-impl.js +0 -91
- package/dist/framework/impl/data-element/data-decorate-impl.js.map +0 -1
- package/dist/framework/impl/data-element/data-element-barcode.d.ts +0 -31
- package/dist/framework/impl/data-element/data-element-barcode.js +0 -115
- package/dist/framework/impl/data-element/data-element-barcode.js.map +0 -1
- package/dist/framework/impl/data-element/data-element-base-impl.d.ts +0 -68
- package/dist/framework/impl/data-element/data-element-base-impl.js +0 -205
- package/dist/framework/impl/data-element/data-element-base-impl.js.map +0 -1
- package/dist/framework/impl/data-element/data-element-check-impl.d.ts +0 -35
- package/dist/framework/impl/data-element/data-element-check-impl.js +0 -133
- package/dist/framework/impl/data-element/data-element-check-impl.js.map +0 -1
- package/dist/framework/impl/data-element/data-element-date-impl.d.ts +0 -23
- package/dist/framework/impl/data-element/data-element-date-impl.js +0 -111
- package/dist/framework/impl/data-element/data-element-date-impl.js.map +0 -1
- package/dist/framework/impl/data-element/data-element-group-impl.d.ts +0 -23
- package/dist/framework/impl/data-element/data-element-group-impl.js +0 -130
- package/dist/framework/impl/data-element/data-element-group-impl.js.map +0 -1
- package/dist/framework/impl/data-element/data-element-image-impl.d.ts +0 -30
- package/dist/framework/impl/data-element/data-element-image-impl.js +0 -137
- package/dist/framework/impl/data-element/data-element-image-impl.js.map +0 -1
- package/dist/framework/impl/data-element/data-element-list-impl.d.ts +0 -22
- package/dist/framework/impl/data-element/data-element-list-impl.js +0 -131
- package/dist/framework/impl/data-element/data-element-list-impl.js.map +0 -1
- package/dist/framework/impl/data-element/data-element-text-impl.d.ts +0 -23
- package/dist/framework/impl/data-element/data-element-text-impl.js +0 -103
- package/dist/framework/impl/data-element/data-element-text-impl.js.map +0 -1
- package/dist/framework/impl/decorate/fill-null-space-imple.d.ts +0 -21
- package/dist/framework/impl/decorate/fill-null-space-imple.js +0 -43
- package/dist/framework/impl/decorate/fill-null-space-imple.js.map +0 -1
- package/dist/framework/impl/document/doc-body-impl.d.ts +0 -27
- package/dist/framework/impl/document/doc-body-impl.js +0 -79
- package/dist/framework/impl/document/doc-body-impl.js.map +0 -1
- package/dist/framework/impl/document/doc-body-part-impl.d.ts +0 -30
- package/dist/framework/impl/document/doc-body-part-impl.js +0 -94
- package/dist/framework/impl/document/doc-body-part-impl.js.map +0 -1
- package/dist/framework/impl/document/doc-container-impl.d.ts +0 -16
- package/dist/framework/impl/document/doc-container-impl.js +0 -21
- package/dist/framework/impl/document/doc-container-impl.js.map +0 -1
- package/dist/framework/impl/document/doc-footer-impl.d.ts +0 -26
- package/dist/framework/impl/document/doc-footer-impl.js +0 -77
- package/dist/framework/impl/document/doc-footer-impl.js.map +0 -1
- package/dist/framework/impl/document/doc-header-impl.d.ts +0 -26
- package/dist/framework/impl/document/doc-header-impl.js +0 -83
- package/dist/framework/impl/document/doc-header-impl.js.map +0 -1
- package/dist/framework/impl/document/doc-impl.d.ts +0 -61
- package/dist/framework/impl/document/doc-impl.js +0 -209
- package/dist/framework/impl/document/doc-impl.js.map +0 -1
- package/dist/framework/impl/media-formula/menstrual-history.d.ts +0 -35
- package/dist/framework/impl/media-formula/menstrual-history.js +0 -153
- package/dist/framework/impl/media-formula/menstrual-history.js.map +0 -1
- package/dist/framework/impl/paragraph/p-impl.d.ts +0 -45
- package/dist/framework/impl/paragraph/p-impl.js +0 -156
- package/dist/framework/impl/paragraph/p-impl.js.map +0 -1
- package/dist/framework/impl/picture/image-impl.d.ts +0 -31
- package/dist/framework/impl/picture/image-impl.js +0 -124
- package/dist/framework/impl/picture/image-impl.js.map +0 -1
- package/dist/framework/impl/radio/radio-impl.d.ts +0 -22
- package/dist/framework/impl/radio/radio-impl.js +0 -72
- package/dist/framework/impl/radio/radio-impl.js.map +0 -1
- package/dist/framework/impl/symbol/br-symbol-impl.d.ts +0 -22
- package/dist/framework/impl/symbol/br-symbol-impl.js +0 -54
- package/dist/framework/impl/symbol/br-symbol-impl.js.map +0 -1
- package/dist/framework/impl/symbol/p-symbol-impl.d.ts +0 -19
- package/dist/framework/impl/symbol/p-symbol-impl.js +0 -54
- package/dist/framework/impl/symbol/p-symbol-impl.js.map +0 -1
- package/dist/framework/impl/table/table-cell-impl.d.ts +0 -37
- package/dist/framework/impl/table/table-cell-impl.js +0 -145
- package/dist/framework/impl/table/table-cell-impl.js.map +0 -1
- package/dist/framework/impl/table/table-impl.d.ts +0 -55
- package/dist/framework/impl/table/table-impl.js +0 -363
- package/dist/framework/impl/table/table-impl.js.map +0 -1
- package/dist/framework/impl/table/table-row-impl.d.ts +0 -26
- package/dist/framework/impl/table/table-row-impl.js +0 -75
- package/dist/framework/impl/table/table-row-impl.js.map +0 -1
- package/dist/framework/impl/table/table-split-cell-patch.d.ts +0 -20
- package/dist/framework/impl/table/table-split-cell-patch.js +0 -89
- package/dist/framework/impl/table/table-split-cell-patch.js.map +0 -1
- package/dist/framework/impl/table/table-split-cell.d.ts +0 -90
- package/dist/framework/impl/table/table-split-cell.js +0 -464
- package/dist/framework/impl/table/table-split-cell.js.map +0 -1
- package/dist/framework/impl/table/table-util.d.ts +0 -150
- package/dist/framework/impl/table/table-util.js +0 -678
- package/dist/framework/impl/table/table-util.js.map +0 -1
- package/dist/framework/impl/text/text-impl.d.ts +0 -32
- package/dist/framework/impl/text/text-impl.js +0 -149
- package/dist/framework/impl/text/text-impl.js.map +0 -1
- package/dist/framework/impl/text/track-run-impl.d.ts +0 -27
- package/dist/framework/impl/text/track-run-impl.js +0 -112
- package/dist/framework/impl/text/track-run-impl.js.map +0 -1
- package/dist/framework/notify.d.ts +0 -13
- package/dist/framework/notify.js +0 -116
- package/dist/framework/notify.js.map +0 -1
- package/dist/framework/range-util.d.ts +0 -40
- package/dist/framework/range-util.js +0 -312
- package/dist/framework/range-util.js.map +0 -1
- package/dist/framework/render-context.d.ts +0 -91
- package/dist/framework/render-context.js +0 -384
- package/dist/framework/render-context.js.map +0 -1
- package/dist/framework/render-define.d.ts +0 -109
- package/dist/framework/render-define.js +0 -195
- package/dist/framework/render-define.js.map +0 -1
- package/dist/framework/selection-overlays.d.ts +0 -30
- package/dist/framework/selection-overlays.js +0 -124
- package/dist/framework/selection-overlays.js.map +0 -1
- package/dist/texteditor.d.ts +0 -318
- package/dist/texteditor.js +0 -913
- package/dist/texteditor.js.map +0 -1
- package/dist/util/subject.d.ts +0 -34
- package/dist/util/subject.js +0 -88
- package/dist/util/subject.js.map +0 -1
- package/dist/util/table-bind.d.ts +0 -5
- package/dist/util/table-bind.js +0 -6
- package/dist/util/table-bind.js.map +0 -1
- package/src/med_editor/doc-ruler.ts +0 -340
- package/src/med_editor/framework/common-util.ts +0 -200
- package/src/med_editor/framework/document-change.ts +0 -1392
- package/src/med_editor/framework/document-combine.ts +0 -44
- package/src/med_editor/framework/document-comment.ts +0 -168
- package/src/med_editor/framework/document-context.ts +0 -410
- package/src/med_editor/framework/document-eval-func.ts +0 -53
- package/src/med_editor/framework/document-event.ts +0 -1082
- package/src/med_editor/framework/document-history.ts +0 -76
- package/src/med_editor/framework/document-images-loader.ts +0 -74
- package/src/med_editor/framework/document-input-cursor.ts +0 -244
- package/src/med_editor/framework/document-paint.ts +0 -110
- package/src/med_editor/framework/document-print-offscreen.ts +0 -134
- package/src/med_editor/framework/document-print.ts +0 -219
- package/src/med_editor/framework/document-segmenter.ts +0 -211
- package/src/med_editor/framework/document-selection.ts +0 -391
- package/src/med_editor/framework/document-template.ts +0 -20
- package/src/med_editor/framework/document-textline-mode.ts +0 -34
- package/src/med_editor/framework/element-define.ts +0 -674
- package/src/med_editor/framework/element-event-define.ts +0 -142
- package/src/med_editor/framework/element-measure.ts +0 -573
- package/src/med_editor/framework/element-paint.ts +0 -176
- package/src/med_editor/framework/element-props.ts +0 -938
- package/src/med_editor/framework/element-reader.ts +0 -159
- package/src/med_editor/framework/element-render-cut.ts +0 -456
- package/src/med_editor/framework/element-serialize.ts +0 -128
- package/src/med_editor/framework/element-util.ts +0 -1565
- package/src/med_editor/framework/impl/checkbox/checkbox-impl.ts +0 -71
- package/src/med_editor/framework/impl/comments/comment-content-impl.ts +0 -119
- package/src/med_editor/framework/impl/comments/comment-element-impl.ts +0 -65
- package/src/med_editor/framework/impl/comments/comments-container-impl.ts +0 -68
- package/src/med_editor/framework/impl/comments/comments-util.ts +0 -84
- package/src/med_editor/framework/impl/comments/validate-msg-impl.ts +0 -94
- package/src/med_editor/framework/impl/data-element/data-decorate-impl.ts +0 -95
- package/src/med_editor/framework/impl/data-element/data-element-barcode.ts +0 -127
- package/src/med_editor/framework/impl/data-element/data-element-base-impl.ts +0 -234
- package/src/med_editor/framework/impl/data-element/data-element-check-impl.ts +0 -146
- package/src/med_editor/framework/impl/data-element/data-element-date-impl.ts +0 -128
- package/src/med_editor/framework/impl/data-element/data-element-group-impl.ts +0 -150
- package/src/med_editor/framework/impl/data-element/data-element-image-impl.ts +0 -147
- package/src/med_editor/framework/impl/data-element/data-element-list-impl.ts +0 -142
- package/src/med_editor/framework/impl/data-element/data-element-text-impl.ts +0 -117
- package/src/med_editor/framework/impl/decorate/fill-null-space-imple.ts +0 -48
- package/src/med_editor/framework/impl/document/doc-body-impl.ts +0 -95
- package/src/med_editor/framework/impl/document/doc-body-part-impl.ts +0 -104
- package/src/med_editor/framework/impl/document/doc-container-impl.ts +0 -24
- package/src/med_editor/framework/impl/document/doc-footer-impl.ts +0 -88
- package/src/med_editor/framework/impl/document/doc-header-impl.ts +0 -100
- package/src/med_editor/framework/impl/document/doc-impl.ts +0 -226
- package/src/med_editor/framework/impl/media-formula/menstrual-history.ts +0 -175
- package/src/med_editor/framework/impl/paragraph/p-impl.ts +0 -190
- package/src/med_editor/framework/impl/picture/image-impl.ts +0 -136
- package/src/med_editor/framework/impl/radio/radio-impl.ts +0 -79
- package/src/med_editor/framework/impl/symbol/br-symbol-impl.ts +0 -60
- package/src/med_editor/framework/impl/symbol/p-symbol-impl.ts +0 -57
- package/src/med_editor/framework/impl/table/table-cell-impl.ts +0 -156
- package/src/med_editor/framework/impl/table/table-impl.ts +0 -401
- package/src/med_editor/framework/impl/table/table-row-impl.ts +0 -83
- package/src/med_editor/framework/impl/table/table-split-cell-patch.ts +0 -98
- package/src/med_editor/framework/impl/table/table-split-cell.ts +0 -475
- package/src/med_editor/framework/impl/table/table-util.ts +0 -716
- package/src/med_editor/framework/impl/text/text-impl.ts +0 -164
- package/src/med_editor/framework/impl/text/track-run-impl.ts +0 -135
- package/src/med_editor/framework/notify.ts +0 -130
- package/src/med_editor/framework/range-util.ts +0 -321
- package/src/med_editor/framework/render-context.ts +0 -431
- package/src/med_editor/framework/render-define.ts +0 -224
- package/src/med_editor/framework/selection-overlays.ts +0 -134
- package/src/med_editor/texteditor.ts +0 -1011
- package/src/med_editor/util/subject.ts +0 -118
- package/src/med_editor/util/table-bind.ts +0 -6
- package/src/med_editor//345/205/245/351/231/242/350/256/260/345/275/225.json +0 -3573
- package/src/med_editor//345/205/245/351/231/242/350/256/260/345/275/225/346/265/213/350/257/225.json +0 -3573
- package/src/med_editor//345/205/245/351/231/242/350/256/260/345/275/225/346/265/213/350/257/225bug.json +0 -315
- package/src/med_editor//345/205/245/351/231/242/350/256/260/345/275/225/346/265/213/350/257/225/346/211/271/346/263/250.json +0 -122
- package/src/med_editor//345/205/245/351/231/242/350/256/260/345/275/225/346/265/213/350/257/225/346/226/207/346/241/243/351/252/214/350/257/201.json +0 -3599
- package/src/med_editor//345/205/245/351/231/242/350/256/260/345/275/225/346/265/213/350/257/225/351/225/277/346/226/207/346/234/254.json +0 -24586
- package/src/med_editor//345/220/210/345/271/266/347/227/205/347/250/213/345/275/225.json +0 -2874
- package/src/med_editor//346/211/213/346/234/257/350/256/260/345/275/225.json +0 -341
- package/src/med_editor//346/231/256/351/200/232doc/347/261/273/346/226/207/346/241/243.json +0 -2201
- package/src/med_editor//346/243/200/351/252/214/347/224/263/350/257/267/345/215/225.json +0 -1069
- package/src/med_editor//347/227/205/347/250/213/345/275/225//345/206/205/351/225/234/344/270/213/346/262/273/347/226/227/350/256/260/345/275/225.json +0 -125
- package/src/med_editor//347/227/205/347/250/213/345/275/225//345/220/210/345/271/266/347/227/205/347/250/213/345/275/225/346/250/241/346/235/277.json +0 -86
- package/src/med_editor//347/227/205/347/250/213/345/275/225//346/227/245/345/270/270/347/227/205/347/250/213/350/256/260/345/275/225.json +0 -115
- package/src/med_editor//347/227/205/347/250/213/345/275/225//346/237/245/346/210/277/350/256/260/345/275/2251.json +0 -108
- package/src/med_editor//347/227/205/347/250/213/345/275/225//351/246/226/346/254/241/344/270/212/347/272/247/345/214/273/345/270/210/346/237/245/346/210/277/350/256/260/345/275/225.json +0 -272
- package/src/med_editor//351/225/277/346/234/237/345/214/273/345/230/261/345/215/225.json +0 -1070
- package/tsconfig.json +0 -25
- package/webpack.config.js +0 -46
@@ -1,71 +0,0 @@
|
|
1
|
-
import { ElementFactory, LeafElement, readElementProps, SerializeProps, ViewOptions } from "@/med_editor/framework/element-define";
|
2
|
-
import { CheckBoxProps } from "@/med_editor/framework/element-props";
|
3
|
-
import { ElementUtil } from "@/med_editor/framework/element-util";
|
4
|
-
import { RenderContenxtType } from "@/med_editor/framework/render-context";
|
5
|
-
import { LeafRenderObject, RenderObject } from "@/med_editor/framework/render-define";
|
6
|
-
import { ElementEvent } from "../../element-event-define";
|
7
|
-
|
8
|
-
export class CheckBoxElement extends LeafElement<CheckBoxProps> {
|
9
|
-
//props: CheckBoxProps;
|
10
|
-
constructor() {
|
11
|
-
super('ckb');
|
12
|
-
this.props = new CheckBoxProps();
|
13
|
-
//this.addPropValueChangedSub(this.props);
|
14
|
-
this.cursorType = 'default'
|
15
|
-
this.addEvent('ElementClick', (evt) => { this.changeState(evt) });
|
16
|
-
}
|
17
|
-
createRenderObject(): CheckBoxRenderObject {
|
18
|
-
const render = new CheckBoxRenderObject(this);
|
19
|
-
render.rect.width = this.props.size + 4;
|
20
|
-
render.rect.height = this.props.size;
|
21
|
-
return render;
|
22
|
-
}
|
23
|
-
|
24
|
-
changeState(e: ElementEvent): void {
|
25
|
-
this.props.isChecked = !this.props.isChecked;
|
26
|
-
}
|
27
|
-
|
28
|
-
serialize(viewOptions: ViewOptions): SerializeProps {
|
29
|
-
return {
|
30
|
-
type: 'ckb',
|
31
|
-
props: {
|
32
|
-
...this.props.getSerializeProps(viewOptions)
|
33
|
-
}
|
34
|
-
}
|
35
|
-
}
|
36
|
-
clone(): CheckBoxElement {
|
37
|
-
const clone = new CheckBoxElement();
|
38
|
-
this.props.clone(clone.props);
|
39
|
-
return clone;
|
40
|
-
}
|
41
|
-
getType(): string {
|
42
|
-
return 'ckb';
|
43
|
-
}
|
44
|
-
}
|
45
|
-
|
46
|
-
export class CheckBoxFactory extends ElementFactory<CheckBoxProps> {
|
47
|
-
match(type: string): boolean {
|
48
|
-
return type === 'ckb';
|
49
|
-
}
|
50
|
-
createElement(data: readElementProps<CheckBoxProps>, renderCtx: RenderContenxtType): CheckBoxElement {
|
51
|
-
const props = data.props;
|
52
|
-
const ckbElement = new CheckBoxElement();
|
53
|
-
const ckbProps = ckbElement.props;
|
54
|
-
ckbProps.size = props?.size ?? 14;
|
55
|
-
ckbProps.isChecked = props?.isChecked ?? false;
|
56
|
-
ckbProps.groupName = props?.groupName ?? null;
|
57
|
-
return ckbElement;
|
58
|
-
}
|
59
|
-
}
|
60
|
-
|
61
|
-
export class CheckBoxRenderObject extends LeafRenderObject<CheckBoxElement> {
|
62
|
-
render(ctx: RenderContenxtType, position: { x: number; y: number; }): void {
|
63
|
-
ctx.contentContext.drawCheckBox(position.x + 2, position.y, this.element.props.size, this.element.props.size, this.element.props.isChecked);
|
64
|
-
}
|
65
|
-
clone(cloneData = true): RenderObject {
|
66
|
-
const clone = new CheckBoxRenderObject(this.element);
|
67
|
-
clone.rect = ElementUtil.cloneRect(this.rect);
|
68
|
-
return clone;
|
69
|
-
}
|
70
|
-
|
71
|
-
}
|
@@ -1,119 +0,0 @@
|
|
1
|
-
import { BlockContainerElement, ElementFactory, Position, readElementProps, Rect, SelectionContentRange, SerializeProps, ViewOptions } from "../../element-define";
|
2
|
-
import { CommContentProps, TextProps } from "../../element-props";
|
3
|
-
import { Element } from "../../element-define"
|
4
|
-
import { ElementUtil } from "../../element-util";
|
5
|
-
import { RenderContenxtType } from "../../render-context";
|
6
|
-
import { BlockContainerRenderObject, RenderObject } from "../../render-define";
|
7
|
-
import { DocumentRenderObject } from "../document/doc-impl";
|
8
|
-
import { CommentElement } from "./comment-element-impl";
|
9
|
-
import moment from "moment";
|
10
|
-
|
11
|
-
export abstract class CommContentBaseElement<P extends object = { id: string }> extends BlockContainerElement<P>{
|
12
|
-
startMark!: CommentElement;
|
13
|
-
endMark!: CommentElement;
|
14
|
-
focus: boolean = false;
|
15
|
-
protected constructor(type: string) {
|
16
|
-
super(type);
|
17
|
-
this.addEvent('GotCursor', () => {
|
18
|
-
this.focus = true;
|
19
|
-
this.refreshView()
|
20
|
-
});
|
21
|
-
this.addEvent('LostCursor', () => {
|
22
|
-
this.focus = false;
|
23
|
-
this.refreshView()
|
24
|
-
})
|
25
|
-
}
|
26
|
-
}
|
27
|
-
|
28
|
-
export abstract class CommContentBaseRenderObject<E extends CommContentBaseElement> extends BlockContainerRenderObject<E> {
|
29
|
-
commMarkRender!: { render: RenderObject, pos: Position };
|
30
|
-
}
|
31
|
-
|
32
|
-
export class CommContentElement extends CommContentBaseElement<CommContentProps> {
|
33
|
-
constructor() {
|
34
|
-
super("comm-content");
|
35
|
-
this.props = new CommContentProps();
|
36
|
-
}
|
37
|
-
createRenderObject(options: ViewOptions, renderCtx: RenderContenxtType): RenderObject {
|
38
|
-
const render = new CommContentRenderObject(this);
|
39
|
-
render.padding.left = 14;
|
40
|
-
render.padding.top = 24;
|
41
|
-
return render;
|
42
|
-
}
|
43
|
-
serialize(viewOptions: ViewOptions): SerializeProps {
|
44
|
-
return {
|
45
|
-
type: this.type,
|
46
|
-
props: { ...this.props.getSerializeProps(viewOptions) }
|
47
|
-
}
|
48
|
-
}
|
49
|
-
clone(data: boolean): Element {
|
50
|
-
throw new Error('不支持');
|
51
|
-
}
|
52
|
-
}
|
53
|
-
|
54
|
-
export class CommContentRenderObject extends CommContentBaseRenderObject<CommContentElement> {
|
55
|
-
beginRender(ctx: RenderContenxtType, position: Position): void {
|
56
|
-
let borderColor = this.element.focus ? '#fa8c16' : '#ffd591';
|
57
|
-
ctx.contentContext.strokeRect(position.x, position.y, this.rect.width, this.rect.height, borderColor);
|
58
|
-
ctx.contentContext.fillRect(position.x, position.y, 8, this.rect.height, '#871400')
|
59
|
-
const docRender = ElementUtil.getParentRender(this.commMarkRender.render, DocumentRenderObject) as DocumentRenderObject;
|
60
|
-
//获取审阅标记的绘制坐标
|
61
|
-
let commMarkPos = ElementUtil.getRenderAbsolutePaintPos(this.commMarkRender.render, { x: 0, y: -ctx.viewOptions.translateY });
|
62
|
-
const commMarkLinePos = ElementUtil.getParaLinePos(this.commMarkRender.render, commMarkPos);
|
63
|
-
commMarkPos.y = commMarkLinePos.y + 2;
|
64
|
-
|
65
|
-
const docRenderPos = ElementUtil.getRenderAbsolutePaintPos(docRender, { x: 0, y: -ctx.viewOptions.translateY });
|
66
|
-
const marginLeft = commMarkPos.x - docRenderPos.x - docRender.padding.left;
|
67
|
-
const marginRight = ctx.viewOptions.docPageSettings.width - marginLeft - docRender.padding.right * 2;
|
68
|
-
ctx.overlaysContext.drawDashLine([commMarkPos, { x: commMarkPos.x + marginRight, y: commMarkPos.y }], [1, 1], 'red');
|
69
|
-
ctx.overlaysContext.drawDashLine([{ x: commMarkPos.x + marginRight, y: commMarkPos.y }, position], [1, 1], 'red');
|
70
|
-
|
71
|
-
this.renderTitle(ctx, position);
|
72
|
-
}
|
73
|
-
|
74
|
-
renderTitle(ctx: RenderContenxtType, position: Position): void {
|
75
|
-
const topPadding = 24;
|
76
|
-
const { props } = this.element;
|
77
|
-
const textProps = new TextProps();
|
78
|
-
textProps.fontSize = 12;
|
79
|
-
textProps.fontName = '楷体';
|
80
|
-
textProps.color = "rgb(0,0,0)";
|
81
|
-
const createDate = moment(props.createDate).format('YYYY-MM-DD HH:mm')
|
82
|
-
const commTitle = `${props.createName}:${createDate}`;
|
83
|
-
const { width, height } = ctx.contentContext.measureText(commTitle, textProps);
|
84
|
-
const rect: Rect = { x: position.x + this.padding.left, y: position.y, width, height, maxHeight: 0, maxWidth: 0 }
|
85
|
-
rect.y += (topPadding - rect.height) / 2;
|
86
|
-
ctx.contentContext.drawText(commTitle, textProps, rect.x, rect.y, rect.width, rect.height);
|
87
|
-
}
|
88
|
-
endRender(ctx: RenderContenxtType, position: Position): void {
|
89
|
-
//throw new Error("Method not implemented.");
|
90
|
-
}
|
91
|
-
clone(): RenderObject {
|
92
|
-
const clone = new CommContentRenderObject(this.element);
|
93
|
-
clone.rect = ElementUtil.cloneRect(this.rect);
|
94
|
-
clone.padding = this.padding.clone();
|
95
|
-
for (let i = 0; i < this.length; i++) {
|
96
|
-
clone.addChild(this.getChild(i).clone());
|
97
|
-
}
|
98
|
-
return clone;
|
99
|
-
}
|
100
|
-
}
|
101
|
-
|
102
|
-
export interface CommentRangeStatus {
|
103
|
-
range: SelectionContentRange, commContent: CommContentBaseElement
|
104
|
-
}
|
105
|
-
|
106
|
-
export class CommentContentFactory extends ElementFactory<CommContentProps> {
|
107
|
-
match(type: string): boolean {
|
108
|
-
return type === "comm-content";
|
109
|
-
}
|
110
|
-
createElement(data: readElementProps<CommContentProps>, renderCtx: RenderContenxtType): Element {
|
111
|
-
const props = data.props as CommContentProps;
|
112
|
-
const commentEle = new CommContentElement();
|
113
|
-
commentEle.props.id = props.id;
|
114
|
-
commentEle.props.createDate = props.createDate;
|
115
|
-
commentEle.props.createId = props.createId;
|
116
|
-
commentEle.props.createName = props.createName;
|
117
|
-
return commentEle;
|
118
|
-
}
|
119
|
-
}
|
@@ -1,65 +0,0 @@
|
|
1
|
-
import { Element, ElementFactory, LeafElement, readElementProps, SerializeProps, ViewOptions } from "@/med_editor/framework/element-define";
|
2
|
-
import { CommProps } from "@/med_editor/framework/element-props";
|
3
|
-
import { ElementUtil } from "@/med_editor/framework/element-util";
|
4
|
-
import { RenderContenxtType } from "@/med_editor/framework/render-context";
|
5
|
-
import { LeafRenderObject, RenderObject } from "@/med_editor/framework/render-define";
|
6
|
-
|
7
|
-
export class CommentElement extends LeafElement<CommProps> {
|
8
|
-
constructor() {
|
9
|
-
super('comm');
|
10
|
-
this.isDecorate = true;
|
11
|
-
this.disableClick = true;
|
12
|
-
this.props = new CommProps();
|
13
|
-
}
|
14
|
-
createRenderObject(options: ViewOptions, renderCtx: RenderContenxtType): RenderObject {
|
15
|
-
const render = new CommentRenderObject(this);
|
16
|
-
render.rect.width = 0;
|
17
|
-
render.rect.height = 14;
|
18
|
-
return render;
|
19
|
-
}
|
20
|
-
serialize(viewOptions: ViewOptions): SerializeProps|null {
|
21
|
-
if(this.isDecorate){
|
22
|
-
return null;
|
23
|
-
}
|
24
|
-
return {
|
25
|
-
type: this.type,
|
26
|
-
props: {
|
27
|
-
...this.props.getSerializeProps(viewOptions)
|
28
|
-
}
|
29
|
-
}
|
30
|
-
}
|
31
|
-
clone(): Element {
|
32
|
-
const clone = new CommentElement();
|
33
|
-
this.props.clone(clone.props);
|
34
|
-
return clone;
|
35
|
-
}
|
36
|
-
}
|
37
|
-
|
38
|
-
export class CommentRenderObject extends LeafRenderObject<CommentElement> {
|
39
|
-
render(ctx: RenderContenxtType, position: { x: number; y: number; }): void {
|
40
|
-
if (!ctx.viewOptions.showReviewWindow) {
|
41
|
-
return;
|
42
|
-
}
|
43
|
-
const paraLinePos = ElementUtil.getParaLinePos(this, { x: position.x, y: position.y });
|
44
|
-
const color = '#ff4d4f';
|
45
|
-
ctx.contentContext.fillRect(position.x - 1, paraLinePos.y, 2, paraLinePos.height, color)
|
46
|
-
}
|
47
|
-
clone(): RenderObject {
|
48
|
-
const clone = new CommentRenderObject(this.element);
|
49
|
-
clone.rect = ElementUtil.cloneRect(this.rect);
|
50
|
-
return clone;
|
51
|
-
}
|
52
|
-
}
|
53
|
-
|
54
|
-
export class CommentFactory extends ElementFactory<CommProps> {
|
55
|
-
match(type: string): boolean {
|
56
|
-
return type === "comm";
|
57
|
-
}
|
58
|
-
createElement(data: readElementProps<CommProps>, renderCtx: RenderContenxtType): Element {
|
59
|
-
const ele = new CommentElement();
|
60
|
-
const props = data.props as CommProps;
|
61
|
-
ele.props.id = props.id;
|
62
|
-
ele.props.markType = props.markType;
|
63
|
-
return ele;
|
64
|
-
}
|
65
|
-
}
|
@@ -1,68 +0,0 @@
|
|
1
|
-
import { BlockContainerElement, Element, ElementFactory, Position, SelectionContentRange, SerializeProps, ViewOptions } from "@/med_editor/framework/element-define";
|
2
|
-
import { ElementUtil } from "@/med_editor/framework/element-util";
|
3
|
-
import { RenderContenxtType } from "@/med_editor/framework/render-context";
|
4
|
-
import { BlockContainerRenderObject, RenderObject } from "@/med_editor/framework/render-define";
|
5
|
-
import { CommentRangeStatus } from "./comment-content-impl";
|
6
|
-
|
7
|
-
export class CommsContainerElement extends BlockContainerElement {
|
8
|
-
constructor() {
|
9
|
-
super('comm-list');
|
10
|
-
this.noFillEmpty = true;
|
11
|
-
}
|
12
|
-
createRenderObject(options: ViewOptions, renderCtx: RenderContenxtType): RenderObject {
|
13
|
-
const render = new CommsContainerRenderObject(this);
|
14
|
-
render.rect.maxWidth = options.reviewWindowWidth;
|
15
|
-
render.rect.width = render.rect.maxWidth;
|
16
|
-
return render;
|
17
|
-
}
|
18
|
-
serialize(viewOptions: ViewOptions): SerializeProps {
|
19
|
-
return {
|
20
|
-
type: this.type,
|
21
|
-
props: {}
|
22
|
-
};
|
23
|
-
}
|
24
|
-
clone(data: boolean): Element {
|
25
|
-
const clone = new CommsContainerElement();
|
26
|
-
if (data) {
|
27
|
-
for (let i = 0; i < this.length; i++) {
|
28
|
-
clone.addChild(this.getChild(i).clone(true));
|
29
|
-
}
|
30
|
-
}
|
31
|
-
return clone;
|
32
|
-
}
|
33
|
-
}
|
34
|
-
|
35
|
-
export class CommsContainerRenderObject extends BlockContainerRenderObject {
|
36
|
-
//批注内容是否已经重组,只要重新绘制的时候组合一次即可
|
37
|
-
isMeasureComm!: boolean;
|
38
|
-
selectedSet!: Map<Element, SelectionContentRange>;
|
39
|
-
commentRangeStatus: Array<CommentRangeStatus> = [];
|
40
|
-
beginRender(ctx: RenderContenxtType, position: Position): void {
|
41
|
-
if (this.rect.height === 0) {
|
42
|
-
return;
|
43
|
-
}
|
44
|
-
ctx.contentContext.strokeRect(position.x, position.y, this.rect.width, this.rect.height, 'black', 0.5);
|
45
|
-
}
|
46
|
-
endRender(ctx: RenderContenxtType, position: Position): void {
|
47
|
-
|
48
|
-
}
|
49
|
-
clone(): RenderObject {
|
50
|
-
const clone = new CommsContainerRenderObject(this.element);
|
51
|
-
clone.rect = ElementUtil.cloneRect(this.rect);
|
52
|
-
for (let i = 0; i < this.length; i++) {
|
53
|
-
clone.addChild(this.getChild(i).clone());
|
54
|
-
}
|
55
|
-
return clone;
|
56
|
-
}
|
57
|
-
}
|
58
|
-
|
59
|
-
|
60
|
-
export class CommentsFactory extends ElementFactory<null> {
|
61
|
-
match(type: string): boolean {
|
62
|
-
return type === "comm-list";
|
63
|
-
}
|
64
|
-
createElement(data: any, renderCtx: RenderContenxtType): Element {
|
65
|
-
const commentsEle = new CommsContainerElement();
|
66
|
-
return commentsEle;
|
67
|
-
}
|
68
|
-
}
|
@@ -1,84 +0,0 @@
|
|
1
|
-
import {Position} from "@/med_editor/framework/element-define";
|
2
|
-
import {RenderContenxtType} from "@/med_editor/framework/render-context";
|
3
|
-
import {RenderObject} from "@/med_editor/framework/render-define";
|
4
|
-
import {ElementUtil} from "../../element-util";
|
5
|
-
import {DocumentRenderObject} from "../document/doc-impl";
|
6
|
-
import {CommContentBaseElement, CommContentBaseRenderObject,} from "./comment-content-impl";
|
7
|
-
import {CommentElement, CommentRenderObject} from "./comment-element-impl";
|
8
|
-
import {CommsContainerRenderObject} from "./comments-container-impl";
|
9
|
-
|
10
|
-
interface CommMapProps {
|
11
|
-
commMarkRender: CommentRenderObject,
|
12
|
-
commMarkPos: Position,
|
13
|
-
commContentRender: CommContentBaseRenderObject<any>,
|
14
|
-
commContentPos?: Position
|
15
|
-
}
|
16
|
-
|
17
|
-
export class CommentsUtil {
|
18
|
-
static remeasureComments(ctx: RenderContenxtType, commWindow: CommsContainerRenderObject, commContainer: CommsContainerRenderObject, map: Array<{ ele: CommentElement, render: RenderObject, pos: Position }>): void {
|
19
|
-
const commMap: Array<CommMapProps> = [];
|
20
|
-
const docRender = ElementUtil.getParentRender(commWindow, DocumentRenderObject) as DocumentRenderObject;
|
21
|
-
for (let i = 0; i < commContainer.length; i++) {
|
22
|
-
const commRender = commContainer.getChild(i);
|
23
|
-
const commEle = commRender.element as CommContentBaseElement;
|
24
|
-
const mapComm = map.find(item => item.ele.props.id === commEle.props.id);
|
25
|
-
if (mapComm) {
|
26
|
-
const commMarkLinePos = ElementUtil.getParaLinePos(mapComm.render, mapComm.pos);
|
27
|
-
mapComm.pos.y = commMarkLinePos.y + 2;
|
28
|
-
|
29
|
-
const commContentRender = commRender.clone() as CommContentBaseRenderObject<any>;
|
30
|
-
commContentRender.rect.x = 0;
|
31
|
-
commContentRender.rect.y = mapComm.pos.y;
|
32
|
-
commWindow.addChild(commContentRender);
|
33
|
-
commMap.push({
|
34
|
-
commMarkRender: <CommentRenderObject>mapComm.render,
|
35
|
-
commMarkPos: mapComm.pos,
|
36
|
-
commContentRender: commContentRender
|
37
|
-
});
|
38
|
-
}
|
39
|
-
}
|
40
|
-
let sumCommentHeight = 0;
|
41
|
-
for (let i = 0; i < commMap.length; i++) {
|
42
|
-
const map = commMap[i];
|
43
|
-
const prevRender = commMap[i - 1]?.commContentRender;
|
44
|
-
const {commContentRender} = map;
|
45
|
-
sumCommentHeight += commContentRender.rect.height + 5;
|
46
|
-
if (prevRender) {
|
47
|
-
const {y: prevY, height: prevHeight} = prevRender.rect;
|
48
|
-
if (commContentRender.rect.y < prevY + prevHeight) {
|
49
|
-
commContentRender.rect.y = prevY + prevHeight + 5;
|
50
|
-
}
|
51
|
-
}
|
52
|
-
commContentRender.commMarkRender = {render: map.commMarkRender, pos: map.commMarkPos};
|
53
|
-
}
|
54
|
-
if (!commMap.length) {
|
55
|
-
return;
|
56
|
-
}
|
57
|
-
const lastCommentMap = commMap[commMap.length - 1];
|
58
|
-
const {commContentRender: lastCommContentRender} = lastCommentMap;
|
59
|
-
const {rect: lastRect} = lastCommContentRender;
|
60
|
-
|
61
|
-
//批注内容超出文档,需要重新排序
|
62
|
-
if (lastRect.y + lastRect.height > docRender.rect.height) {
|
63
|
-
//总内容小于容器高度,则进行倒排
|
64
|
-
//否则进行正排
|
65
|
-
if (sumCommentHeight < docRender.rect.height) {
|
66
|
-
lastRect.y = docRender.rect.height - lastRect.height;
|
67
|
-
for (let i = commMap.length - 1; i >= 0; i--) {
|
68
|
-
const map = commMap[i];
|
69
|
-
const prevRender = commMap[i + 1]?.commContentRender;
|
70
|
-
const {commContentRender} = map;
|
71
|
-
if (prevRender) {
|
72
|
-
const {y: prevY} = prevRender.rect;
|
73
|
-
if (commContentRender.rect.y + commContentRender.rect.height > prevY) {
|
74
|
-
commContentRender.rect.y = prevY - commContentRender.rect.height - 5;
|
75
|
-
}
|
76
|
-
}
|
77
|
-
commContentRender.commMarkRender = {render: map.commMarkRender, pos: map.commMarkPos};
|
78
|
-
}
|
79
|
-
}
|
80
|
-
}
|
81
|
-
|
82
|
-
}
|
83
|
-
|
84
|
-
}
|
@@ -1,94 +0,0 @@
|
|
1
|
-
import { ViewOptions, Element, SerializeProps, Position, Rect } from "../../element-define";
|
2
|
-
import { TextProps, ValidateProps } from "../../element-props";
|
3
|
-
import { ElementUtil } from "../../element-util";
|
4
|
-
import { RenderContenxtType } from "../../render-context";
|
5
|
-
import { RenderObject } from "../../render-define";
|
6
|
-
import { CommContentBaseElement, CommContentBaseRenderObject } from "./comment-content-impl";
|
7
|
-
import { ParagraphElement } from "@/med_editor/framework/impl/paragraph/p-impl";
|
8
|
-
import { TextGroupElement } from "@/med_editor/framework/impl/text/text-impl";
|
9
|
-
import { DocumentRenderObject } from "../document/doc-impl";
|
10
|
-
|
11
|
-
/**
|
12
|
-
* 数据元验证提示
|
13
|
-
*/
|
14
|
-
export class ValidateElement extends CommContentBaseElement<ValidateProps> {
|
15
|
-
constructor() {
|
16
|
-
super('validate');
|
17
|
-
this.props = new ValidateProps();
|
18
|
-
this.isDecorate = true;
|
19
|
-
}
|
20
|
-
|
21
|
-
createRenderObject(options: ViewOptions, renderCtx: RenderContenxtType): RenderObject | null {
|
22
|
-
const render = new ValidateRenderObject(this);
|
23
|
-
render.padding.left = 14;
|
24
|
-
render.padding.top = 24;
|
25
|
-
return render;
|
26
|
-
}
|
27
|
-
|
28
|
-
serialize(viewOptions: ViewOptions): SerializeProps | null {
|
29
|
-
return null;
|
30
|
-
}
|
31
|
-
|
32
|
-
clone(data: boolean): Element {
|
33
|
-
throw new Error("Method not implemented.");
|
34
|
-
}
|
35
|
-
|
36
|
-
setContent(content: string): void {
|
37
|
-
this.clearItems();
|
38
|
-
const para = new ParagraphElement();
|
39
|
-
const text = new TextGroupElement();
|
40
|
-
text.props.fontSize = 14;
|
41
|
-
text.props.fontName = '等线';
|
42
|
-
text.props.color = '#000000'
|
43
|
-
text.text = content;
|
44
|
-
para.addChild(text);
|
45
|
-
this.addChild(para);
|
46
|
-
}
|
47
|
-
}
|
48
|
-
|
49
|
-
export class ValidateRenderObject extends CommContentBaseRenderObject<ValidateElement> {
|
50
|
-
beginRender(ctx: RenderContenxtType, position: Position): void {
|
51
|
-
let borderColor = this.element.focus ? '#fa8c16' : '#ffd591';
|
52
|
-
ctx.contentContext.strokeRect(position.x, position.y, this.rect.width, this.rect.height, borderColor);
|
53
|
-
ctx.contentContext.fillRect(position.x, position.y, 8, this.rect.height, '#871400')
|
54
|
-
const docRender = ElementUtil.getParentRender(this.commMarkRender.render, DocumentRenderObject) as DocumentRenderObject;
|
55
|
-
//获取审阅标记的绘制坐标
|
56
|
-
let commMarkPos = ElementUtil.getRenderAbsolutePaintPos(this.commMarkRender.render, { x: 0, y: -ctx.viewOptions.translateY });
|
57
|
-
const commMarkLinePos = ElementUtil.getParaLinePos(this.commMarkRender.render, commMarkPos);
|
58
|
-
commMarkPos.y = commMarkLinePos.y + 2;
|
59
|
-
|
60
|
-
const docRenderPos = ElementUtil.getRenderAbsolutePaintPos(docRender, { x: 0, y: -ctx.viewOptions.translateY });
|
61
|
-
const marginLeft = commMarkPos.x - docRenderPos.x - docRender.padding.left;
|
62
|
-
const marginRight = ctx.viewOptions.docPageSettings.width - marginLeft - docRender.padding.right * 2;
|
63
|
-
ctx.overlaysContext.drawDashLine([commMarkPos, { x: commMarkPos.x + marginRight, y: commMarkPos.y }], [1, 1], 'red');
|
64
|
-
ctx.overlaysContext.drawDashLine([{ x: commMarkPos.x + marginRight, y: commMarkPos.y }, position], [1, 1], 'red');
|
65
|
-
|
66
|
-
this.renderTitle(ctx, position);
|
67
|
-
}
|
68
|
-
|
69
|
-
renderTitle(ctx: RenderContenxtType, position: Position): void {
|
70
|
-
const topPadding = 24;
|
71
|
-
const { props } = this.element;
|
72
|
-
const textProps = new TextProps();
|
73
|
-
textProps.fontSize = 12;
|
74
|
-
textProps.fontName = '楷体';
|
75
|
-
textProps.color = "rgb(0,0,0)";
|
76
|
-
const title = this.element.props.title;
|
77
|
-
const { width, height } = ctx.contentContext.measureText(title, textProps);
|
78
|
-
const rect: Rect = { x: position.x + this.padding.left, y: position.y, width, height, maxHeight: 0, maxWidth: 0 }
|
79
|
-
rect.y += (topPadding - rect.height) / 2;
|
80
|
-
ctx.contentContext.drawText(title, textProps, rect.x, rect.y, rect.width, rect.height);
|
81
|
-
}
|
82
|
-
endRender(ctx: RenderContenxtType, position: Position): void {
|
83
|
-
//throw new Error("Method not implemented.");
|
84
|
-
}
|
85
|
-
clone(): RenderObject {
|
86
|
-
const clone = new ValidateRenderObject(this.element);
|
87
|
-
clone.rect = ElementUtil.cloneRect(this.rect);
|
88
|
-
clone.padding = this.padding.clone();
|
89
|
-
for (let i = 0; i < this.length; i++) {
|
90
|
-
clone.addChild(this.getChild(i).clone());
|
91
|
-
}
|
92
|
-
return clone;
|
93
|
-
}
|
94
|
-
}
|
@@ -1,95 +0,0 @@
|
|
1
|
-
import { LeafElement, SerializeProps } from "@/med_editor/framework/element-define";
|
2
|
-
import { ElementUtil } from "@/med_editor/framework/element-util";
|
3
|
-
import { RenderContenxtType } from "@/med_editor/framework/render-context";
|
4
|
-
import { LeafRenderObject, RenderObject } from "@/med_editor/framework/render-define";
|
5
|
-
import { InlineGroupInputElement, validateInlineInputRenderObj } from "./data-element-base-impl";
|
6
|
-
|
7
|
-
export class DataDecorateElement extends LeafElement<any> {
|
8
|
-
//props: DataDecorateProps;
|
9
|
-
constructor(public dataEle: InlineGroupInputElement, public isPrefix: boolean) {
|
10
|
-
super('data-dec');
|
11
|
-
this.addEvent('GotCursor', (evt) => {
|
12
|
-
const { selectionState } = evt.ctx;
|
13
|
-
if (selectionState.collapsed && this.parent instanceof InlineGroupInputElement) {
|
14
|
-
const group = this.parent as InlineGroupInputElement;
|
15
|
-
if (this === group.endDecorate && selectionState.startOffset === 0) {
|
16
|
-
if (group.length === 2) {
|
17
|
-
selectionState.resetRange(group.startDecorate, 1);
|
18
|
-
evt.isCancel = true;
|
19
|
-
}
|
20
|
-
}
|
21
|
-
}
|
22
|
-
});
|
23
|
-
this.isDecorate = true;
|
24
|
-
}
|
25
|
-
createRenderObject(): DataDecorateRenderObject {
|
26
|
-
const render = new DataDecorateRenderObject(this);
|
27
|
-
//render.rect.width = this.dProps.size / 2;
|
28
|
-
render.rect.width = 6;
|
29
|
-
render.rect.height = 14;
|
30
|
-
return render;
|
31
|
-
}
|
32
|
-
|
33
|
-
serialize(): SerializeProps | null {
|
34
|
-
return null;
|
35
|
-
}
|
36
|
-
clone(): DataDecorateElement {
|
37
|
-
const clone = new DataDecorateElement(this.dataEle, this.isPrefix);
|
38
|
-
this.props.clone(clone.props);
|
39
|
-
//clone.renderCtx = this.renderCtx;
|
40
|
-
return clone;
|
41
|
-
}
|
42
|
-
}
|
43
|
-
|
44
|
-
export class DataDecorateArrowRenderObject extends LeafRenderObject {
|
45
|
-
render(ctx: RenderContenxtType, position: { x: number; y: number; }): void {
|
46
|
-
throw new Error("Method not implemented.");
|
47
|
-
}
|
48
|
-
clone(): RenderObject {
|
49
|
-
throw new Error("Method not implemented.");
|
50
|
-
}
|
51
|
-
|
52
|
-
}
|
53
|
-
|
54
|
-
export class DataDecorateRenderObject extends LeafRenderObject {
|
55
|
-
render(ctx: RenderContenxtType, position: { x: number; y: number; }): void {
|
56
|
-
this.renderDecorRect(ctx, position);
|
57
|
-
}
|
58
|
-
|
59
|
-
renderDecorRect(ctx: RenderContenxtType, position: { x: number; y: number; }): void {
|
60
|
-
if (ctx.drawMode === 'print') {
|
61
|
-
return;
|
62
|
-
}
|
63
|
-
const dataEleRender = ElementUtil.getParentRenderByPredicate(this, item => validateInlineInputRenderObj(item));
|
64
|
-
if (!dataEleRender) {
|
65
|
-
return;
|
66
|
-
}
|
67
|
-
const dataEleRenderPos = ElementUtil.getParentRenderPos(dataEleRender, this, position);
|
68
|
-
const element = this.element as DataDecorateElement;
|
69
|
-
let { x, y, height, width } = dataEleRenderPos;
|
70
|
-
const lineWidth = 2;
|
71
|
-
const paintColor = '#0050b3';
|
72
|
-
ctx.contentContext.ctx.save();
|
73
|
-
if (this.element.parent.type === 'data-group') {
|
74
|
-
ctx.contentContext.ctx.shadowBlur = 5;
|
75
|
-
ctx.contentContext.ctx.shadowColor = 'black';
|
76
|
-
}
|
77
|
-
if (element.isPrefix) {
|
78
|
-
x += 2;
|
79
|
-
ctx.contentContext.strokeLines([{ x: x + lineWidth, y }, { x: x, y }, { x: x, y: y + height }, { x: x + lineWidth, y: y + height }], 1, paintColor);
|
80
|
-
} else {
|
81
|
-
x = x + width - 2;
|
82
|
-
ctx.contentContext.strokeLines([{ x: x - lineWidth, y }, { x: x, y }, { x: x, y: y + height }, { x: x - lineWidth, y: y + height }], 1, paintColor);
|
83
|
-
}
|
84
|
-
ctx.contentContext.ctx.restore();
|
85
|
-
return;
|
86
|
-
|
87
|
-
}
|
88
|
-
|
89
|
-
clone(cloneData = true): RenderObject {
|
90
|
-
const clone = new DataDecorateRenderObject(this.element);
|
91
|
-
clone.rect = ElementUtil.cloneRect(this.rect);
|
92
|
-
return clone;
|
93
|
-
}
|
94
|
-
|
95
|
-
}
|