@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,150 +0,0 @@
|
|
1
|
-
import { InlineGroupInputElement } from "@/med_editor/framework/impl/data-element/data-element-base-impl";
|
2
|
-
import { InlineGroupRenderObject, RenderObject } from "@/med_editor/framework/render-define";
|
3
|
-
import { RenderContenxtType } from "@/med_editor/framework/render-context";
|
4
|
-
import { SerializeProps, ViewOptions, Element, ElementFactory, Position } from "@/med_editor/framework/element-define";
|
5
|
-
import { DataElementGroupProps } from "@/med_editor/framework/element-props";
|
6
|
-
import { ElementUtil } from "@/med_editor/framework/element-util";
|
7
|
-
import { ContextMenuElementEvent } from "../../element-event-define";
|
8
|
-
import { ElementSerialize } from "../../element-serialize";
|
9
|
-
import { ParagraphRenderObject } from "../paragraph/p-impl";
|
10
|
-
import { CommonUtil } from "../../common-util";
|
11
|
-
|
12
|
-
export class DataElementGroupElement extends InlineGroupInputElement<DataElementGroupProps>{
|
13
|
-
constructor() {
|
14
|
-
super('data-group');
|
15
|
-
this.props = new DataElementGroupProps();
|
16
|
-
this.addEvent<ContextMenuElementEvent>('ElementContextMenu', (evt) => {
|
17
|
-
if (evt.ctx.viewOptions.devMode) {
|
18
|
-
evt.menus.push({
|
19
|
-
icon: '获取数据组值', caption: '获取数据组值', eventObj: {
|
20
|
-
onClick: () => {
|
21
|
-
const str = ElementSerialize.serializeString(this, { all: false })
|
22
|
-
alert(str)
|
23
|
-
}
|
24
|
-
}
|
25
|
-
});
|
26
|
-
}
|
27
|
-
}, true);
|
28
|
-
this.addEvent('ElementMousemove', (evt) => {
|
29
|
-
this.isMouseenter = true;
|
30
|
-
this.refreshView();
|
31
|
-
});
|
32
|
-
this.addEvent('ElementMouseLeave', (evt) => {
|
33
|
-
this.isMouseenter = false;
|
34
|
-
this.refreshView();
|
35
|
-
});
|
36
|
-
}
|
37
|
-
clone(data: boolean): Element {
|
38
|
-
const clone = new DataElementGroupElement();
|
39
|
-
this.props.clone(clone.props);
|
40
|
-
if (data) {
|
41
|
-
const length = this.length;
|
42
|
-
for (let i = 0; i < length; i++) {
|
43
|
-
const child = this.getChild(i);
|
44
|
-
if (child !== this.startDecorate && child !== this.endDecorate) {
|
45
|
-
clone.addChild(child.clone(true));
|
46
|
-
}
|
47
|
-
}
|
48
|
-
}
|
49
|
-
return clone;
|
50
|
-
}
|
51
|
-
|
52
|
-
createRenderObject(options: ViewOptions, renderCtx: RenderContenxtType): RenderObject | null {
|
53
|
-
return new DataElementGroupRenderObject(this);
|
54
|
-
}
|
55
|
-
|
56
|
-
serialize(viewOptions: ViewOptions): SerializeProps | null {
|
57
|
-
return {
|
58
|
-
type: this.type,
|
59
|
-
props: {
|
60
|
-
...this.props.getSerializeProps()
|
61
|
-
}
|
62
|
-
}
|
63
|
-
}
|
64
|
-
|
65
|
-
}
|
66
|
-
|
67
|
-
|
68
|
-
export class DataElementGroupRenderObject extends InlineGroupRenderObject<DataElementGroupElement> {
|
69
|
-
paintPos!: Position;
|
70
|
-
beginRender(ctx: RenderContenxtType, position: Position): void {
|
71
|
-
//ctx.contentContext.fillRect(position.x, position.y, this.rect.width, this.rect.height, 'yellow');
|
72
|
-
this.paintPos = position;
|
73
|
-
|
74
|
-
}
|
75
|
-
|
76
|
-
private getCurrentParaGroupRenders(): DataElementGroupRenderObject[] {
|
77
|
-
const renders: DataElementGroupRenderObject[] = [];
|
78
|
-
const currParaRender = ElementUtil.getParentRender(this, ParagraphRenderObject) as ParagraphRenderObject;
|
79
|
-
for (let i = 0; i < this.element.paintRenders.length; i++) {
|
80
|
-
const paraRender = ElementUtil.getParentRender(this.element.paintRenders[i], ParagraphRenderObject) as ParagraphRenderObject;
|
81
|
-
if (paraRender === currParaRender) {
|
82
|
-
renders.push(this.element.paintRenders[i] as DataElementGroupRenderObject);
|
83
|
-
}
|
84
|
-
}
|
85
|
-
return renders;
|
86
|
-
}
|
87
|
-
|
88
|
-
|
89
|
-
pagePaintCompleted(ctx: RenderContenxtType, position: Position): void {
|
90
|
-
const canPaint = this.element.isMouseenter || this.element.isFocused;
|
91
|
-
if (canPaint && this.element.paintRenders.indexOf(this) === 0) {
|
92
|
-
const currParaRenders = this.getCurrentParaGroupRenders();
|
93
|
-
const verOffset = 3;
|
94
|
-
if (currParaRenders.length > 1) {
|
95
|
-
const secondGroupRenderPos = currParaRenders[1].paintPos;
|
96
|
-
if (secondGroupRenderPos.x + currParaRenders[1].rect.width > this.paintPos.x) {
|
97
|
-
const leftPoints: Array<Position> = [];
|
98
|
-
const rightPoints: Array<Position> = [];
|
99
|
-
for (let i = 0; i < currParaRenders.length; i++) {
|
100
|
-
const groupRender = currParaRenders[i];
|
101
|
-
const groupRenderPos = groupRender.paintPos;
|
102
|
-
|
103
|
-
leftPoints.push({ x: groupRenderPos.x, y: groupRenderPos.y - verOffset });
|
104
|
-
rightPoints.push({ x: groupRenderPos.x + groupRender.rect.width, y: groupRenderPos.y - verOffset });
|
105
|
-
leftPoints.push({ x: groupRenderPos.x, y: groupRenderPos.y + groupRender.rect.height + verOffset * 2 });
|
106
|
-
rightPoints.push({ x: groupRenderPos.x + groupRender.rect.width, y: groupRenderPos.y + groupRender.rect.height + verOffset * 2 });
|
107
|
-
}
|
108
|
-
const sharpPoints1 = CommonUtil.resharpPoints(rightPoints);
|
109
|
-
const sharpPoints = CommonUtil.resharpPoints([...leftPoints.reverse()]);
|
110
|
-
ctx.overlaysContext.strokeLines([...sharpPoints, ...sharpPoints1, sharpPoints[0]], 1, ctx.viewOptions.dataGroupColor);
|
111
|
-
return;
|
112
|
-
}
|
113
|
-
}
|
114
|
-
for (let i = 0; i < currParaRenders.length; i++) {
|
115
|
-
const render = currParaRenders[i];
|
116
|
-
ctx.overlaysContext.strokeRect(render.paintPos.x, render.paintPos.y - verOffset, render.rect.width, render.rect.height + verOffset * 2, ctx.viewOptions.dataGroupColor);
|
117
|
-
}
|
118
|
-
}
|
119
|
-
|
120
|
-
}
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
endRender(ctx: RenderContenxtType, position: Position): void {
|
125
|
-
|
126
|
-
}
|
127
|
-
|
128
|
-
clone(): RenderObject {
|
129
|
-
const cloneRender = new DataElementGroupRenderObject(this.element);
|
130
|
-
cloneRender.rect = ElementUtil.cloneRect(this.rect);
|
131
|
-
for (let i = 0; i < this.length; i++) {
|
132
|
-
cloneRender.addChild(this.getChild(i).clone());
|
133
|
-
}
|
134
|
-
return cloneRender;
|
135
|
-
}
|
136
|
-
}
|
137
|
-
|
138
|
-
export class DataElementGroupFactory extends ElementFactory<DataElementGroupProps> {
|
139
|
-
match(type: string): boolean {
|
140
|
-
return type === "data-group"
|
141
|
-
}
|
142
|
-
createElement(data: any, renderCtx: RenderContenxtType): Element {
|
143
|
-
const props = data.props as DataElementGroupProps;
|
144
|
-
const ele = new DataElementGroupElement();
|
145
|
-
ele.props.id = props.id;
|
146
|
-
ele.props.name = props.name;
|
147
|
-
return ele;
|
148
|
-
}
|
149
|
-
|
150
|
-
}
|
@@ -1,147 +0,0 @@
|
|
1
|
-
import { Element, ElementFactory, ImgLoadStatus, LeafElement, Position, readElementProps, ResizeLeafRenderObject, SerializeProps, ViewOptions } from "@/med_editor/framework/element-define";
|
2
|
-
import { DataEleImageProps } 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 { DataElementLeaf } from "./data-element-base-impl";
|
7
|
-
|
8
|
-
export class DataElementImage extends DataElementLeaf<DataEleImageProps> {
|
9
|
-
//props: DataEleImageProps;
|
10
|
-
status: ImgLoadStatus = 'no';
|
11
|
-
resizeable: boolean = true;
|
12
|
-
constructor() {
|
13
|
-
super('data-ele-img');
|
14
|
-
this.props = new DataEleImageProps();
|
15
|
-
//this.addPropValueChangedSub(this.props);
|
16
|
-
this.cursorType = 'move'
|
17
|
-
this.focusable = true;
|
18
|
-
}
|
19
|
-
createRenderObject(): LeafRenderObject {
|
20
|
-
const render = new DataImageRenderObject(this);
|
21
|
-
render.rect.width = this.props.width + 2;
|
22
|
-
render.rect.height = this.props.height + 2;
|
23
|
-
return render;
|
24
|
-
}
|
25
|
-
serialize(options: ViewOptions): SerializeProps {
|
26
|
-
return {
|
27
|
-
type: 'data-ele-img',
|
28
|
-
props: {
|
29
|
-
...this.props.getSerializeProps(options)
|
30
|
-
}
|
31
|
-
}
|
32
|
-
}
|
33
|
-
clone(data: boolean): Element {
|
34
|
-
const clone = new DataElementImage();
|
35
|
-
this.props.clone(clone.props);
|
36
|
-
return clone;
|
37
|
-
}
|
38
|
-
|
39
|
-
loadImage(ctx: RenderContenxtType): void {
|
40
|
-
if (this.status === 'no') {
|
41
|
-
this.status = 'loading';
|
42
|
-
const onCallback = (status: ImgLoadStatus) => {
|
43
|
-
this.status = status;
|
44
|
-
if (status === 'completed') {
|
45
|
-
this.refreshView();
|
46
|
-
}
|
47
|
-
}
|
48
|
-
ctx.docCtx.imageLoader.loadImage(this.props.src, onCallback);
|
49
|
-
}
|
50
|
-
}
|
51
|
-
destroy(): void {
|
52
|
-
super.destroy();
|
53
|
-
}
|
54
|
-
|
55
|
-
setValue(val: any): void {
|
56
|
-
if (this.getValue() === val) {
|
57
|
-
return;
|
58
|
-
}
|
59
|
-
this.props.src = val as string;
|
60
|
-
}
|
61
|
-
|
62
|
-
getValue(): string {
|
63
|
-
return this.props.src;
|
64
|
-
}
|
65
|
-
}
|
66
|
-
|
67
|
-
export class DataImageRenderObject extends ResizeLeafRenderObject {
|
68
|
-
render(ctx: RenderContenxtType, position: { x: number; y: number; }): void {
|
69
|
-
const dataImgElement = this.element as DataElementImage;
|
70
|
-
const picProps = dataImgElement.props;
|
71
|
-
if (dataImgElement.status === 'no') {
|
72
|
-
dataImgElement.loadImage(ctx);
|
73
|
-
return;
|
74
|
-
}
|
75
|
-
if (dataImgElement.status === 'completed') {
|
76
|
-
const imageSource = ctx.docCtx.imageLoader.getImage(picProps.src);
|
77
|
-
if (!imageSource) {
|
78
|
-
return;
|
79
|
-
}
|
80
|
-
if (picProps.border === 'all') {
|
81
|
-
ctx.contentContext.strokeRect(position.x, position.y, this.rect.width, this.rect.height, 'black');
|
82
|
-
}
|
83
|
-
ctx.contentContext.drawImage(imageSource, 0, 0, imageSource.naturalWidth, imageSource.naturalHeight, position.x + 2, position.y + 2, picProps.width, picProps.height);
|
84
|
-
}
|
85
|
-
if (ctx.drawMode === 'view') {
|
86
|
-
let { x, y } = position;
|
87
|
-
const { width, height } = this.rect;
|
88
|
-
const lineWidth = 5;
|
89
|
-
const paintColor = '#0050b3';
|
90
|
-
ctx.contentContext.strokeLines([{ x: x + lineWidth, y }, { x, y }, { x, y: y + height }, { x: x + lineWidth, y: y + height }], 1, paintColor);
|
91
|
-
x = x + width;
|
92
|
-
ctx.contentContext.strokeLines([{ x: x - lineWidth, y }, { x, y }, { x, y: y + height }, { x: x - lineWidth, y: y + height }], 1, paintColor);
|
93
|
-
}
|
94
|
-
}
|
95
|
-
clone(): RenderObject {
|
96
|
-
const clone = new DataImageRenderObject(this.element);
|
97
|
-
clone.rect = ElementUtil.cloneRect(this.rect);
|
98
|
-
return clone;
|
99
|
-
}
|
100
|
-
|
101
|
-
pagePaintCompleted(ctx: RenderContenxtType, pos: Position): void {
|
102
|
-
if (this.element.isFocused) {
|
103
|
-
const { width, height } = this.rect;
|
104
|
-
ctx.contentContext.strokeRect(pos.x, pos.y, this.rect.width, this.rect.height, '#1890ff', 0.5);
|
105
|
-
this.drawResizeCircle(ctx, pos.x, pos.y);
|
106
|
-
this.drawResizeCircle(ctx, pos.x + width, pos.y);
|
107
|
-
this.drawResizeCircle(ctx, pos.x, pos.y + height);
|
108
|
-
this.drawResizeCircle(ctx, pos.x + width, pos.y + height);
|
109
|
-
this.drawResizeCircle(ctx, pos.x + (Math.floor(width / 2)), pos.y);
|
110
|
-
this.drawResizeCircle(ctx, pos.x + (Math.floor(width / 2)), pos.y + height);
|
111
|
-
this.drawResizeCircle(ctx, pos.x, pos.y + (Math.floor(height / 2)));
|
112
|
-
this.drawResizeCircle(ctx, pos.x + width, pos.y + (Math.floor(height / 2)));
|
113
|
-
}
|
114
|
-
}
|
115
|
-
|
116
|
-
private drawResizeCircle(ctx: RenderContenxtType, x: number, y: number): void {
|
117
|
-
const ctxNative = ctx.contentContext.ctx;
|
118
|
-
ctxNative.save();
|
119
|
-
ctxNative.fillStyle = '#69c0ff';
|
120
|
-
ctxNative.beginPath();
|
121
|
-
ctxNative.arc(x, y, Math.floor(4 / 5 * 4), 0, 2 * Math.PI);
|
122
|
-
ctxNative.closePath();
|
123
|
-
ctxNative.fill();
|
124
|
-
ctxNative.restore();
|
125
|
-
}
|
126
|
-
}
|
127
|
-
|
128
|
-
|
129
|
-
export class DataElementImgFactory extends ElementFactory<DataEleImageProps> {
|
130
|
-
match(type: string): boolean {
|
131
|
-
return type === 'data-ele-img';
|
132
|
-
}
|
133
|
-
createElement(data: readElementProps<DataEleImageProps>, renderCtx: RenderContenxtType): Element {
|
134
|
-
const props = data.props as DataEleImageProps;
|
135
|
-
const pic = new DataElementImage();
|
136
|
-
ElementUtil.readEleBaseProps(pic.props, props);
|
137
|
-
//pic.props.id = props.id ?? nanoid(5);
|
138
|
-
//pic.props.name = props.name;
|
139
|
-
//pic.props.caption = props.caption;
|
140
|
-
//pic.props.type = props.type;
|
141
|
-
pic.props.width = props.width;
|
142
|
-
pic.props.height = props.height;
|
143
|
-
pic.props.src = props.src;
|
144
|
-
pic.props.border = props.border || 'all';
|
145
|
-
return pic;
|
146
|
-
}
|
147
|
-
}
|
@@ -1,142 +0,0 @@
|
|
1
|
-
import { Element, ElementFactory, readElementProps, SerializeProps, ViewOptions } from "@/med_editor/framework/element-define";
|
2
|
-
import { DataEleListProps, DataEleBaseTextProps } 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 { RenderObject } from "@/med_editor/framework/render-define";
|
6
|
-
import { ElementSerialize } from "../../element-serialize";
|
7
|
-
import { TextGroupElement } from "../text/text-impl";
|
8
|
-
import { DataElementInlineGroup, DataElementRenderObject } from "./data-element-base-impl";
|
9
|
-
|
10
|
-
export class DataElementList extends DataElementInlineGroup<DataEleListProps> {
|
11
|
-
//props: DataEleListProps;
|
12
|
-
constructor() {
|
13
|
-
super('data-ele-list');
|
14
|
-
this.props = new DataEleListProps();
|
15
|
-
}
|
16
|
-
|
17
|
-
createRenderObject(): RenderObject {
|
18
|
-
return new DataElementListRenderObject(this);
|
19
|
-
}
|
20
|
-
|
21
|
-
serialize(viewOptions: ViewOptions): SerializeProps & any {
|
22
|
-
return {
|
23
|
-
type: this.type,
|
24
|
-
props: {
|
25
|
-
...this.props.getSerializeProps(viewOptions)
|
26
|
-
}
|
27
|
-
}
|
28
|
-
}
|
29
|
-
|
30
|
-
clone(data: boolean): DataElementList {
|
31
|
-
const clone = new DataElementList();
|
32
|
-
this.props.clone(clone.props);
|
33
|
-
if (data) {
|
34
|
-
const length = this.length;
|
35
|
-
for (let i = 0; i < length; i++) {
|
36
|
-
const child = this.getChild(i);
|
37
|
-
if (child !== this.startDecorate && child !== this.endDecorate) {
|
38
|
-
clone.addChild(child.clone(true));
|
39
|
-
}
|
40
|
-
}
|
41
|
-
}
|
42
|
-
return clone;
|
43
|
-
}
|
44
|
-
|
45
|
-
setValue(vals: string[]): void {
|
46
|
-
if (this.getValue() === vals.join(';')) {
|
47
|
-
return;
|
48
|
-
}
|
49
|
-
this.pubOnChange('self');
|
50
|
-
this.clearInnerItems();
|
51
|
-
if (this.props.multiSelect) {
|
52
|
-
for (let i = 0; i < vals.length; i++) {
|
53
|
-
const val = vals[i];
|
54
|
-
const option = this.props.options.find(item => item.code === val);
|
55
|
-
if (option) {
|
56
|
-
const valueText = new TextGroupElement();
|
57
|
-
this.props.valueTextProps.clone(valueText.props);
|
58
|
-
const splitSymbol = i < vals.length - 1 ? ';' : ''
|
59
|
-
valueText.text = option.value + splitSymbol;
|
60
|
-
this.addChild(valueText, this.length - 1);
|
61
|
-
}
|
62
|
-
}
|
63
|
-
} else {
|
64
|
-
if (vals.length > 1) {
|
65
|
-
console.warn('当前下拉框是单选模式,不能传入多个值')
|
66
|
-
}
|
67
|
-
const val = vals[0];
|
68
|
-
const option = this.props.options.find(item => item.code === val);
|
69
|
-
if (option) {
|
70
|
-
const valueText = new TextGroupElement();
|
71
|
-
this.props.valueTextProps.clone(valueText.props);
|
72
|
-
valueText.text = option.value;
|
73
|
-
this.addChild(valueText, this.length - 1);
|
74
|
-
}
|
75
|
-
}
|
76
|
-
this.beginMeasure();
|
77
|
-
}
|
78
|
-
|
79
|
-
getValue(): string {
|
80
|
-
const values = ElementSerialize.serializeString(this);
|
81
|
-
if (!values) {
|
82
|
-
return '';
|
83
|
-
}
|
84
|
-
const valueItems = values.split(';');
|
85
|
-
const valueCode: Array<string> = [];
|
86
|
-
for (const valueItem of valueItems) {
|
87
|
-
const option = this.props.options.find(item => item.value === valueItem);
|
88
|
-
if (option) {
|
89
|
-
valueCode.push(option.code)
|
90
|
-
} else {
|
91
|
-
valueCode.push(option + '')
|
92
|
-
}
|
93
|
-
}
|
94
|
-
return valueCode.join(';')
|
95
|
-
}
|
96
|
-
}
|
97
|
-
|
98
|
-
|
99
|
-
export class DataElementListRenderObject extends DataElementRenderObject<DataElementList> {
|
100
|
-
constructor(element: DataElementList) {
|
101
|
-
super(element);
|
102
|
-
}
|
103
|
-
clone(): RenderObject {
|
104
|
-
const cloneRender = new DataElementListRenderObject(this.element);
|
105
|
-
cloneRender.rect = ElementUtil.cloneRect(this.rect);
|
106
|
-
for (let i = 0; i < this.length; i++) {
|
107
|
-
cloneRender.addChild(this.getChild(i).clone());
|
108
|
-
}
|
109
|
-
return cloneRender;
|
110
|
-
}
|
111
|
-
|
112
|
-
}
|
113
|
-
|
114
|
-
export class DataElementListFactory extends ElementFactory<DataEleListProps> {
|
115
|
-
match(type: string): boolean {
|
116
|
-
return type === "data-ele-list"
|
117
|
-
}
|
118
|
-
createElement(data: readElementProps<DataEleListProps>, renderCtx: RenderContenxtType): Element {
|
119
|
-
const props = data.props as DataEleListProps;
|
120
|
-
const ele = new DataElementList();
|
121
|
-
this.createDataEleProps(ele.props, props);
|
122
|
-
return ele;
|
123
|
-
}
|
124
|
-
|
125
|
-
createDataEleProps(dest: DataEleListProps, props: DataEleListProps): DataEleBaseTextProps {
|
126
|
-
const dataEleProps: DataEleListProps = dest;
|
127
|
-
ElementUtil.readEleBaseProps(dataEleProps, props);
|
128
|
-
//dataEleProps.id = props.id ?? nanoid(5);
|
129
|
-
//dataEleProps.name = props.name;
|
130
|
-
//dataEleProps.caption = props.caption;
|
131
|
-
//dataEleProps.type = props.type;
|
132
|
-
dataEleProps.nullText = props.nullText;
|
133
|
-
dataEleProps.nullTextProps = ElementUtil.readTextProps(null, props.nullTextProps, this.options);
|
134
|
-
dataEleProps.valueTextProps = ElementUtil.readTextProps(null, props.valueTextProps, this.options);
|
135
|
-
const options = props.options || [];
|
136
|
-
dataEleProps.multiSelect = props.multiSelect;
|
137
|
-
dataEleProps.options = [...options];
|
138
|
-
dataEleProps.dropDownStyle = props.dropDownStyle;
|
139
|
-
return dataEleProps;
|
140
|
-
}
|
141
|
-
|
142
|
-
}
|
@@ -1,117 +0,0 @@
|
|
1
|
-
import { Element, ElementFactory, SerializeProps, ViewOptions } from "@/med_editor/framework/element-define";
|
2
|
-
import { DataEleBaseTextProps } 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 { RenderObject } from "@/med_editor/framework/render-define";
|
6
|
-
import { ElementSerialize } from "../../element-serialize";
|
7
|
-
import { TextGroupElement } from "../text/text-impl";
|
8
|
-
import { DataElementInlineGroup, DataElementRenderObject } from "./data-element-base-impl";
|
9
|
-
|
10
|
-
export class DataElementText extends DataElementInlineGroup<DataEleBaseTextProps> {
|
11
|
-
//props: DataEleBaseTextProps;
|
12
|
-
constructor() {
|
13
|
-
super('data-ele-text');
|
14
|
-
this.props = new DataEleBaseTextProps();
|
15
|
-
}
|
16
|
-
|
17
|
-
createRenderObject(): RenderObject {
|
18
|
-
return new DataElementTextRenderObject(this);
|
19
|
-
}
|
20
|
-
|
21
|
-
serialize(viewOptions: ViewOptions): SerializeProps & any {
|
22
|
-
return {
|
23
|
-
type: this.type,
|
24
|
-
props: {
|
25
|
-
...this.props.getSerializeProps(viewOptions)
|
26
|
-
}
|
27
|
-
}
|
28
|
-
}
|
29
|
-
|
30
|
-
clone(data: boolean): DataElementText {
|
31
|
-
const clone = new DataElementText();
|
32
|
-
this.props.clone(clone.props);
|
33
|
-
if (data) {
|
34
|
-
const length = this.length;
|
35
|
-
for (let i = 0; i < length; i++) {
|
36
|
-
const child = this.getChild(i);
|
37
|
-
if (child !== this.startDecorate && child !== this.endDecorate) {
|
38
|
-
clone.addChild(child.clone(true));
|
39
|
-
}
|
40
|
-
}
|
41
|
-
}
|
42
|
-
return clone;
|
43
|
-
}
|
44
|
-
|
45
|
-
setValue(val: string): void {
|
46
|
-
if (!this.startDecorate) {
|
47
|
-
return;
|
48
|
-
}
|
49
|
-
if (this.getValue() === val) {
|
50
|
-
return;
|
51
|
-
}
|
52
|
-
this.pubOnChange('self');
|
53
|
-
this.clearInnerItems();
|
54
|
-
if (val) {
|
55
|
-
const valueText = new TextGroupElement();
|
56
|
-
this.props.valueTextProps.clone(valueText.props);
|
57
|
-
valueText.text = val;
|
58
|
-
this.addChild(valueText, this.length - 1);
|
59
|
-
}
|
60
|
-
this.beginMeasure();
|
61
|
-
}
|
62
|
-
|
63
|
-
getValue(): string {
|
64
|
-
return ElementSerialize.serializeString(this, { all: false });
|
65
|
-
}
|
66
|
-
|
67
|
-
validate(): string {
|
68
|
-
let error = super.validate();
|
69
|
-
if (error) {
|
70
|
-
return error;
|
71
|
-
}
|
72
|
-
return '';
|
73
|
-
|
74
|
-
}
|
75
|
-
}
|
76
|
-
|
77
|
-
export class DataElementTextRenderObject extends DataElementRenderObject<DataElementText> {
|
78
|
-
constructor(element: DataElementText) {
|
79
|
-
super(element);
|
80
|
-
}
|
81
|
-
clone(): RenderObject {
|
82
|
-
const cloneRender = new DataElementTextRenderObject(this.element);
|
83
|
-
cloneRender.rect = ElementUtil.cloneRect(this.rect);
|
84
|
-
for (let i = 0; i < this.length; i++) {
|
85
|
-
cloneRender.addChild(this.getChild(i).clone());
|
86
|
-
}
|
87
|
-
return cloneRender;
|
88
|
-
}
|
89
|
-
|
90
|
-
}
|
91
|
-
|
92
|
-
export class DataElementTextFactory extends ElementFactory<DataEleBaseTextProps> {
|
93
|
-
match(type: string): boolean {
|
94
|
-
return type === "data-ele-text"
|
95
|
-
}
|
96
|
-
createElement(data: any, renderCtx: RenderContenxtType): Element {
|
97
|
-
const props = data.props as DataEleBaseTextProps;
|
98
|
-
const ele = new DataElementText();
|
99
|
-
this.createDataEleProps(ele.props, props);
|
100
|
-
return ele;
|
101
|
-
}
|
102
|
-
|
103
|
-
createDataEleProps(dest: DataEleBaseTextProps, props: DataEleBaseTextProps): DataEleBaseTextProps {
|
104
|
-
const dataEleProps: DataEleBaseTextProps = dest;
|
105
|
-
ElementUtil.readEleBaseProps(dataEleProps, props);
|
106
|
-
//dataEleProps.id = props.id ?? nanoid(5);
|
107
|
-
//dataEleProps.name = props.name;
|
108
|
-
//dataEleProps.caption = props.caption;
|
109
|
-
//dataEleProps.type = props.type;
|
110
|
-
dataEleProps.nullText = props.nullText;
|
111
|
-
dataEleProps.nullTextProps = ElementUtil.readTextProps(null, props.nullTextProps, this.options);
|
112
|
-
dataEleProps.valueTextProps = ElementUtil.readTextProps(null, props.valueTextProps, this.options);
|
113
|
-
dataEleProps.dataType = props.dataType;
|
114
|
-
return dataEleProps;
|
115
|
-
}
|
116
|
-
|
117
|
-
}
|
@@ -1,48 +0,0 @@
|
|
1
|
-
import { Element, LeafElement, SerializeProps, ViewOptions } from "../../element-define";
|
2
|
-
import { ElementUtil } from "../../element-util";
|
3
|
-
import { RenderContenxtType } from "../../render-context";
|
4
|
-
import { LeafRenderObject, RenderObject } from "../../render-define";
|
5
|
-
|
6
|
-
/**
|
7
|
-
* 当前数据元内容长度小于最小长度时,需要当前元素撑开以达到最小长度
|
8
|
-
*/
|
9
|
-
export class FillNullSpaceElement extends LeafElement {
|
10
|
-
//需要填充的长度
|
11
|
-
length!: number;
|
12
|
-
constructor() {
|
13
|
-
super('fill-null');
|
14
|
-
this.isDecorate = true;
|
15
|
-
this.disableClick = true;
|
16
|
-
}
|
17
|
-
createRenderObject(options: ViewOptions, renderCtx: RenderContenxtType): RenderObject {
|
18
|
-
return new FillNullSpaceRenderObject();
|
19
|
-
}
|
20
|
-
serialize(viewOptions: ViewOptions): SerializeProps {
|
21
|
-
throw new Error("Method not implemented.");
|
22
|
-
}
|
23
|
-
clone(data: boolean): Element {
|
24
|
-
//throw new Error("Method not implemented.");
|
25
|
-
return new FillNullSpaceElement();
|
26
|
-
}
|
27
|
-
|
28
|
-
}
|
29
|
-
|
30
|
-
|
31
|
-
export class FillNullSpaceRenderObject extends LeafRenderObject {
|
32
|
-
constructor() {
|
33
|
-
super(null);
|
34
|
-
this.disableClick = true;
|
35
|
-
}
|
36
|
-
render(ctx: RenderContenxtType, position: { x: number; y: number; }): void {
|
37
|
-
//throw new Error("Method not implemented.");
|
38
|
-
if (ctx.viewOptions.showDebug) {
|
39
|
-
ctx.contentContext.fillRect(position.x, position.y, this.rect.width, this.rect.height, 'red');
|
40
|
-
}
|
41
|
-
}
|
42
|
-
clone(): RenderObject {
|
43
|
-
const clone = new FillNullSpaceRenderObject();
|
44
|
-
clone.rect = ElementUtil.cloneRect(this.rect);
|
45
|
-
return clone;
|
46
|
-
}
|
47
|
-
|
48
|
-
}
|