@hailin-zheng/editor-core 1.0.4 → 1.0.7
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/{dist → lib}/doc-ruler.d.ts +0 -0
- package/{dist → lib}/doc-ruler.js +0 -0
- package/{dist → lib}/doc-ruler.js.map +0 -0
- package/{dist → lib}/framework/common-util.d.ts +0 -0
- package/{dist → lib}/framework/common-util.js +0 -0
- package/{dist → lib}/framework/common-util.js.map +0 -0
- package/{dist → lib}/framework/document-change.d.ts +0 -0
- package/{dist → lib}/framework/document-change.js +0 -0
- package/{dist → lib}/framework/document-change.js.map +0 -0
- package/{dist → lib}/framework/document-combine.d.ts +0 -0
- package/{dist → lib}/framework/document-combine.js +0 -0
- package/{dist → lib}/framework/document-combine.js.map +0 -0
- package/{dist → lib}/framework/document-comment.d.ts +0 -0
- package/{dist → lib}/framework/document-comment.js +0 -0
- package/{dist → lib}/framework/document-comment.js.map +0 -0
- package/{dist → lib}/framework/document-context.d.ts +0 -0
- package/{dist → lib}/framework/document-context.js +0 -0
- package/{dist → lib}/framework/document-context.js.map +0 -0
- package/{dist → lib}/framework/document-eval-func.d.ts +0 -0
- package/{dist → lib}/framework/document-eval-func.js +0 -0
- package/{dist → lib}/framework/document-eval-func.js.map +0 -0
- package/{dist → lib}/framework/document-event.d.ts +0 -0
- package/{dist → lib}/framework/document-event.js +0 -0
- package/{dist → lib}/framework/document-event.js.map +0 -0
- package/{dist → lib}/framework/document-history.d.ts +0 -0
- package/{dist → lib}/framework/document-history.js +0 -0
- package/{dist → lib}/framework/document-history.js.map +0 -0
- package/{dist → lib}/framework/document-images-loader.d.ts +0 -0
- package/{dist → lib}/framework/document-images-loader.js +0 -0
- package/{dist → lib}/framework/document-images-loader.js.map +0 -0
- package/{dist → lib}/framework/document-input-cursor.d.ts +0 -0
- package/{dist → lib}/framework/document-input-cursor.js +0 -0
- package/{dist → lib}/framework/document-input-cursor.js.map +0 -0
- package/{dist → lib}/framework/document-paint.d.ts +0 -0
- package/{dist → lib}/framework/document-paint.js +0 -0
- package/{dist → lib}/framework/document-paint.js.map +0 -0
- package/{dist → lib}/framework/document-print-offscreen.d.ts +0 -0
- package/{dist → lib}/framework/document-print-offscreen.js +0 -0
- package/{dist → lib}/framework/document-print-offscreen.js.map +0 -0
- package/{dist → lib}/framework/document-print.d.ts +0 -0
- package/{dist → lib}/framework/document-print.js +0 -0
- package/{dist → lib}/framework/document-print.js.map +0 -0
- package/{dist → lib}/framework/document-segmenter.d.ts +0 -0
- package/{dist → lib}/framework/document-segmenter.js +0 -0
- package/{dist → lib}/framework/document-segmenter.js.map +0 -0
- package/{dist → lib}/framework/document-selection.d.ts +0 -0
- package/{dist → lib}/framework/document-selection.js +0 -0
- package/{dist → lib}/framework/document-selection.js.map +0 -0
- package/{dist → lib}/framework/document-template.d.ts +0 -0
- package/{dist → lib}/framework/document-template.js +0 -0
- package/{dist → lib}/framework/document-template.js.map +0 -0
- package/{dist → lib}/framework/document-textline-mode.d.ts +0 -0
- package/{dist → lib}/framework/document-textline-mode.js +0 -0
- package/{dist → lib}/framework/document-textline-mode.js.map +0 -0
- package/{dist → lib}/framework/element-define.d.ts +0 -0
- package/{dist → lib}/framework/element-define.js +0 -0
- package/{dist → lib}/framework/element-define.js.map +0 -0
- package/{dist → lib}/framework/element-event-define.d.ts +0 -0
- package/{dist → lib}/framework/element-event-define.js +0 -0
- package/{dist → lib}/framework/element-event-define.js.map +0 -0
- package/{dist → lib}/framework/element-measure.d.ts +0 -0
- package/{dist → lib}/framework/element-measure.js +0 -0
- package/{dist → lib}/framework/element-measure.js.map +0 -0
- package/{dist → lib}/framework/element-paint.d.ts +0 -0
- package/{dist → lib}/framework/element-paint.js +0 -0
- package/{dist → lib}/framework/element-paint.js.map +0 -0
- package/{dist → lib}/framework/element-props.d.ts +0 -0
- package/{dist → lib}/framework/element-props.js +0 -0
- package/{dist → lib}/framework/element-props.js.map +0 -0
- package/{dist → lib}/framework/element-reader.d.ts +0 -0
- package/{dist → lib}/framework/element-reader.js +0 -0
- package/{dist → lib}/framework/element-reader.js.map +0 -0
- package/{dist → lib}/framework/element-render-cut.d.ts +0 -0
- package/{dist → lib}/framework/element-render-cut.js +0 -0
- package/{dist → lib}/framework/element-render-cut.js.map +0 -0
- package/{dist → lib}/framework/element-serialize.d.ts +0 -0
- package/{dist → lib}/framework/element-serialize.js +0 -0
- package/{dist → lib}/framework/element-serialize.js.map +0 -0
- package/{dist → lib}/framework/element-util.d.ts +0 -0
- package/{dist → lib}/framework/element-util.js +0 -0
- package/{dist → lib}/framework/element-util.js.map +0 -0
- package/{dist → lib}/framework/impl/checkbox/checkbox-impl.d.ts +0 -0
- package/{dist → lib}/framework/impl/checkbox/checkbox-impl.js +0 -0
- package/{dist → lib}/framework/impl/checkbox/checkbox-impl.js.map +0 -0
- package/{dist → lib}/framework/impl/comments/comment-content-impl.d.ts +0 -0
- package/{dist → lib}/framework/impl/comments/comment-content-impl.js +0 -0
- package/{dist → lib}/framework/impl/comments/comment-content-impl.js.map +0 -0
- package/{dist → lib}/framework/impl/comments/comment-element-impl.d.ts +0 -0
- package/{dist → lib}/framework/impl/comments/comment-element-impl.js +0 -0
- package/{dist → lib}/framework/impl/comments/comment-element-impl.js.map +0 -0
- package/{dist → lib}/framework/impl/comments/comments-container-impl.d.ts +0 -0
- package/{dist → lib}/framework/impl/comments/comments-container-impl.js +0 -0
- package/{dist → lib}/framework/impl/comments/comments-container-impl.js.map +0 -0
- package/{dist → lib}/framework/impl/comments/comments-util.d.ts +0 -0
- package/{dist → lib}/framework/impl/comments/comments-util.js +0 -0
- package/{dist → lib}/framework/impl/comments/comments-util.js.map +0 -0
- package/{dist → lib}/framework/impl/comments/validate-msg-impl.d.ts +0 -0
- package/{dist → lib}/framework/impl/comments/validate-msg-impl.js +0 -0
- package/{dist → lib}/framework/impl/comments/validate-msg-impl.js.map +0 -0
- package/{dist → lib}/framework/impl/data-element/data-decorate-impl.d.ts +0 -0
- package/{dist → lib}/framework/impl/data-element/data-decorate-impl.js +0 -0
- package/{dist → lib}/framework/impl/data-element/data-decorate-impl.js.map +0 -0
- package/{dist → lib}/framework/impl/data-element/data-element-barcode.d.ts +0 -0
- package/{dist → lib}/framework/impl/data-element/data-element-barcode.js +0 -0
- package/{dist → lib}/framework/impl/data-element/data-element-barcode.js.map +0 -0
- package/{dist → lib}/framework/impl/data-element/data-element-base-impl.d.ts +0 -0
- package/{dist → lib}/framework/impl/data-element/data-element-base-impl.js +0 -0
- package/{dist → lib}/framework/impl/data-element/data-element-base-impl.js.map +0 -0
- package/{dist → lib}/framework/impl/data-element/data-element-check-impl.d.ts +0 -0
- package/{dist → lib}/framework/impl/data-element/data-element-check-impl.js +0 -0
- package/{dist → lib}/framework/impl/data-element/data-element-check-impl.js.map +0 -0
- package/{dist → lib}/framework/impl/data-element/data-element-date-impl.d.ts +0 -0
- package/{dist → lib}/framework/impl/data-element/data-element-date-impl.js +0 -0
- package/{dist → lib}/framework/impl/data-element/data-element-date-impl.js.map +0 -0
- package/{dist → lib}/framework/impl/data-element/data-element-group-impl.d.ts +0 -0
- package/{dist → lib}/framework/impl/data-element/data-element-group-impl.js +0 -0
- package/{dist → lib}/framework/impl/data-element/data-element-group-impl.js.map +0 -0
- package/{dist → lib}/framework/impl/data-element/data-element-image-impl.d.ts +0 -0
- package/{dist → lib}/framework/impl/data-element/data-element-image-impl.js +0 -0
- package/{dist → lib}/framework/impl/data-element/data-element-image-impl.js.map +0 -0
- package/{dist → lib}/framework/impl/data-element/data-element-list-impl.d.ts +0 -0
- package/{dist → lib}/framework/impl/data-element/data-element-list-impl.js +0 -0
- package/{dist → lib}/framework/impl/data-element/data-element-list-impl.js.map +0 -0
- package/{dist → lib}/framework/impl/data-element/data-element-text-impl.d.ts +0 -0
- package/{dist → lib}/framework/impl/data-element/data-element-text-impl.js +0 -0
- package/{dist → lib}/framework/impl/data-element/data-element-text-impl.js.map +0 -0
- package/{dist → lib}/framework/impl/decorate/fill-null-space-imple.d.ts +0 -0
- package/{dist → lib}/framework/impl/decorate/fill-null-space-imple.js +0 -0
- package/{dist → lib}/framework/impl/decorate/fill-null-space-imple.js.map +0 -0
- package/{dist → lib}/framework/impl/document/doc-body-impl.d.ts +0 -0
- package/{dist → lib}/framework/impl/document/doc-body-impl.js +0 -0
- package/{dist → lib}/framework/impl/document/doc-body-impl.js.map +0 -0
- package/{dist → lib}/framework/impl/document/doc-body-part-impl.d.ts +0 -0
- package/{dist → lib}/framework/impl/document/doc-body-part-impl.js +0 -0
- package/{dist → lib}/framework/impl/document/doc-body-part-impl.js.map +0 -0
- package/{dist → lib}/framework/impl/document/doc-container-impl.d.ts +0 -0
- package/{dist → lib}/framework/impl/document/doc-container-impl.js +0 -0
- package/{dist → lib}/framework/impl/document/doc-container-impl.js.map +0 -0
- package/{dist → lib}/framework/impl/document/doc-footer-impl.d.ts +0 -0
- package/{dist → lib}/framework/impl/document/doc-footer-impl.js +0 -0
- package/{dist → lib}/framework/impl/document/doc-footer-impl.js.map +0 -0
- package/{dist → lib}/framework/impl/document/doc-header-impl.d.ts +0 -0
- package/{dist → lib}/framework/impl/document/doc-header-impl.js +0 -0
- package/{dist → lib}/framework/impl/document/doc-header-impl.js.map +0 -0
- package/{dist → lib}/framework/impl/document/doc-impl.d.ts +0 -0
- package/{dist → lib}/framework/impl/document/doc-impl.js +0 -0
- package/{dist → lib}/framework/impl/document/doc-impl.js.map +0 -0
- package/{dist → lib}/framework/impl/media-formula/menstrual-history.d.ts +0 -0
- package/{dist → lib}/framework/impl/media-formula/menstrual-history.js +0 -0
- package/{dist → lib}/framework/impl/media-formula/menstrual-history.js.map +0 -0
- package/{dist → lib}/framework/impl/paragraph/p-impl.d.ts +0 -0
- package/{dist → lib}/framework/impl/paragraph/p-impl.js +0 -0
- package/{dist → lib}/framework/impl/paragraph/p-impl.js.map +0 -0
- package/{dist → lib}/framework/impl/picture/image-impl.d.ts +0 -0
- package/{dist → lib}/framework/impl/picture/image-impl.js +0 -0
- package/{dist → lib}/framework/impl/picture/image-impl.js.map +0 -0
- package/{dist → lib}/framework/impl/radio/radio-impl.d.ts +0 -0
- package/{dist → lib}/framework/impl/radio/radio-impl.js +0 -0
- package/{dist → lib}/framework/impl/radio/radio-impl.js.map +0 -0
- package/{dist → lib}/framework/impl/symbol/br-symbol-impl.d.ts +0 -0
- package/{dist → lib}/framework/impl/symbol/br-symbol-impl.js +0 -0
- package/{dist → lib}/framework/impl/symbol/br-symbol-impl.js.map +0 -0
- package/{dist → lib}/framework/impl/symbol/p-symbol-impl.d.ts +0 -0
- package/{dist → lib}/framework/impl/symbol/p-symbol-impl.js +0 -0
- package/{dist → lib}/framework/impl/symbol/p-symbol-impl.js.map +0 -0
- package/{dist → lib}/framework/impl/table/table-cell-impl.d.ts +0 -0
- package/{dist → lib}/framework/impl/table/table-cell-impl.js +0 -0
- package/{dist → lib}/framework/impl/table/table-cell-impl.js.map +0 -0
- package/{dist → lib}/framework/impl/table/table-impl.d.ts +0 -0
- package/{dist → lib}/framework/impl/table/table-impl.js +0 -0
- package/{dist → lib}/framework/impl/table/table-impl.js.map +0 -0
- package/{dist → lib}/framework/impl/table/table-row-impl.d.ts +0 -0
- package/{dist → lib}/framework/impl/table/table-row-impl.js +0 -0
- package/{dist → lib}/framework/impl/table/table-row-impl.js.map +0 -0
- package/{dist → lib}/framework/impl/table/table-split-cell-patch.d.ts +0 -0
- package/{dist → lib}/framework/impl/table/table-split-cell-patch.js +0 -0
- package/{dist → lib}/framework/impl/table/table-split-cell-patch.js.map +0 -0
- package/{dist → lib}/framework/impl/table/table-split-cell.d.ts +0 -0
- package/{dist → lib}/framework/impl/table/table-split-cell.js +0 -0
- package/{dist → lib}/framework/impl/table/table-split-cell.js.map +0 -0
- package/{dist → lib}/framework/impl/table/table-util.d.ts +0 -0
- package/{dist → lib}/framework/impl/table/table-util.js +0 -0
- package/{dist → lib}/framework/impl/table/table-util.js.map +0 -0
- package/{dist → lib}/framework/impl/text/text-impl.d.ts +0 -0
- package/{dist → lib}/framework/impl/text/text-impl.js +0 -0
- package/{dist → lib}/framework/impl/text/text-impl.js.map +0 -0
- package/{dist → lib}/framework/impl/text/track-run-impl.d.ts +0 -0
- package/{dist → lib}/framework/impl/text/track-run-impl.js +0 -0
- package/{dist → lib}/framework/impl/text/track-run-impl.js.map +0 -0
- package/{dist → lib}/framework/notify.d.ts +0 -0
- package/{dist → lib}/framework/notify.js +0 -0
- package/{dist → lib}/framework/notify.js.map +0 -0
- package/{dist → lib}/framework/range-util.d.ts +0 -0
- package/{dist → lib}/framework/range-util.js +0 -0
- package/{dist → lib}/framework/range-util.js.map +0 -0
- package/{dist → lib}/framework/render-context.d.ts +0 -0
- package/{dist → lib}/framework/render-context.js +0 -0
- package/{dist → lib}/framework/render-context.js.map +0 -0
- package/{dist → lib}/framework/render-define.d.ts +0 -0
- package/{dist → lib}/framework/render-define.js +0 -0
- package/{dist → lib}/framework/render-define.js.map +0 -0
- package/{dist → lib}/framework/selection-overlays.d.ts +0 -0
- package/{dist → lib}/framework/selection-overlays.js +0 -0
- package/{dist → lib}/framework/selection-overlays.js.map +0 -0
- package/{dist → lib}/texteditor.d.ts +0 -0
- package/{dist → lib}/texteditor.js +0 -0
- package/{dist → lib}/texteditor.js.map +0 -0
- package/{dist → lib}/util/subject.d.ts +0 -0
- package/{dist → lib}/util/subject.js +0 -0
- package/{dist → lib}/util/subject.js.map +0 -0
- package/{dist → lib}/util/table-bind.d.ts +0 -0
- package/{dist → lib}/util/table-bind.js +0 -0
- package/{dist → lib}/util/table-bind.js.map +0 -0
- package/package.json +7 -2
- 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/webpack.config.js +0 -46
@@ -1,175 +0,0 @@
|
|
1
|
-
import { CommonUtil } from "@/med_editor/framework/common-util";
|
2
|
-
import { ViewOptions, Element, SerializeProps, ElementFactory, readElementProps, Rect } from "../../element-define";
|
3
|
-
import { DataEleMHProps, TextProps } from "../../element-props";
|
4
|
-
import { ElementUtil } from "../../element-util";
|
5
|
-
import { RenderContenxtType } from "../../render-context";
|
6
|
-
import { LeafRenderObject, RenderObject } from "../../render-define";
|
7
|
-
import { DataElementLeaf } from "../data-element/data-element-base-impl";
|
8
|
-
|
9
|
-
/**
|
10
|
-
* 月经史
|
11
|
-
*/
|
12
|
-
export class DataElementMH extends DataElementLeaf<DataEleMHProps> {
|
13
|
-
//props!: DataEleMHProps;
|
14
|
-
constructor() {
|
15
|
-
super('data-ele-mh')
|
16
|
-
this.props = new DataEleMHProps();
|
17
|
-
//this.addPropValueChangedSub(this.props);
|
18
|
-
}
|
19
|
-
setValue(val: DataEleMHProps | string | null): void {
|
20
|
-
if (typeof val === 'string' && val) {
|
21
|
-
const items = val.split(';');
|
22
|
-
if (items.length >= 4) {
|
23
|
-
const mhLayoutItem = getMHItem(this.props.kind);
|
24
|
-
this.props[mhLayoutItem.left.prop] = items[0];
|
25
|
-
this.props[mhLayoutItem.top.prop] = items[1];
|
26
|
-
this.props[mhLayoutItem.bottom.prop] = items[2];
|
27
|
-
this.props[mhLayoutItem.right.prop] = items[3];
|
28
|
-
}
|
29
|
-
} else if (typeof val === 'object') {
|
30
|
-
this.props.age = val?.age ?? '';
|
31
|
-
this.props.days = val?.days ?? '';
|
32
|
-
this.props.cycles = val?.cycles ?? '';
|
33
|
-
this.props.lastDate = val?.lastDate ?? '';
|
34
|
-
this.props.closeAge = val?.closeAge ?? '';
|
35
|
-
}
|
36
|
-
}
|
37
|
-
|
38
|
-
getValue() {
|
39
|
-
const layoutItem = getMHItem(this.props.kind);
|
40
|
-
return `${this.props[layoutItem.left.prop]};${this.props[layoutItem.top.prop]};${this.props[layoutItem.bottom.prop]};${this.props[layoutItem.right.prop]}`;
|
41
|
-
}
|
42
|
-
|
43
|
-
createRenderObject(options: ViewOptions, renderCtx: RenderContenxtType): RenderObject<Element> | null {
|
44
|
-
const render = new DataRenderMH(this);
|
45
|
-
const measure = renderMH(this, renderCtx, { x: 0, y: 0 }, false);
|
46
|
-
if (measure) {
|
47
|
-
render.rect.width = measure.width;
|
48
|
-
render.rect.height = measure.height;
|
49
|
-
}
|
50
|
-
return render;
|
51
|
-
}
|
52
|
-
serialize(viewOptions: ViewOptions): SerializeProps | null {
|
53
|
-
return {
|
54
|
-
type: this.type,
|
55
|
-
props: this.props.getSerializeProps(viewOptions)
|
56
|
-
}
|
57
|
-
}
|
58
|
-
clone(data: boolean): Element {
|
59
|
-
const element = new DataElementMH();
|
60
|
-
this.props.clone(element.props);
|
61
|
-
return element;
|
62
|
-
}
|
63
|
-
|
64
|
-
getCurrentLayoutItem(): MHLayoutType {
|
65
|
-
return getMHItem(this.props.kind);
|
66
|
-
}
|
67
|
-
|
68
|
-
}
|
69
|
-
|
70
|
-
type MHLayoutType = {
|
71
|
-
[key in 'left' | 'top' | 'right' | 'bottom']: {
|
72
|
-
tip: '初潮年龄' | '行经期天数' | '末次月经时间' | '月经周期天数' | '闭经年龄',
|
73
|
-
prop: 'age' | 'days' | 'cycles' | 'lastDate' | 'closeAge'
|
74
|
-
}
|
75
|
-
}
|
76
|
-
|
77
|
-
const mhLayoutItems: Array<MHLayoutType> = [
|
78
|
-
{ left: { tip: '初潮年龄', prop: 'age' }, top: { tip: '行经期天数', prop: 'days' }, right: { tip: '末次月经时间', prop: 'lastDate' }, bottom: { tip: '月经周期天数', prop: 'cycles' } },
|
79
|
-
{ left: { tip: '初潮年龄', prop: 'age' }, top: { tip: '闭经年龄', prop: 'closeAge' }, right: { tip: '末次月经时间', prop: 'lastDate' }, bottom: { tip: '行经期天数', prop: 'days' } },
|
80
|
-
{ left: { tip: '闭经年龄', prop: 'closeAge' }, top: { tip: '行经期天数', prop: 'days' }, right: { tip: '末次月经时间', prop: 'lastDate' }, bottom: { tip: '月经周期天数', prop: 'cycles' } },
|
81
|
-
{ left: { tip: '初潮年龄', prop: 'age' }, top: { tip: '月经周期天数', prop: 'cycles' }, right: { tip: '末次月经时间', prop: 'lastDate' }, bottom: { tip: '行经期天数', prop: 'days' } },
|
82
|
-
{ left: { tip: '初潮年龄', prop: 'age' }, top: { tip: '闭经年龄', prop: 'closeAge' }, right: { tip: '末次月经时间', prop: 'lastDate' }, bottom: { tip: '月经周期天数', prop: 'cycles' } }
|
83
|
-
]
|
84
|
-
|
85
|
-
|
86
|
-
function getMHItem(kind: string): MHLayoutType {
|
87
|
-
kind = kind ?? 'A';
|
88
|
-
kind = kind.toUpperCase();
|
89
|
-
let kindIndex = ['A', 'B', 'C', 'D', 'E'].indexOf(kind);
|
90
|
-
kindIndex = kindIndex < 0 ? 0 : kindIndex;
|
91
|
-
return mhLayoutItems[kindIndex];
|
92
|
-
}
|
93
|
-
|
94
|
-
export class DataRenderMH extends LeafRenderObject<DataElementMH> {
|
95
|
-
render(ctx: RenderContenxtType, position: { x: number; y: number; }): void {
|
96
|
-
renderMH(this.element, ctx, position, true);
|
97
|
-
}
|
98
|
-
|
99
|
-
clone(): RenderObject<Element> {
|
100
|
-
const clone = new DataRenderMH(this.element);
|
101
|
-
clone.rect = ElementUtil.cloneRect(this.rect);
|
102
|
-
return clone;
|
103
|
-
}
|
104
|
-
}
|
105
|
-
|
106
|
-
export class DataElementMHFactory extends ElementFactory<DataEleMHProps> {
|
107
|
-
match(type: string): boolean {
|
108
|
-
return type === 'data-ele-mh'
|
109
|
-
}
|
110
|
-
createElement(data: readElementProps<DataEleMHProps>, renderCtx: RenderContenxtType): Element {
|
111
|
-
const ele = new DataElementMH();
|
112
|
-
ElementUtil.readEleBaseProps(ele.props, data.props as DataEleMHProps);
|
113
|
-
ele.props.age = data.props?.age ?? '';
|
114
|
-
ele.props.cycles = data.props?.cycles ?? '';
|
115
|
-
ele.props.days = data.props?.days ?? '';
|
116
|
-
ele.props.lastDate = data.props?.lastDate ?? '';
|
117
|
-
ele.props.closeAge = data.props?.closeAge ?? '';
|
118
|
-
ele.props.kind = data.props?.kind ?? 'A';
|
119
|
-
return ele;
|
120
|
-
}
|
121
|
-
|
122
|
-
}
|
123
|
-
|
124
|
-
function renderMH(element: DataElementMH, ctx: RenderContenxtType, position: { x: number; y: number; }, isPaint: boolean): { width: number, height: number } | void {
|
125
|
-
let { x, y } = position;
|
126
|
-
const defaultTextProps = new TextProps()
|
127
|
-
const paddingVer = 2;
|
128
|
-
const paddingHor = 5;
|
129
|
-
defaultTextProps.fontSize = 12;
|
130
|
-
defaultTextProps.fontName = '仿宋';
|
131
|
-
defaultTextProps.color = "rgb(0,0,0)";
|
132
|
-
const currentLayout = getMHItem(element.props.kind);
|
133
|
-
const left = CommonUtil.getEmptyValue(element.props[currentLayout.left.prop], currentLayout.left.tip);
|
134
|
-
const top = CommonUtil.getEmptyValue(element.props[currentLayout.top.prop], currentLayout.top.tip);
|
135
|
-
const bottom = CommonUtil.getEmptyValue(element.props[currentLayout.bottom.prop], currentLayout.bottom.tip);
|
136
|
-
const right = CommonUtil.getEmptyValue(element.props[currentLayout.right.prop], currentLayout.right.tip);
|
137
|
-
const leftRect = ctx.contentContext.measureText(left, defaultTextProps)
|
138
|
-
const topRect = ctx.contentContext.measureText(top, defaultTextProps)
|
139
|
-
const bottomRect = ctx.contentContext.measureText(bottom, defaultTextProps)
|
140
|
-
const rightRect = ctx.contentContext.measureText(right, defaultTextProps)
|
141
|
-
let height = topRect.height + bottomRect.height;
|
142
|
-
const middleWidth = Math.max(topRect.width, bottomRect.width)
|
143
|
-
let width = leftRect.width + middleWidth + rightRect.width;
|
144
|
-
if (!isPaint) {
|
145
|
-
return { width: width + paddingHor * 2, height: height + paddingVer * 2 }
|
146
|
-
}
|
147
|
-
x += paddingHor;
|
148
|
-
y += paddingVer;
|
149
|
-
//年龄
|
150
|
-
ctx.contentContext.drawText(left, defaultTextProps, x, y + (height - leftRect.height) / 2, leftRect.width, leftRect.height)
|
151
|
-
x += leftRect.width;
|
152
|
-
//天数
|
153
|
-
ctx.contentContext.drawText(top, defaultTextProps, x + (middleWidth - topRect.width) / 2, y - 2, topRect.width, topRect.height);
|
154
|
-
//分割线
|
155
|
-
ctx.contentContext.drawLine(x, y + topRect.height, middleWidth)
|
156
|
-
//周期
|
157
|
-
ctx.contentContext.drawText(bottom, defaultTextProps, x + (middleWidth - bottomRect.width) / 2, y + topRect.height + 2, bottomRect.width, bottomRect.height);
|
158
|
-
//末次时间
|
159
|
-
x += middleWidth;
|
160
|
-
ctx.contentContext.drawText(right, defaultTextProps, x, y + (height - leftRect.height) / 2, rightRect.width, rightRect.height)
|
161
|
-
|
162
|
-
if (ctx.drawMode === 'view') {
|
163
|
-
let { x, y } = position;
|
164
|
-
width = width + paddingHor * 2;
|
165
|
-
height = height + paddingVer * 2;
|
166
|
-
//const { width, height } = this.rect;
|
167
|
-
const lineWidth = 3;
|
168
|
-
const paintColor = '#0050b3';
|
169
|
-
ctx.contentContext.strokeLines([{ x: x + lineWidth, y }, { x, y }, { x, y: y + height }, { x: x + lineWidth, y: y + height }], 1, paintColor);
|
170
|
-
x = x + width;
|
171
|
-
ctx.contentContext.strokeLines([{ x: x - lineWidth, y }, { x, y }, { x, y: y + height }, { x: x - lineWidth, y: y + height }], 1, paintColor);
|
172
|
-
}
|
173
|
-
}
|
174
|
-
|
175
|
-
|
@@ -1,190 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
BlockContentElement,
|
3
|
-
ElementFactory,
|
4
|
-
Element,
|
5
|
-
SerializeProps,
|
6
|
-
ViewOptions,
|
7
|
-
readElementProps
|
8
|
-
} from "@/med_editor/framework/element-define";
|
9
|
-
import { ContextMenuElementEvent } from "@/med_editor/framework/element-event-define";
|
10
|
-
import { ParagraphProps } from "@/med_editor/framework/element-props";
|
11
|
-
import { ElementUtil } from "@/med_editor/framework/element-util";
|
12
|
-
import { RenderContenxtType } from "@/med_editor/framework/render-context";
|
13
|
-
import {
|
14
|
-
BlockLineRectRenderObject,
|
15
|
-
MuiltBlockLineRenderObject,
|
16
|
-
RenderObject
|
17
|
-
} from "@/med_editor/framework/render-define";
|
18
|
-
|
19
|
-
export class ParagraphElement extends BlockContentElement<ParagraphProps> {
|
20
|
-
//props: ParagraphProps;
|
21
|
-
constructor() {
|
22
|
-
super('p');
|
23
|
-
this.props = new ParagraphProps();
|
24
|
-
//this.addPropValueChangedSub(this.props);
|
25
|
-
this.addEvent('BackspaceKey', (evt) => {
|
26
|
-
if (evt.selectionState.collapsed) {
|
27
|
-
const pFirstLeafElement = ElementUtil.getFirstLeafElement(this);
|
28
|
-
if (pFirstLeafElement === evt.source && evt.sourceOffset === 0) {
|
29
|
-
if (this.props.numberType >= 0) {
|
30
|
-
this.props.numberType = -1;
|
31
|
-
evt.isCancel = true;
|
32
|
-
} else if (this.props.indent) {
|
33
|
-
this.props.indent = 0;
|
34
|
-
evt.isCancel = true;
|
35
|
-
}
|
36
|
-
}
|
37
|
-
}
|
38
|
-
|
39
|
-
}, true);
|
40
|
-
this.addEvent<ContextMenuElementEvent>('ElementContextMenu', (evt) => {
|
41
|
-
const { selectionState } = evt;
|
42
|
-
evt.menus.push({
|
43
|
-
icon: 'DeleteTable', caption: '删除段落', eventObj: {
|
44
|
-
onClick: (cevt) => {
|
45
|
-
selectionState.clear();
|
46
|
-
const psymbol = ElementUtil.getLastLeafElement(this);
|
47
|
-
const nextFocusableEle = ElementUtil.getRecursionNextSiblingElement(psymbol, false, true);
|
48
|
-
if (nextFocusableEle) {
|
49
|
-
selectionState.resetRange(nextFocusableEle, 0);
|
50
|
-
} else {
|
51
|
-
selectionState.clear();
|
52
|
-
}
|
53
|
-
this.remove();
|
54
|
-
this.destroy();
|
55
|
-
}
|
56
|
-
}
|
57
|
-
});
|
58
|
-
});
|
59
|
-
}
|
60
|
-
|
61
|
-
createRenderObject(): ParagraphRenderObject {
|
62
|
-
const paraRender = new ParagraphRenderObject(this);
|
63
|
-
return paraRender;
|
64
|
-
}
|
65
|
-
|
66
|
-
serialize(viewOptions: ViewOptions): SerializeProps {
|
67
|
-
return {
|
68
|
-
type: 'p',
|
69
|
-
props: {
|
70
|
-
...this.props.getSerializeProps(viewOptions)
|
71
|
-
}
|
72
|
-
}
|
73
|
-
}
|
74
|
-
|
75
|
-
clone(data: boolean): Element {
|
76
|
-
const clone = new ParagraphElement();
|
77
|
-
this.props.clone(clone.props);
|
78
|
-
if (data) {
|
79
|
-
for (let i = 0; i < this.length; i++) {
|
80
|
-
clone.addChild(this.getChild(i).clone(true));
|
81
|
-
}
|
82
|
-
}
|
83
|
-
return clone;
|
84
|
-
}
|
85
|
-
|
86
|
-
static createElement(): ParagraphElement {
|
87
|
-
return new ParagraphElement();
|
88
|
-
}
|
89
|
-
|
90
|
-
}
|
91
|
-
|
92
|
-
export class ParagraphRenderObject extends MuiltBlockLineRenderObject {
|
93
|
-
beginRender(ctx: RenderContenxtType, position: { x: number; y: number; }): void {
|
94
|
-
}
|
95
|
-
|
96
|
-
endRender(ctx: RenderContenxtType, position: { x: number; y: number; }): void {
|
97
|
-
this.drawProjectNumber(ctx);
|
98
|
-
}
|
99
|
-
|
100
|
-
|
101
|
-
/**
|
102
|
-
* 绘制项目符号
|
103
|
-
*/
|
104
|
-
drawProjectNumber(ctx: RenderContenxtType): void {
|
105
|
-
const paraElement = this.element as ParagraphElement;
|
106
|
-
if (paraElement.props.numberType >= 0) {
|
107
|
-
if (paraElement.paintRenders.indexOf(this) > 0) {
|
108
|
-
return;
|
109
|
-
}
|
110
|
-
const firstLine = this.getChild(0) as ParagraphLineRectRenderObject;
|
111
|
-
if (!firstLine) {
|
112
|
-
debugger;
|
113
|
-
}
|
114
|
-
const firstInline = firstLine.getChild(0);
|
115
|
-
if (!firstInline) {
|
116
|
-
debugger;
|
117
|
-
}
|
118
|
-
const firstInlinePaintPos = ElementUtil.getRenderAbsolutePaintPos(firstInline, {
|
119
|
-
x: 0,
|
120
|
-
y: -ctx.viewOptions.translateY
|
121
|
-
});
|
122
|
-
const numberSymbolY = firstInlinePaintPos.y + Math.ceil(firstInline.rect.height / 2);
|
123
|
-
//ctx.contentContext.drawText(str, textProps, firstInlinePaintPos.x - paraElement.paraProps.indent, numberSymbolY, 14, 14);
|
124
|
-
ctx.contentContext.fillCircular(firstInlinePaintPos.x - paraElement.props.indent + 2, numberSymbolY, 4)
|
125
|
-
}
|
126
|
-
}
|
127
|
-
|
128
|
-
|
129
|
-
clone(): RenderObject {
|
130
|
-
const cloneRender = new ParagraphRenderObject(this.element);
|
131
|
-
cloneRender.rect = ElementUtil.cloneRect(this.rect);
|
132
|
-
for (let i = 0; i < this.length; i++) {
|
133
|
-
cloneRender.addChild(this.getChild(i).clone());
|
134
|
-
}
|
135
|
-
return cloneRender;
|
136
|
-
}
|
137
|
-
|
138
|
-
createLineRect(): ParagraphLineRectRenderObject {
|
139
|
-
const lineRect = new ParagraphLineRectRenderObject(this.element);
|
140
|
-
lineRect.rect.maxWidth = this.rect.maxWidth;
|
141
|
-
return lineRect;
|
142
|
-
}
|
143
|
-
|
144
|
-
|
145
|
-
}
|
146
|
-
|
147
|
-
export class ParagraphFactory extends ElementFactory<ParagraphProps> {
|
148
|
-
match(type: string): boolean {
|
149
|
-
return type === 'p';
|
150
|
-
}
|
151
|
-
|
152
|
-
createElement(data: readElementProps<ParagraphProps>, renderCtx: RenderContenxtType): Element {
|
153
|
-
const paraElement = new ParagraphElement();
|
154
|
-
const props = data.props;
|
155
|
-
paraElement.props.indent = props?.indent ?? 0;
|
156
|
-
paraElement.props.hanging = props?.hanging ?? 0;
|
157
|
-
paraElement.props.textAlign = props?.textAlign ?? 'left';
|
158
|
-
paraElement.props.numberType = props?.numberType ?? -1;
|
159
|
-
paraElement.props.lineHeight = props?.lineHeight ?? 1.3;
|
160
|
-
paraElement.props.textProps = ElementUtil.readTextProps(null, props?.textProps, renderCtx.viewOptions);
|
161
|
-
paraElement.props.pageBreak = props?.pageBreak ?? false;
|
162
|
-
return paraElement;
|
163
|
-
}
|
164
|
-
}
|
165
|
-
|
166
|
-
/**
|
167
|
-
* 段落行框
|
168
|
-
*/
|
169
|
-
export class ParagraphLineRectRenderObject extends BlockLineRectRenderObject {
|
170
|
-
|
171
|
-
beginRender(ctx: RenderContenxtType, position: { x: number; y: number; }): void {
|
172
|
-
//console.log('绘制段落行-begin');
|
173
|
-
|
174
|
-
}
|
175
|
-
|
176
|
-
endRender(ctx: RenderContenxtType, position: { x: number; y: number; }): void {
|
177
|
-
//console.log('绘制段落行-end');
|
178
|
-
//ctx.strokeRect(position.x, position.y, this.rect.width, this.rect.height);
|
179
|
-
}
|
180
|
-
|
181
|
-
|
182
|
-
clone(): RenderObject {
|
183
|
-
const cloneRender = new ParagraphLineRectRenderObject(this.element);
|
184
|
-
cloneRender.rect = ElementUtil.cloneRect(this.rect);
|
185
|
-
for (let i = 0; i < this.length; i++) {
|
186
|
-
cloneRender.addChild(this.getChild(i).clone());
|
187
|
-
}
|
188
|
-
return cloneRender;
|
189
|
-
}
|
190
|
-
}
|
@@ -1,136 +0,0 @@
|
|
1
|
-
import { Element, ElementFactory, ImgLoadStatus, LeafElement, Position, ResizeLeafRenderObject, SerializeProps, ViewOptions } from "@/med_editor/framework/element-define";
|
2
|
-
import { PictureProps } 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
|
-
|
8
|
-
interface IResizeElement {
|
9
|
-
resizeable: boolean;
|
10
|
-
}
|
11
|
-
export class PictureElement extends LeafElement<PictureProps> implements IResizeElement {
|
12
|
-
//props: PictureProps;
|
13
|
-
status: ImgLoadStatus = 'no';
|
14
|
-
resizeable: boolean = true;
|
15
|
-
constructor() {
|
16
|
-
super('img');
|
17
|
-
this.props = new PictureProps();
|
18
|
-
//this.addPropValueChangedSub(this.props);
|
19
|
-
this.cursorType = 'move'
|
20
|
-
this.focusable = true;
|
21
|
-
}
|
22
|
-
createRenderObject(): LeafRenderObject {
|
23
|
-
const render = new PictureRenderObject(this);
|
24
|
-
render.rect.width = this.props.width + 2;
|
25
|
-
render.rect.height = this.props.height + 2;
|
26
|
-
return render;
|
27
|
-
}
|
28
|
-
serialize(options: ViewOptions): SerializeProps {
|
29
|
-
return {
|
30
|
-
type: 'img',
|
31
|
-
props: {
|
32
|
-
...this.props.getSerializeProps(options)
|
33
|
-
}
|
34
|
-
}
|
35
|
-
}
|
36
|
-
clone(data: boolean): Element {
|
37
|
-
const clone = new PictureElement();
|
38
|
-
this.props.clone(clone.props);
|
39
|
-
return clone;
|
40
|
-
}
|
41
|
-
|
42
|
-
loadImage(ctx: RenderContenxtType): void {
|
43
|
-
if (this.status === 'no') {
|
44
|
-
this.status = 'loading';
|
45
|
-
//this.imageSource = new Image();
|
46
|
-
//this.imageSource.src = this.props.src;
|
47
|
-
// const onload = (e: any) => {
|
48
|
-
// this.isLoad = 'completed';
|
49
|
-
// this.refreshView('appearance');
|
50
|
-
// };
|
51
|
-
// const onerror = (e: any) => {
|
52
|
-
// this.isLoad = 'error';
|
53
|
-
// console.error(e);
|
54
|
-
// };
|
55
|
-
const onCallback = (status: ImgLoadStatus) => {
|
56
|
-
this.status = status;
|
57
|
-
if (status === 'completed') {
|
58
|
-
this.refreshView();
|
59
|
-
}
|
60
|
-
}
|
61
|
-
ctx.docCtx.imageLoader.loadImage(this.props.src, onCallback);
|
62
|
-
}
|
63
|
-
}
|
64
|
-
destroy(): void {
|
65
|
-
super.destroy();
|
66
|
-
}
|
67
|
-
}
|
68
|
-
|
69
|
-
export class PictureRenderObject extends ResizeLeafRenderObject {
|
70
|
-
render(ctx: RenderContenxtType, position: { x: number; y: number; }): void {
|
71
|
-
const picElement = this.element as PictureElement;
|
72
|
-
const picProps = picElement.props;
|
73
|
-
if (picElement.status === 'no') {
|
74
|
-
picElement.loadImage(ctx);
|
75
|
-
return;
|
76
|
-
}
|
77
|
-
if (picElement.status === 'completed') {
|
78
|
-
const imageSource = ctx.docCtx.imageLoader.getImage(picProps.src);
|
79
|
-
if (!imageSource) {
|
80
|
-
return;
|
81
|
-
}
|
82
|
-
if (picProps.border === 'all') {
|
83
|
-
ctx.contentContext.strokeRect(position.x, position.y, this.rect.width, this.rect.height, 'black');
|
84
|
-
}
|
85
|
-
ctx.contentContext.drawImage(imageSource, 0, 0, imageSource.naturalWidth, imageSource.naturalHeight, position.x + 2, position.y + 2, picProps.width, picProps.height);
|
86
|
-
}
|
87
|
-
}
|
88
|
-
clone(): RenderObject {
|
89
|
-
const clone = new PictureRenderObject(this.element);
|
90
|
-
clone.rect = ElementUtil.cloneRect(this.rect);
|
91
|
-
return clone;
|
92
|
-
}
|
93
|
-
|
94
|
-
pagePaintCompleted(ctx: RenderContenxtType, pos: Position): void {
|
95
|
-
if (this.element.isFocused) {
|
96
|
-
const { width, height } = this.rect;
|
97
|
-
ctx.contentContext.strokeRect(pos.x, pos.y, width, height, '#1890ff', 0.5);
|
98
|
-
this.drawResizeCircle(ctx, pos.x, pos.y);
|
99
|
-
this.drawResizeCircle(ctx, pos.x + width, pos.y);
|
100
|
-
this.drawResizeCircle(ctx, pos.x, pos.y + height);
|
101
|
-
this.drawResizeCircle(ctx, pos.x + width, pos.y + height);
|
102
|
-
this.drawResizeCircle(ctx, pos.x + (Math.floor(width / 2)), pos.y);
|
103
|
-
this.drawResizeCircle(ctx, pos.x + (Math.floor(width / 2)), pos.y + height);
|
104
|
-
this.drawResizeCircle(ctx, pos.x, pos.y + (Math.floor(height / 2)));
|
105
|
-
this.drawResizeCircle(ctx, pos.x + width, pos.y + (Math.floor(height / 2)));
|
106
|
-
}
|
107
|
-
}
|
108
|
-
|
109
|
-
private drawResizeCircle(ctx: RenderContenxtType, x: number, y: number): void {
|
110
|
-
const ctxNative = ctx.contentContext.ctx;
|
111
|
-
ctxNative.fillStyle = '#69c0ff';
|
112
|
-
ctxNative.beginPath();
|
113
|
-
ctxNative.arc(x, y, Math.floor(4 / 5 * 4), 0, 2 * Math.PI);
|
114
|
-
ctxNative.closePath();
|
115
|
-
ctxNative.fill();
|
116
|
-
}
|
117
|
-
}
|
118
|
-
|
119
|
-
|
120
|
-
export class PictureFactory extends ElementFactory<PictureProps> {
|
121
|
-
match(type: string): boolean {
|
122
|
-
return type === 'img';
|
123
|
-
}
|
124
|
-
createElement(data: any, renderCtx: RenderContenxtType): Element {
|
125
|
-
const props = data.props as PictureProps;
|
126
|
-
const pic = new PictureElement();
|
127
|
-
const picProps = pic.props;
|
128
|
-
picProps.width = props.width;
|
129
|
-
picProps.height = props.height;
|
130
|
-
picProps.src = props.src;
|
131
|
-
picProps.border = props.border || 'all';
|
132
|
-
picProps.title = props.title;
|
133
|
-
pic.props = picProps;
|
134
|
-
return pic;
|
135
|
-
}
|
136
|
-
}
|
@@ -1,79 +0,0 @@
|
|
1
|
-
import { ElementFactory, LeafElement, SerializeProps } from "@/med_editor/framework/element-define";
|
2
|
-
import { RadioBoxProps } 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 RadioBoxElement extends LeafElement<RadioBoxProps> {
|
8
|
-
//props: RadioBoxProps;
|
9
|
-
constructor() {
|
10
|
-
super('rd');
|
11
|
-
this.props = new RadioBoxProps();
|
12
|
-
//this.addPropValueChangedSub(this.props);
|
13
|
-
this.cursorType = 'default'
|
14
|
-
this.addEvent('ElementClick', (evt) => { this.changeState() });
|
15
|
-
}
|
16
|
-
createRenderObject(): RadioBoxRenderObject {
|
17
|
-
const render = new RadioBoxRenderObject(this);
|
18
|
-
render.rect.width = this.props.size + 4;
|
19
|
-
render.rect.height = this.props.size;
|
20
|
-
return render;
|
21
|
-
}
|
22
|
-
|
23
|
-
changeState(): void {
|
24
|
-
const parent = this.parent;
|
25
|
-
if (!parent) {
|
26
|
-
throw new Error('parent is null')
|
27
|
-
}
|
28
|
-
for (let i = 0; i < parent.length; i++) {
|
29
|
-
const child = parent.getChild(i);
|
30
|
-
if (child instanceof RadioBoxElement && child !== this) {
|
31
|
-
child.props.isChecked = false;
|
32
|
-
}
|
33
|
-
}
|
34
|
-
this.props.isChecked = true;
|
35
|
-
}
|
36
|
-
serialize(): SerializeProps {
|
37
|
-
return {
|
38
|
-
type: 'rd',
|
39
|
-
props: {
|
40
|
-
...this.props
|
41
|
-
}
|
42
|
-
}
|
43
|
-
}
|
44
|
-
clone(): RadioBoxElement {
|
45
|
-
const clone = new RadioBoxElement();
|
46
|
-
this.props.clone(clone.props);
|
47
|
-
return clone;
|
48
|
-
}
|
49
|
-
}
|
50
|
-
|
51
|
-
export class RadioBoxFactory extends ElementFactory<RadioBoxProps> {
|
52
|
-
match(type: string): boolean {
|
53
|
-
return type === 'rd';
|
54
|
-
}
|
55
|
-
createElement(data: any, renderCtx: RenderContenxtType): RadioBoxElement {
|
56
|
-
const rdElement = new RadioBoxElement();
|
57
|
-
const props = data.props as RadioBoxProps;
|
58
|
-
const ckbProps = rdElement.props;
|
59
|
-
ckbProps.size = props.size ?? 14;
|
60
|
-
ckbProps.isChecked = props.isChecked;
|
61
|
-
rdElement.props = ckbProps;
|
62
|
-
return rdElement;
|
63
|
-
}
|
64
|
-
}
|
65
|
-
|
66
|
-
export class RadioBoxRenderObject extends LeafRenderObject {
|
67
|
-
|
68
|
-
render(ctx: RenderContenxtType, position: { x: number; y: number; }): void {
|
69
|
-
const element = this.element as RadioBoxElement;
|
70
|
-
ctx.contentContext.drawRadioBox(position.x + 2, position.y, element.props.size, element.props.size, element.props.isChecked);
|
71
|
-
}
|
72
|
-
|
73
|
-
clone(cloneData = true): RenderObject {
|
74
|
-
const clone = new RadioBoxRenderObject(this.element);
|
75
|
-
clone.rect = ElementUtil.cloneRect(this.rect);
|
76
|
-
return clone;
|
77
|
-
}
|
78
|
-
|
79
|
-
}
|
@@ -1,60 +0,0 @@
|
|
1
|
-
import { Element, ElementFactory, 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 { TextProps } from "../../element-props";
|
6
|
-
|
7
|
-
export class BreakElement extends LeafElement {
|
8
|
-
textProps: TextProps;
|
9
|
-
constructor() {
|
10
|
-
super('br');
|
11
|
-
this.textProps = new TextProps();
|
12
|
-
this.textProps.fontSize = 14;
|
13
|
-
this.textProps.fontName = '宋体';
|
14
|
-
this.textProps.color = '#595959';
|
15
|
-
}
|
16
|
-
createRenderObject(): LeafRenderObject {
|
17
|
-
const symbol = new BreakRenderObject(this);
|
18
|
-
symbol.rect.height = 14;
|
19
|
-
symbol.rect.width = 7;
|
20
|
-
return symbol;
|
21
|
-
}
|
22
|
-
serialize(): SerializeProps {
|
23
|
-
return {
|
24
|
-
type: 'br',
|
25
|
-
props: {}
|
26
|
-
}
|
27
|
-
}
|
28
|
-
clone(): Element {
|
29
|
-
const clone = new BreakElement();
|
30
|
-
//clone.renderCtx = this.renderCtx;
|
31
|
-
return clone;
|
32
|
-
}
|
33
|
-
|
34
|
-
}
|
35
|
-
|
36
|
-
export class BreakRenderObject extends LeafRenderObject<BreakElement> {
|
37
|
-
render(ctx: RenderContenxtType, position: { x: number; y: number; }): void {
|
38
|
-
if (ctx.drawMode === 'print') {
|
39
|
-
return;
|
40
|
-
}
|
41
|
-
ctx.contentContext.drawText('↓', this.element.textProps, position.x, position.y, 20, this.rect.height);
|
42
|
-
}
|
43
|
-
clone(): RenderObject {
|
44
|
-
const render = new BreakRenderObject(this.element);
|
45
|
-
render.rect = ElementUtil.cloneRect(this.rect);
|
46
|
-
return render;
|
47
|
-
}
|
48
|
-
}
|
49
|
-
|
50
|
-
export class BreakFactory extends ElementFactory<null> {
|
51
|
-
match(type: string): boolean {
|
52
|
-
return type === 'br';
|
53
|
-
}
|
54
|
-
createElement(data: any, renderCtx: RenderContenxtType): Element {
|
55
|
-
const ele = new BreakElement();
|
56
|
-
return ele;
|
57
|
-
}
|
58
|
-
|
59
|
-
}
|
60
|
-
|