@hailin-zheng/editor-core 1.0.7 → 1.0.10

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.
Files changed (237) hide show
  1. package/package.json +3 -4
  2. package/{lib/doc-ruler.js → src/med_editor/doc-ruler.ts} +101 -74
  3. package/src/med_editor/framework/common-util.ts +200 -0
  4. package/{lib/framework/document-change.js → src/med_editor/framework/document-change.ts} +308 -259
  5. package/{lib/framework/document-combine.js → src/med_editor/framework/document-combine.ts} +15 -11
  6. package/{lib/framework/document-comment.js → src/med_editor/framework/document-comment.ts} +52 -37
  7. package/{lib/framework/document-context.js → src/med_editor/framework/document-context.ts} +181 -101
  8. package/{lib/framework/document-eval-func.js → src/med_editor/framework/document-eval-func.ts} +16 -11
  9. package/{lib/framework/document-event.js → src/med_editor/framework/document-event.ts} +244 -216
  10. package/{lib/framework/document-history.js → src/med_editor/framework/document-history.ts} +25 -14
  11. package/{lib/framework/document-images-loader.js → src/med_editor/framework/document-images-loader.ts} +25 -17
  12. package/{lib/framework/document-input-cursor.js → src/med_editor/framework/document-input-cursor.ts} +76 -71
  13. package/{lib/framework/document-paint.js → src/med_editor/framework/document-paint.ts} +35 -28
  14. package/{lib/framework/document-print-offscreen.js → src/med_editor/framework/document-print-offscreen.ts} +25 -19
  15. package/{lib/framework/document-print.js → src/med_editor/framework/document-print.ts} +57 -41
  16. package/src/med_editor/framework/document-segmenter.ts +211 -0
  17. package/{lib/framework/document-selection.js → src/med_editor/framework/document-selection.ts} +116 -85
  18. package/{lib/framework/document-template.js → src/med_editor/framework/document-template.ts} +3 -3
  19. package/src/med_editor/framework/document-textline-mode.ts +34 -0
  20. package/{lib/framework/element-define.js → src/med_editor/framework/element-define.ts} +301 -206
  21. package/src/med_editor/framework/element-event-define.ts +141 -0
  22. package/{lib/framework/element-measure.js → src/med_editor/framework/element-measure.ts} +143 -121
  23. package/{lib/framework/element-paint.js → src/med_editor/framework/element-paint.ts} +44 -38
  24. package/{lib/framework/element-props.js → src/med_editor/framework/element-props.ts} +331 -202
  25. package/{lib/framework/element-reader.js → src/med_editor/framework/element-reader.ts} +39 -31
  26. package/{lib/framework/element-render-cut.js → src/med_editor/framework/element-render-cut.ts} +113 -106
  27. package/{lib/framework/element-serialize.js → src/med_editor/framework/element-serialize.ts} +37 -24
  28. package/{lib/framework/element-util.js → src/med_editor/framework/element-util.ts} +317 -216
  29. package/{lib/framework/impl/checkbox/checkbox-impl.js → src/med_editor/framework/impl/checkbox/checkbox-impl.ts} +27 -20
  30. package/{lib/framework/impl/comments/comment-content-impl.js → src/med_editor/framework/impl/comments/comment-content-impl.ts} +45 -31
  31. package/{lib/framework/impl/comments/comment-element-impl.js → src/med_editor/framework/impl/comments/comment-element-impl.ts} +23 -20
  32. package/{lib/framework/impl/comments/comments-container-impl.js → src/med_editor/framework/impl/comments/comments-container-impl.ts} +22 -16
  33. package/{lib/framework/impl/comments/comments-util.js → src/med_editor/framework/impl/comments/comments-util.ts} +34 -17
  34. package/{lib/framework/impl/comments/validate-msg-impl.js → src/med_editor/framework/impl/comments/validate-msg-impl.ts} +28 -17
  35. package/{lib/framework/impl/data-element/data-decorate-impl.js → src/med_editor/framework/impl/data-element/data-decorate-impl.ts} +26 -22
  36. package/{lib/framework/impl/data-element/data-element-barcode.js → src/med_editor/framework/impl/data-element/data-element-barcode.ts} +41 -29
  37. package/{lib/framework/impl/data-element/data-element-base-impl.js → src/med_editor/framework/impl/data-element/data-element-base-impl.ts} +73 -44
  38. package/{lib/framework/impl/data-element/data-element-check-impl.js → src/med_editor/framework/impl/data-element/data-element-check-impl.ts} +48 -35
  39. package/{lib/framework/impl/data-element/data-element-date-impl.js → src/med_editor/framework/impl/data-element/data-element-date-impl.ts} +41 -24
  40. package/{lib/framework/impl/data-element/data-element-group-impl.js → src/med_editor/framework/impl/data-element/data-element-group-impl.ts} +52 -32
  41. package/{lib/framework/impl/data-element/data-element-image-impl.js → src/med_editor/framework/impl/data-element/data-element-image-impl.ts} +38 -28
  42. package/{lib/framework/impl/data-element/data-element-list-impl.js → src/med_editor/framework/impl/data-element/data-element-list-impl.ts} +42 -31
  43. package/{lib/framework/impl/data-element/data-element-text-impl.js → src/med_editor/framework/impl/data-element/data-element-text-impl.ts} +36 -22
  44. package/{lib/framework/impl/decorate/fill-null-space-imple.js → src/med_editor/framework/impl/decorate/fill-null-space-imple.ts} +15 -10
  45. package/{lib/framework/impl/document/doc-body-impl.js → src/med_editor/framework/impl/document/doc-body-impl.ts} +32 -16
  46. package/{lib/framework/impl/document/doc-body-part-impl.js → src/med_editor/framework/impl/document/doc-body-part-impl.ts} +27 -17
  47. package/src/med_editor/framework/impl/document/doc-container-impl.ts +24 -0
  48. package/{lib/framework/impl/document/doc-footer-impl.js → src/med_editor/framework/impl/document/doc-footer-impl.ts} +30 -19
  49. package/{lib/framework/impl/document/doc-header-impl.js → src/med_editor/framework/impl/document/doc-header-impl.ts} +34 -17
  50. package/{lib/framework/impl/document/doc-impl.js → src/med_editor/framework/impl/document/doc-impl.ts} +62 -45
  51. package/{lib/framework/impl/media-formula/menstrual-history.js → src/med_editor/framework/impl/media-formula/menstrual-history.ts} +58 -36
  52. package/{lib/framework/impl/paragraph/p-impl.js → src/med_editor/framework/impl/paragraph/p-impl.ts} +64 -30
  53. package/{lib/framework/impl/picture/image-impl.js → src/med_editor/framework/impl/picture/image-impl.ts} +37 -25
  54. package/{lib/framework/impl/radio/radio-impl.js → src/med_editor/framework/impl/radio/radio-impl.ts} +28 -21
  55. package/{lib/framework/impl/symbol/br-symbol-impl.js → src/med_editor/framework/impl/symbol/br-symbol-impl.ts} +21 -15
  56. package/{lib/framework/impl/symbol/p-symbol-impl.js → src/med_editor/framework/impl/symbol/p-symbol-impl.ts} +15 -12
  57. package/{lib/framework/impl/table/table-cell-impl.js → src/med_editor/framework/impl/table/table-cell-impl.ts} +41 -30
  58. package/{lib/framework/impl/table/table-impl.js → src/med_editor/framework/impl/table/table-impl.ts} +122 -84
  59. package/{lib/framework/impl/table/table-row-impl.js → src/med_editor/framework/impl/table/table-row-impl.ts} +26 -18
  60. package/{lib/framework/impl/table/table-split-cell-patch.js → src/med_editor/framework/impl/table/table-split-cell-patch.ts} +31 -22
  61. package/{lib/framework/impl/table/table-split-cell.js → src/med_editor/framework/impl/table/table-split-cell.ts} +105 -94
  62. package/{lib/framework/impl/table/table-util.js → src/med_editor/framework/impl/table/table-util.ts} +197 -159
  63. package/{lib/framework/impl/text/text-impl.js → src/med_editor/framework/impl/text/text-impl.ts} +49 -35
  64. package/{lib/framework/impl/text/track-run-impl.js → src/med_editor/framework/impl/text/track-run-impl.ts} +53 -30
  65. package/{lib/framework/notify.js → src/med_editor/framework/notify.ts} +50 -36
  66. package/{lib/framework/range-util.js → src/med_editor/framework/range-util.ts} +80 -71
  67. package/{lib/framework/render-context.js → src/med_editor/framework/render-context.ts} +111 -64
  68. package/{lib/framework/render-define.js → src/med_editor/framework/render-define.ts} +90 -61
  69. package/{lib/framework/selection-overlays.js → src/med_editor/framework/selection-overlays.ts} +25 -16
  70. package/{lib/texteditor.js → src/med_editor/texteditor.ts} +288 -191
  71. package/src/med_editor/util/subject.ts +118 -0
  72. package/{lib/util/table-bind.js → src/med_editor/util/table-bind.ts} +2 -2
  73. package/src/med_editor//345/205/245/351/231/242/350/256/260/345/275/225.json +3573 -0
  74. package/src/med_editor//345/205/245/351/231/242/350/256/260/345/275/225/346/265/213/350/257/225.json +3573 -0
  75. package/src/med_editor//345/205/245/351/231/242/350/256/260/345/275/225/346/265/213/350/257/225bug.json +315 -0
  76. 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 +122 -0
  77. 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 +3599 -0
  78. 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 +24586 -0
  79. package/src/med_editor//345/220/210/345/271/266/347/227/205/347/250/213/345/275/225.json +2874 -0
  80. package/src/med_editor//346/211/213/346/234/257/350/256/260/345/275/225.json +341 -0
  81. package/src/med_editor//346/231/256/351/200/232doc/347/261/273/346/226/207/346/241/243.json +2201 -0
  82. package/src/med_editor//346/243/200/351/252/214/347/224/263/350/257/267/345/215/225.json +1069 -0
  83. 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 +125 -0
  84. 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 +86 -0
  85. 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 +115 -0
  86. 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 +108 -0
  87. 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 +272 -0
  88. package/src/med_editor//351/225/277/346/234/237/345/214/273/345/230/261/345/215/225.json +1070 -0
  89. package/lib/doc-ruler.d.ts +0 -51
  90. package/lib/doc-ruler.js.map +0 -1
  91. package/lib/framework/common-util.d.ts +0 -63
  92. package/lib/framework/common-util.js +0 -178
  93. package/lib/framework/common-util.js.map +0 -1
  94. package/lib/framework/document-change.d.ts +0 -265
  95. package/lib/framework/document-change.js.map +0 -1
  96. package/lib/framework/document-combine.d.ts +0 -24
  97. package/lib/framework/document-combine.js.map +0 -1
  98. package/lib/framework/document-comment.d.ts +0 -46
  99. package/lib/framework/document-comment.js.map +0 -1
  100. package/lib/framework/document-context.d.ts +0 -149
  101. package/lib/framework/document-context.js.map +0 -1
  102. package/lib/framework/document-eval-func.d.ts +0 -18
  103. package/lib/framework/document-eval-func.js.map +0 -1
  104. package/lib/framework/document-event.d.ts +0 -213
  105. package/lib/framework/document-event.js.map +0 -1
  106. package/lib/framework/document-history.d.ts +0 -26
  107. package/lib/framework/document-history.js.map +0 -1
  108. package/lib/framework/document-images-loader.d.ts +0 -16
  109. package/lib/framework/document-images-loader.js.map +0 -1
  110. package/lib/framework/document-input-cursor.d.ts +0 -78
  111. package/lib/framework/document-input-cursor.js.map +0 -1
  112. package/lib/framework/document-paint.d.ts +0 -34
  113. package/lib/framework/document-paint.js.map +0 -1
  114. package/lib/framework/document-print-offscreen.d.ts +0 -38
  115. package/lib/framework/document-print-offscreen.js.map +0 -1
  116. package/lib/framework/document-print.d.ts +0 -60
  117. package/lib/framework/document-print.js.map +0 -1
  118. package/lib/framework/document-segmenter.d.ts +0 -2
  119. package/lib/framework/document-segmenter.js +0 -106
  120. package/lib/framework/document-segmenter.js.map +0 -1
  121. package/lib/framework/document-selection.d.ts +0 -89
  122. package/lib/framework/document-selection.js.map +0 -1
  123. package/lib/framework/document-template.d.ts +0 -4
  124. package/lib/framework/document-template.js.map +0 -1
  125. package/lib/framework/document-textline-mode.d.ts +0 -7
  126. package/lib/framework/document-textline-mode.js +0 -30
  127. package/lib/framework/document-textline-mode.js.map +0 -1
  128. package/lib/framework/element-define.d.ts +0 -319
  129. package/lib/framework/element-define.js.map +0 -1
  130. package/lib/framework/element-event-define.d.ts +0 -99
  131. package/lib/framework/element-event-define.js +0 -108
  132. package/lib/framework/element-event-define.js.map +0 -1
  133. package/lib/framework/element-measure.d.ts +0 -97
  134. package/lib/framework/element-measure.js.map +0 -1
  135. package/lib/framework/element-paint.d.ts +0 -42
  136. package/lib/framework/element-paint.js.map +0 -1
  137. package/lib/framework/element-props.d.ts +0 -301
  138. package/lib/framework/element-props.js.map +0 -1
  139. package/lib/framework/element-reader.d.ts +0 -19
  140. package/lib/framework/element-reader.js.map +0 -1
  141. package/lib/framework/element-render-cut.d.ts +0 -55
  142. package/lib/framework/element-render-cut.js.map +0 -1
  143. package/lib/framework/element-serialize.d.ts +0 -30
  144. package/lib/framework/element-serialize.js.map +0 -1
  145. package/lib/framework/element-util.d.ts +0 -369
  146. package/lib/framework/element-util.js.map +0 -1
  147. package/lib/framework/impl/checkbox/checkbox-impl.d.ts +0 -24
  148. package/lib/framework/impl/checkbox/checkbox-impl.js.map +0 -1
  149. package/lib/framework/impl/comments/comment-content-impl.d.ts +0 -40
  150. package/lib/framework/impl/comments/comment-content-impl.js.map +0 -1
  151. package/lib/framework/impl/comments/comment-element-impl.d.ts +0 -21
  152. package/lib/framework/impl/comments/comment-element-impl.js.map +0 -1
  153. package/lib/framework/impl/comments/comments-container-impl.d.ts +0 -22
  154. package/lib/framework/impl/comments/comments-container-impl.js.map +0 -1
  155. package/lib/framework/impl/comments/comments-util.d.ts +0 -12
  156. package/lib/framework/impl/comments/comments-util.js.map +0 -1
  157. package/lib/framework/impl/comments/validate-msg-impl.d.ts +0 -21
  158. package/lib/framework/impl/comments/validate-msg-impl.js.map +0 -1
  159. package/lib/framework/impl/data-element/data-decorate-impl.d.ts +0 -30
  160. package/lib/framework/impl/data-element/data-decorate-impl.js.map +0 -1
  161. package/lib/framework/impl/data-element/data-element-barcode.d.ts +0 -31
  162. package/lib/framework/impl/data-element/data-element-barcode.js.map +0 -1
  163. package/lib/framework/impl/data-element/data-element-base-impl.d.ts +0 -68
  164. package/lib/framework/impl/data-element/data-element-base-impl.js.map +0 -1
  165. package/lib/framework/impl/data-element/data-element-check-impl.d.ts +0 -35
  166. package/lib/framework/impl/data-element/data-element-check-impl.js.map +0 -1
  167. package/lib/framework/impl/data-element/data-element-date-impl.d.ts +0 -23
  168. package/lib/framework/impl/data-element/data-element-date-impl.js.map +0 -1
  169. package/lib/framework/impl/data-element/data-element-group-impl.d.ts +0 -23
  170. package/lib/framework/impl/data-element/data-element-group-impl.js.map +0 -1
  171. package/lib/framework/impl/data-element/data-element-image-impl.d.ts +0 -30
  172. package/lib/framework/impl/data-element/data-element-image-impl.js.map +0 -1
  173. package/lib/framework/impl/data-element/data-element-list-impl.d.ts +0 -22
  174. package/lib/framework/impl/data-element/data-element-list-impl.js.map +0 -1
  175. package/lib/framework/impl/data-element/data-element-text-impl.d.ts +0 -23
  176. package/lib/framework/impl/data-element/data-element-text-impl.js.map +0 -1
  177. package/lib/framework/impl/decorate/fill-null-space-imple.d.ts +0 -21
  178. package/lib/framework/impl/decorate/fill-null-space-imple.js.map +0 -1
  179. package/lib/framework/impl/document/doc-body-impl.d.ts +0 -27
  180. package/lib/framework/impl/document/doc-body-impl.js.map +0 -1
  181. package/lib/framework/impl/document/doc-body-part-impl.d.ts +0 -30
  182. package/lib/framework/impl/document/doc-body-part-impl.js.map +0 -1
  183. package/lib/framework/impl/document/doc-container-impl.d.ts +0 -16
  184. package/lib/framework/impl/document/doc-container-impl.js +0 -21
  185. package/lib/framework/impl/document/doc-container-impl.js.map +0 -1
  186. package/lib/framework/impl/document/doc-footer-impl.d.ts +0 -26
  187. package/lib/framework/impl/document/doc-footer-impl.js.map +0 -1
  188. package/lib/framework/impl/document/doc-header-impl.d.ts +0 -26
  189. package/lib/framework/impl/document/doc-header-impl.js.map +0 -1
  190. package/lib/framework/impl/document/doc-impl.d.ts +0 -61
  191. package/lib/framework/impl/document/doc-impl.js.map +0 -1
  192. package/lib/framework/impl/media-formula/menstrual-history.d.ts +0 -35
  193. package/lib/framework/impl/media-formula/menstrual-history.js.map +0 -1
  194. package/lib/framework/impl/paragraph/p-impl.d.ts +0 -45
  195. package/lib/framework/impl/paragraph/p-impl.js.map +0 -1
  196. package/lib/framework/impl/picture/image-impl.d.ts +0 -31
  197. package/lib/framework/impl/picture/image-impl.js.map +0 -1
  198. package/lib/framework/impl/radio/radio-impl.d.ts +0 -22
  199. package/lib/framework/impl/radio/radio-impl.js.map +0 -1
  200. package/lib/framework/impl/symbol/br-symbol-impl.d.ts +0 -22
  201. package/lib/framework/impl/symbol/br-symbol-impl.js.map +0 -1
  202. package/lib/framework/impl/symbol/p-symbol-impl.d.ts +0 -19
  203. package/lib/framework/impl/symbol/p-symbol-impl.js.map +0 -1
  204. package/lib/framework/impl/table/table-cell-impl.d.ts +0 -37
  205. package/lib/framework/impl/table/table-cell-impl.js.map +0 -1
  206. package/lib/framework/impl/table/table-impl.d.ts +0 -55
  207. package/lib/framework/impl/table/table-impl.js.map +0 -1
  208. package/lib/framework/impl/table/table-row-impl.d.ts +0 -26
  209. package/lib/framework/impl/table/table-row-impl.js.map +0 -1
  210. package/lib/framework/impl/table/table-split-cell-patch.d.ts +0 -20
  211. package/lib/framework/impl/table/table-split-cell-patch.js.map +0 -1
  212. package/lib/framework/impl/table/table-split-cell.d.ts +0 -90
  213. package/lib/framework/impl/table/table-split-cell.js.map +0 -1
  214. package/lib/framework/impl/table/table-util.d.ts +0 -150
  215. package/lib/framework/impl/table/table-util.js.map +0 -1
  216. package/lib/framework/impl/text/text-impl.d.ts +0 -32
  217. package/lib/framework/impl/text/text-impl.js.map +0 -1
  218. package/lib/framework/impl/text/track-run-impl.d.ts +0 -27
  219. package/lib/framework/impl/text/track-run-impl.js.map +0 -1
  220. package/lib/framework/notify.d.ts +0 -13
  221. package/lib/framework/notify.js.map +0 -1
  222. package/lib/framework/range-util.d.ts +0 -40
  223. package/lib/framework/range-util.js.map +0 -1
  224. package/lib/framework/render-context.d.ts +0 -91
  225. package/lib/framework/render-context.js.map +0 -1
  226. package/lib/framework/render-define.d.ts +0 -109
  227. package/lib/framework/render-define.js.map +0 -1
  228. package/lib/framework/selection-overlays.d.ts +0 -30
  229. package/lib/framework/selection-overlays.js.map +0 -1
  230. package/lib/texteditor.d.ts +0 -318
  231. package/lib/texteditor.js.map +0 -1
  232. package/lib/util/subject.d.ts +0 -34
  233. package/lib/util/subject.js +0 -88
  234. package/lib/util/subject.js.map +0 -1
  235. package/lib/util/table-bind.d.ts +0 -5
  236. package/lib/util/table-bind.js.map +0 -1
  237. package/tsconfig.json +0 -25
@@ -1,26 +1,34 @@
1
- import { BlockContainerElement, DocMode, ElementFactory, PaddingProps } from "@/med_editor/framework/element-define";
1
+ import { BlockContainerElement, DocMode, Element, ElementFactory, MarginProps, PaddingProps, readElementProps, Rect, SerializeProps, ViewOptions } from "../../element-define";
2
2
  import { DocumentProps, TextProps } from '../../element-props';
3
- import { BlockContainerRenderObject } from "@/med_editor/framework/render-define";
4
- import { ElementUtil } from "@/med_editor/framework/element-util";
5
- import { documentPrint } from "@/med_editor/framework/document-print";
6
- import { CommonUtil } from "@/med_editor/framework/common-util";
7
- export class DocumentElement extends BlockContainerElement {
3
+ import { RenderContenxtType } from "../../render-context";
4
+ import { DocumentBodyElement } from "./doc-body-impl";
5
+ import { DocumentHeaderElement } from "./doc-header-impl";
6
+ import { BlockContainerRenderObject, RenderObject } from "../../render-define";
7
+ import { ElementUtil } from "../../element-util";
8
+ import { DocumentFooterElement } from "./doc-footer-impl";
9
+ import { ContextMenuElementEvent } from "../../element-event-define";
10
+ import { documentPrint } from "../../document-print";
11
+ import { CommsContainerElement } from "../comments/comments-container-impl";
12
+ import { CommonUtil } from "../../common-util";
13
+ import { SelectionState } from "../../document-selection";
14
+
15
+ export class DocumentElement extends BlockContainerElement<DocumentProps> {
8
16
  //props: DocumentProps;
9
- viewOptions;
10
- bodyElement;
11
- headerElement;
12
- footerElement;
13
- commentsContainerElement;
14
- headerEditState = false;
17
+ viewOptions!: ViewOptions;
18
+ bodyElement!: DocumentBodyElement;
19
+ headerElement!: DocumentHeaderElement;
20
+ footerElement!: DocumentFooterElement;
21
+ commentsContainerElement!: CommsContainerElement;
22
+ headerEditState: boolean = false;
15
23
  constructor() {
16
24
  super('doc');
17
25
  this.props = new DocumentProps();
18
- this.addEvent('ElementContextMenu', (cevt) => {
19
- cevt.menus.push({ icon: 'Print', caption: '打印所有页', eventObj: { onClick: (evt) => { documentPrint.print(cevt.selectionState, this.viewOptions, cevt.ctx); } } });
20
- cevt.menus.push({ icon: 'Print', caption: '打印当前页', eventObj: { onClick: (evt) => { documentPrint.printCurrPage(cevt.selectionState, this.viewOptions, cevt.ctx); } } });
26
+ this.addEvent<ContextMenuElementEvent>('ElementContextMenu', (cevt) => {
27
+ cevt.menus.push({ icon: 'Print', caption: '打印所有页', eventObj: { onClick: (evt) => { documentPrint.print(cevt.selectionState, this.viewOptions, cevt.ctx) } } });
28
+ cevt.menus.push({ icon: 'Print', caption: '打印当前页', eventObj: { onClick: (evt) => { documentPrint.printCurrPage(cevt.selectionState, this.viewOptions, cevt.ctx) } } });
21
29
  }, true);
22
30
  }
23
- createRenderObject(options) {
31
+ createRenderObject(options: ViewOptions): DocumentRenderObject {
24
32
  const { width: docPixelsWidth, height: docPixelsHeight } = this.viewOptions.docPageSettings;
25
33
  const docRenderObject = new DocumentRenderObject(this);
26
34
  docRenderObject.rect.width = docPixelsWidth;
@@ -42,28 +50,31 @@ export class DocumentElement extends BlockContainerElement {
42
50
  docRenderObject.margin.top = options.docSpace;
43
51
  return docRenderObject;
44
52
  }
45
- serialize() {
53
+
54
+ serialize(): SerializeProps {
46
55
  return {
47
56
  type: 'doc',
48
57
  props: {
49
58
  ...this.props.getSerializeProps()
50
59
  }
51
- };
60
+ }
52
61
  }
53
- clone() {
62
+
63
+ clone(): DocumentElement {
54
64
  const clone = new DocumentElement();
55
- this.props.clone(clone.props);
65
+ this.props.clone(clone.props)
56
66
  for (let i = 0; i < this.length; i++) {
57
67
  clone.addChild(this.getChild(i).clone(true));
58
68
  }
59
69
  return clone;
60
70
  }
71
+
61
72
  /**
62
73
  * 更新页边距
63
- * @param marginProps
74
+ * @param marginProps
64
75
  */
65
- updateMargin(marginProps, unit = 'cm') {
66
- const { top, bottom, left, right } = marginProps;
76
+ updateMargin(marginProps: Partial<MarginProps>, unit: 'mm' | 'cm' = 'cm'): void {
77
+ const { top, bottom, left, right } = marginProps as MarginProps;
67
78
  const paddig = this.props.padding;
68
79
  const ratio = unit === 'cm' ? 10 : 1;
69
80
  paddig.top = top * ratio;
@@ -71,10 +82,11 @@ export class DocumentElement extends BlockContainerElement {
71
82
  paddig.left = left * ratio;
72
83
  paddig.right = right * ratio;
73
84
  }
85
+
74
86
  /**
75
87
  * 切换开启页眉页脚编辑功能
76
88
  */
77
- switchPageHeaderEditor(ss, ele) {
89
+ switchPageHeaderEditor(ss: SelectionState, ele: Element | null): void {
78
90
  if (this.viewOptions.docMode !== DocMode.Design) {
79
91
  return;
80
92
  }
@@ -83,8 +95,7 @@ export class DocumentElement extends BlockContainerElement {
83
95
  this.footerElement.disableClick = false;
84
96
  this.bodyElement.disableClick = true;
85
97
  this.headerEditState = true;
86
- }
87
- else if (this.headerEditState && (!ele || ele === this.bodyElement)) {
98
+ } else if (this.headerEditState && (!ele || ele === this.bodyElement)) {
88
99
  this.headerElement.disableClick = true;
89
100
  this.footerElement.disableClick = true;
90
101
  this.bodyElement.disableClick = false;
@@ -94,20 +105,22 @@ export class DocumentElement extends BlockContainerElement {
94
105
  this.refreshView();
95
106
  }
96
107
  }
108
+
109
+
97
110
  export class DocumentRenderObject extends BlockContainerRenderObject {
98
- constructor(ele) {
111
+ constructor(ele: Element) {
99
112
  super(ele);
100
113
  }
101
- headerLine;
102
- footerLine;
103
- beginRender(ctx, position) {
114
+ headerLine!: number;
115
+ footerLine!: number;
116
+ beginRender(ctx: RenderContenxtType, position: { x: number; y: number; }): void {
104
117
  const { width: docWidth, height: docHeight } = ctx.viewOptions.docPageSettings;
105
118
  ctx.overlaysContext.fillRect(position.x, position.y, docWidth, this.rect.height, 'white', 5, 'black');
106
119
  // if (ctx.drawMode === 'view') {
107
120
  // ctx.contentContext.strokeRect(position.x, position.y, docWidth, this.rect.height, 'black', 0.5);
108
121
  // }
109
122
  }
110
- endRender(ctx, position) {
123
+ endRender(ctx: RenderContenxtType, position: { x: number; y: number; }): void {
111
124
  const textP = new TextProps();
112
125
  textP.color = "rgb(0,0,0)";
113
126
  textP.fontName = '楷体';
@@ -131,18 +144,19 @@ export class DocumentRenderObject extends BlockContainerRenderObject {
131
144
  ctx.overlaysContext.strokeLines([{ x: paddingPos.x + lineWidth, y: paddingPos.y }, paddingPos, { x: paddingPos.x, y: paddingPos.y + lineWidth }], drawLineWidth);
132
145
  this.drawWatermark(ctx, position);
133
146
  }
147
+
134
148
  /**
135
149
  * 绘制水印
136
- * @param ctx
137
- * @param position
150
+ * @param ctx
151
+ * @param position
138
152
  */
139
- drawWatermark(ctx, position) {
153
+ private drawWatermark(ctx: RenderContenxtType, position: { x: number; y: number; }): void {
140
154
  if (ctx.viewOptions.watermark) {
141
155
  const watermark = ctx.viewOptions.watermark;
142
156
  ctx.contentContext.ctx.save();
143
157
  ctx.contentContext.ctx.translate(position.x, position.y);
144
158
  const { width, height } = this.rect;
145
- const degrees = Math.atan(height / width) * 180 / Math.PI;
159
+ const degrees = Math.atan(height / width) * 180 / Math.PI
146
160
  ctx.contentContext.ctx.rotate(degrees * Math.PI / 180);
147
161
  ctx.contentContext.ctx.globalAlpha = 0.3;
148
162
  const d = Math.sqrt(width * width + height * height);
@@ -150,17 +164,18 @@ export class DocumentRenderObject extends BlockContainerRenderObject {
150
164
  textProps.color = "rgb(0,0,0)";
151
165
  textProps.fontName = '楷体';
152
166
  textProps.fontSize = 60;
153
- const textWidth = ctx.contentContext.measureText(watermark, textProps).width;
167
+ const textWidth = ctx.contentContext.measureText(watermark, textProps).width
154
168
  const x = d / 2 - textWidth / 2;
155
- ctx.contentContext.ctx.font = textProps.getFont();
169
+ ctx.contentContext.ctx.font = textProps.getFont()
156
170
  ctx.contentContext.ctx.fillText(watermark, x, 30);
157
171
  ctx.contentContext.ctx.restore();
158
172
  }
159
173
  }
174
+
160
175
  /**
161
176
  * 绘制文档页码
162
177
  */
163
- drawDocPageNum(ctx, position) {
178
+ drawDocPageNum(ctx: RenderContenxtType, position: { x: number; y: number; }): void {
164
179
  const pageWidth = ctx.viewOptions.docPageSettings.width;
165
180
  const pageIndex = this.getIndex() + 1;
166
181
  const str = CommonUtil.parseText(ctx.viewOptions.pageNumFormat, { index: pageIndex, count: this.parent.length });
@@ -170,11 +185,12 @@ export class DocumentRenderObject extends BlockContainerRenderObject {
170
185
  textProps.fontSize = 14;
171
186
  textProps.fontStyle = 'italic';
172
187
  const size = ctx.contentContext.measureText(str, textProps);
173
- const alignCenterX = position.x + Math.ceil(pageWidth / 2) - Math.ceil(size.width / 2);
188
+ const alignCenterX = position.x + Math.ceil(pageWidth / 2) - Math.ceil(size.width / 2)
174
189
  const paintY = position.y + this.rect.height - size.height - 5;
175
190
  ctx.contentContext.drawText(str, textProps, alignCenterX, paintY, size.width, size.height);
176
191
  }
177
- clone() {
192
+
193
+ clone(): RenderObject {
178
194
  const cloneRender = new DocumentRenderObject(this.element);
179
195
  cloneRender.rect = ElementUtil.cloneRect(this.rect);
180
196
  cloneRender.headerLine = this.headerLine;
@@ -185,13 +201,14 @@ export class DocumentRenderObject extends BlockContainerRenderObject {
185
201
  return cloneRender;
186
202
  }
187
203
  }
188
- export class DocumentFactory extends ElementFactory {
189
- match(type) {
204
+
205
+ export class DocumentFactory extends ElementFactory<DocumentProps> {
206
+ match(type: string): boolean {
190
207
  return type === 'doc';
191
208
  }
192
- createElement(data, renderCtx) {
209
+ createElement(data: readElementProps<DocumentProps>, renderCtx: RenderContenxtType): Element {
193
210
  const documentElement = new DocumentElement();
194
- const props = data.props;
211
+ const props = data.props as DocumentProps;
195
212
  const docProps = documentElement.props;
196
213
  docProps.width = props.width;
197
214
  docProps.height = props.height;
@@ -205,5 +222,5 @@ export class DocumentFactory extends ElementFactory {
205
222
  docProps.orient = props.orient ?? 'portrait';
206
223
  return documentElement;
207
224
  }
225
+
208
226
  }
209
- //# sourceMappingURL=doc-impl.js.map
@@ -1,20 +1,22 @@
1
- import { CommonUtil } from "@/med_editor/framework/common-util";
2
- import { ElementFactory } from "../../element-define";
1
+ import { CommonUtil } from "../../common-util";
2
+ import { ViewOptions, Element, SerializeProps, ElementFactory, readElementProps, Rect } from "../../element-define";
3
3
  import { DataEleMHProps, TextProps } from "../../element-props";
4
4
  import { ElementUtil } from "../../element-util";
5
- import { LeafRenderObject } from "../../render-define";
5
+ import { RenderContenxtType } from "../../render-context";
6
+ import { LeafRenderObject, RenderObject } from "../../render-define";
6
7
  import { DataElementLeaf } from "../data-element/data-element-base-impl";
8
+
7
9
  /**
8
10
  * 月经史
9
11
  */
10
- export class DataElementMH extends DataElementLeaf {
12
+ export class DataElementMH extends DataElementLeaf<DataEleMHProps> {
11
13
  //props!: DataEleMHProps;
12
14
  constructor() {
13
- super('data-ele-mh');
15
+ super('data-ele-mh')
14
16
  this.props = new DataEleMHProps();
15
17
  //this.addPropValueChangedSub(this.props);
16
18
  }
17
- setValue(val) {
19
+ setValue(val: DataEleMHProps | string | null): void {
18
20
  if (typeof val === 'string' && val) {
19
21
  const items = val.split(';');
20
22
  if (items.length >= 4) {
@@ -24,8 +26,7 @@ export class DataElementMH extends DataElementLeaf {
24
26
  this.props[mhLayoutItem.bottom.prop] = items[2];
25
27
  this.props[mhLayoutItem.right.prop] = items[3];
26
28
  }
27
- }
28
- else if (typeof val === 'object') {
29
+ } else if (typeof val === 'object') {
29
30
  this.props.age = val?.age ?? '';
30
31
  this.props.days = val?.days ?? '';
31
32
  this.props.cycles = val?.cycles ?? '';
@@ -33,11 +34,13 @@ export class DataElementMH extends DataElementLeaf {
33
34
  this.props.closeAge = val?.closeAge ?? '';
34
35
  }
35
36
  }
37
+
36
38
  getValue() {
37
39
  const layoutItem = getMHItem(this.props.kind);
38
40
  return `${this.props[layoutItem.left.prop]};${this.props[layoutItem.top.prop]};${this.props[layoutItem.bottom.prop]};${this.props[layoutItem.right.prop]}`;
39
41
  }
40
- createRenderObject(options, renderCtx) {
42
+
43
+ createRenderObject(options: ViewOptions, renderCtx: RenderContenxtType): RenderObject<Element> | null {
41
44
  const render = new DataRenderMH(this);
42
45
  const measure = renderMH(this, renderCtx, { x: 0, y: 0 }, false);
43
46
  if (measure) {
@@ -46,52 +49,67 @@ export class DataElementMH extends DataElementLeaf {
46
49
  }
47
50
  return render;
48
51
  }
49
- serialize(viewOptions) {
52
+ serialize(viewOptions: ViewOptions): SerializeProps | null {
50
53
  return {
51
54
  type: this.type,
52
55
  props: this.props.getSerializeProps(viewOptions)
53
- };
56
+ }
54
57
  }
55
- clone(data) {
58
+ clone(data: boolean): Element {
56
59
  const element = new DataElementMH();
57
60
  this.props.clone(element.props);
58
61
  return element;
59
62
  }
60
- getCurrentLayoutItem() {
63
+
64
+ getCurrentLayoutItem(): MHLayoutType {
61
65
  return getMHItem(this.props.kind);
62
66
  }
67
+
68
+ }
69
+
70
+ type MHLayoutType = {
71
+ [key in 'left' | 'top' | 'right' | 'bottom']: {
72
+ tip: '初潮年龄' | '行经期天数' | '末次月经时间' | '月经周期天数' | '闭经年龄',
73
+ prop: 'age' | 'days' | 'cycles' | 'lastDate' | 'closeAge'
74
+ }
63
75
  }
64
- const mhLayoutItems = [
76
+
77
+ const mhLayoutItems: Array<MHLayoutType> = [
65
78
  { left: { tip: '初潮年龄', prop: 'age' }, top: { tip: '行经期天数', prop: 'days' }, right: { tip: '末次月经时间', prop: 'lastDate' }, bottom: { tip: '月经周期天数', prop: 'cycles' } },
66
79
  { left: { tip: '初潮年龄', prop: 'age' }, top: { tip: '闭经年龄', prop: 'closeAge' }, right: { tip: '末次月经时间', prop: 'lastDate' }, bottom: { tip: '行经期天数', prop: 'days' } },
67
80
  { left: { tip: '闭经年龄', prop: 'closeAge' }, top: { tip: '行经期天数', prop: 'days' }, right: { tip: '末次月经时间', prop: 'lastDate' }, bottom: { tip: '月经周期天数', prop: 'cycles' } },
68
81
  { left: { tip: '初潮年龄', prop: 'age' }, top: { tip: '月经周期天数', prop: 'cycles' }, right: { tip: '末次月经时间', prop: 'lastDate' }, bottom: { tip: '行经期天数', prop: 'days' } },
69
82
  { left: { tip: '初潮年龄', prop: 'age' }, top: { tip: '闭经年龄', prop: 'closeAge' }, right: { tip: '末次月经时间', prop: 'lastDate' }, bottom: { tip: '月经周期天数', prop: 'cycles' } }
70
- ];
71
- function getMHItem(kind) {
83
+ ]
84
+
85
+
86
+ function getMHItem(kind: string): MHLayoutType {
72
87
  kind = kind ?? 'A';
73
88
  kind = kind.toUpperCase();
74
89
  let kindIndex = ['A', 'B', 'C', 'D', 'E'].indexOf(kind);
75
90
  kindIndex = kindIndex < 0 ? 0 : kindIndex;
76
91
  return mhLayoutItems[kindIndex];
77
92
  }
78
- export class DataRenderMH extends LeafRenderObject {
79
- render(ctx, position) {
93
+
94
+ export class DataRenderMH extends LeafRenderObject<DataElementMH> {
95
+ render(ctx: RenderContenxtType, position: { x: number; y: number; }): void {
80
96
  renderMH(this.element, ctx, position, true);
81
97
  }
82
- clone() {
98
+
99
+ clone(): RenderObject<Element> {
83
100
  const clone = new DataRenderMH(this.element);
84
101
  clone.rect = ElementUtil.cloneRect(this.rect);
85
102
  return clone;
86
103
  }
87
104
  }
88
- export class DataElementMHFactory extends ElementFactory {
89
- match(type) {
90
- return type === 'data-ele-mh';
105
+
106
+ export class DataElementMHFactory extends ElementFactory<DataEleMHProps> {
107
+ match(type: string): boolean {
108
+ return type === 'data-ele-mh'
91
109
  }
92
- createElement(data, renderCtx) {
110
+ createElement(data: readElementProps<DataEleMHProps>, renderCtx: RenderContenxtType): Element {
93
111
  const ele = new DataElementMH();
94
- ElementUtil.readEleBaseProps(ele.props, data.props);
112
+ ElementUtil.readEleBaseProps(ele.props, data.props as DataEleMHProps);
95
113
  ele.props.age = data.props?.age ?? '';
96
114
  ele.props.cycles = data.props?.cycles ?? '';
97
115
  ele.props.days = data.props?.days ?? '';
@@ -100,10 +118,12 @@ export class DataElementMHFactory extends ElementFactory {
100
118
  ele.props.kind = data.props?.kind ?? 'A';
101
119
  return ele;
102
120
  }
121
+
103
122
  }
104
- function renderMH(element, ctx, position, isPaint) {
123
+
124
+ function renderMH(element: DataElementMH, ctx: RenderContenxtType, position: { x: number; y: number; }, isPaint: boolean): { width: number, height: number } | void {
105
125
  let { x, y } = position;
106
- const defaultTextProps = new TextProps();
126
+ const defaultTextProps = new TextProps()
107
127
  const paddingVer = 2;
108
128
  const paddingHor = 5;
109
129
  defaultTextProps.fontSize = 12;
@@ -114,30 +134,31 @@ function renderMH(element, ctx, position, isPaint) {
114
134
  const top = CommonUtil.getEmptyValue(element.props[currentLayout.top.prop], currentLayout.top.tip);
115
135
  const bottom = CommonUtil.getEmptyValue(element.props[currentLayout.bottom.prop], currentLayout.bottom.tip);
116
136
  const right = CommonUtil.getEmptyValue(element.props[currentLayout.right.prop], currentLayout.right.tip);
117
- const leftRect = ctx.contentContext.measureText(left, defaultTextProps);
118
- const topRect = ctx.contentContext.measureText(top, defaultTextProps);
119
- const bottomRect = ctx.contentContext.measureText(bottom, defaultTextProps);
120
- const rightRect = ctx.contentContext.measureText(right, defaultTextProps);
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)
121
141
  let height = topRect.height + bottomRect.height;
122
- const middleWidth = Math.max(topRect.width, bottomRect.width);
142
+ const middleWidth = Math.max(topRect.width, bottomRect.width)
123
143
  let width = leftRect.width + middleWidth + rightRect.width;
124
144
  if (!isPaint) {
125
- return { width: width + paddingHor * 2, height: height + paddingVer * 2 };
145
+ return { width: width + paddingHor * 2, height: height + paddingVer * 2 }
126
146
  }
127
147
  x += paddingHor;
128
148
  y += paddingVer;
129
149
  //年龄
130
- ctx.contentContext.drawText(left, defaultTextProps, x, y + (height - leftRect.height) / 2, leftRect.width, leftRect.height);
150
+ ctx.contentContext.drawText(left, defaultTextProps, x, y + (height - leftRect.height) / 2, leftRect.width, leftRect.height)
131
151
  x += leftRect.width;
132
152
  //天数
133
153
  ctx.contentContext.drawText(top, defaultTextProps, x + (middleWidth - topRect.width) / 2, y - 2, topRect.width, topRect.height);
134
154
  //分割线
135
- ctx.contentContext.drawLine(x, y + topRect.height, middleWidth);
155
+ ctx.contentContext.drawLine(x, y + topRect.height, middleWidth)
136
156
  //周期
137
157
  ctx.contentContext.drawText(bottom, defaultTextProps, x + (middleWidth - bottomRect.width) / 2, y + topRect.height + 2, bottomRect.width, bottomRect.height);
138
158
  //末次时间
139
159
  x += middleWidth;
140
- ctx.contentContext.drawText(right, defaultTextProps, x, y + (height - leftRect.height) / 2, rightRect.width, rightRect.height);
160
+ ctx.contentContext.drawText(right, defaultTextProps, x, y + (height - leftRect.height) / 2, rightRect.width, rightRect.height)
161
+
141
162
  if (ctx.drawMode === 'view') {
142
163
  let { x, y } = position;
143
164
  width = width + paddingHor * 2;
@@ -150,4 +171,5 @@ function renderMH(element, ctx, position, isPaint) {
150
171
  ctx.contentContext.strokeLines([{ x: x - lineWidth, y }, { x, y }, { x, y: y + height }, { x: x - lineWidth, y: y + height }], 1, paintColor);
151
172
  }
152
173
  }
153
- //# sourceMappingURL=menstrual-history.js.map
174
+
175
+
@@ -1,8 +1,22 @@
1
- import { BlockContentElement, ElementFactory } from "@/med_editor/framework/element-define";
2
- import { ParagraphProps } from "@/med_editor/framework/element-props";
3
- import { ElementUtil } from "@/med_editor/framework/element-util";
4
- import { BlockLineRectRenderObject, MuiltBlockLineRenderObject } from "@/med_editor/framework/render-define";
5
- export class ParagraphElement extends BlockContentElement {
1
+ import {
2
+ BlockContentElement,
3
+ ElementFactory,
4
+ Element,
5
+ SerializeProps,
6
+ ViewOptions,
7
+ readElementProps
8
+ } from "../../element-define";
9
+ import { ContextMenuElementEvent } from "../../element-event-define";
10
+ import { ParagraphProps } from "../../element-props";
11
+ import { ElementUtil } from "../../element-util";
12
+ import { RenderContenxtType } from "../../render-context";
13
+ import {
14
+ BlockLineRectRenderObject,
15
+ MuiltBlockLineRenderObject,
16
+ RenderObject
17
+ } from "../../render-define";
18
+
19
+ export class ParagraphElement extends BlockContentElement<ParagraphProps> {
6
20
  //props: ParagraphProps;
7
21
  constructor() {
8
22
  super('p');
@@ -15,15 +29,15 @@ export class ParagraphElement extends BlockContentElement {
15
29
  if (this.props.numberType >= 0) {
16
30
  this.props.numberType = -1;
17
31
  evt.isCancel = true;
18
- }
19
- else if (this.props.indent) {
32
+ } else if (this.props.indent) {
20
33
  this.props.indent = 0;
21
34
  evt.isCancel = true;
22
35
  }
23
36
  }
24
37
  }
38
+
25
39
  }, true);
26
- this.addEvent('ElementContextMenu', (evt) => {
40
+ this.addEvent<ContextMenuElementEvent>('ElementContextMenu', (evt) => {
27
41
  const { selectionState } = evt;
28
42
  evt.menus.push({
29
43
  icon: 'DeleteTable', caption: '删除段落', eventObj: {
@@ -33,8 +47,7 @@ export class ParagraphElement extends BlockContentElement {
33
47
  const nextFocusableEle = ElementUtil.getRecursionNextSiblingElement(psymbol, false, true);
34
48
  if (nextFocusableEle) {
35
49
  selectionState.resetRange(nextFocusableEle, 0);
36
- }
37
- else {
50
+ } else {
38
51
  selectionState.clear();
39
52
  }
40
53
  this.remove();
@@ -44,19 +57,22 @@ export class ParagraphElement extends BlockContentElement {
44
57
  });
45
58
  });
46
59
  }
47
- createRenderObject() {
60
+
61
+ createRenderObject(): ParagraphRenderObject {
48
62
  const paraRender = new ParagraphRenderObject(this);
49
63
  return paraRender;
50
64
  }
51
- serialize(viewOptions) {
65
+
66
+ serialize(viewOptions: ViewOptions): SerializeProps {
52
67
  return {
53
68
  type: 'p',
54
69
  props: {
55
70
  ...this.props.getSerializeProps(viewOptions)
56
71
  }
57
- };
72
+ }
58
73
  }
59
- clone(data) {
74
+
75
+ clone(data: boolean): Element {
60
76
  const clone = new ParagraphElement();
61
77
  this.props.clone(clone.props);
62
78
  if (data) {
@@ -66,26 +82,32 @@ export class ParagraphElement extends BlockContentElement {
66
82
  }
67
83
  return clone;
68
84
  }
69
- static createElement() {
85
+
86
+ static createElement(): ParagraphElement {
70
87
  return new ParagraphElement();
71
88
  }
89
+
72
90
  }
91
+
73
92
  export class ParagraphRenderObject extends MuiltBlockLineRenderObject {
74
- beginRender(ctx, position) {
93
+ beginRender(ctx: RenderContenxtType, position: { x: number; y: number; }): void {
75
94
  }
76
- endRender(ctx, position) {
95
+
96
+ endRender(ctx: RenderContenxtType, position: { x: number; y: number; }): void {
77
97
  this.drawProjectNumber(ctx);
78
98
  }
99
+
100
+
79
101
  /**
80
102
  * 绘制项目符号
81
103
  */
82
- drawProjectNumber(ctx) {
83
- const paraElement = this.element;
104
+ drawProjectNumber(ctx: RenderContenxtType): void {
105
+ const paraElement = this.element as ParagraphElement;
84
106
  if (paraElement.props.numberType >= 0) {
85
107
  if (paraElement.paintRenders.indexOf(this) > 0) {
86
108
  return;
87
109
  }
88
- const firstLine = this.getChild(0);
110
+ const firstLine = this.getChild(0) as ParagraphLineRectRenderObject;
89
111
  if (!firstLine) {
90
112
  debugger;
91
113
  }
@@ -99,10 +121,12 @@ export class ParagraphRenderObject extends MuiltBlockLineRenderObject {
99
121
  });
100
122
  const numberSymbolY = firstInlinePaintPos.y + Math.ceil(firstInline.rect.height / 2);
101
123
  //ctx.contentContext.drawText(str, textProps, firstInlinePaintPos.x - paraElement.paraProps.indent, numberSymbolY, 14, 14);
102
- ctx.contentContext.fillCircular(firstInlinePaintPos.x - paraElement.props.indent + 2, numberSymbolY, 4);
124
+ ctx.contentContext.fillCircular(firstInlinePaintPos.x - paraElement.props.indent + 2, numberSymbolY, 4)
103
125
  }
104
126
  }
105
- clone() {
127
+
128
+
129
+ clone(): RenderObject {
106
130
  const cloneRender = new ParagraphRenderObject(this.element);
107
131
  cloneRender.rect = ElementUtil.cloneRect(this.rect);
108
132
  for (let i = 0; i < this.length; i++) {
@@ -110,17 +134,22 @@ export class ParagraphRenderObject extends MuiltBlockLineRenderObject {
110
134
  }
111
135
  return cloneRender;
112
136
  }
113
- createLineRect() {
137
+
138
+ createLineRect(): ParagraphLineRectRenderObject {
114
139
  const lineRect = new ParagraphLineRectRenderObject(this.element);
115
140
  lineRect.rect.maxWidth = this.rect.maxWidth;
116
141
  return lineRect;
117
142
  }
143
+
144
+
118
145
  }
119
- export class ParagraphFactory extends ElementFactory {
120
- match(type) {
146
+
147
+ export class ParagraphFactory extends ElementFactory<ParagraphProps> {
148
+ match(type: string): boolean {
121
149
  return type === 'p';
122
150
  }
123
- createElement(data, renderCtx) {
151
+
152
+ createElement(data: readElementProps<ParagraphProps>, renderCtx: RenderContenxtType): Element {
124
153
  const paraElement = new ParagraphElement();
125
154
  const props = data.props;
126
155
  paraElement.props.indent = props?.indent ?? 0;
@@ -133,18 +162,24 @@ export class ParagraphFactory extends ElementFactory {
133
162
  return paraElement;
134
163
  }
135
164
  }
165
+
136
166
  /**
137
167
  * 段落行框
138
168
  */
139
169
  export class ParagraphLineRectRenderObject extends BlockLineRectRenderObject {
140
- beginRender(ctx, position) {
170
+
171
+ beginRender(ctx: RenderContenxtType, position: { x: number; y: number; }): void {
141
172
  //console.log('绘制段落行-begin');
173
+
142
174
  }
143
- endRender(ctx, position) {
175
+
176
+ endRender(ctx: RenderContenxtType, position: { x: number; y: number; }): void {
144
177
  //console.log('绘制段落行-end');
145
178
  //ctx.strokeRect(position.x, position.y, this.rect.width, this.rect.height);
146
179
  }
147
- clone() {
180
+
181
+
182
+ clone(): RenderObject {
148
183
  const cloneRender = new ParagraphLineRectRenderObject(this.element);
149
184
  cloneRender.rect = ElementUtil.cloneRect(this.rect);
150
185
  for (let i = 0; i < this.length; i++) {
@@ -153,4 +188,3 @@ export class ParagraphLineRectRenderObject extends BlockLineRectRenderObject {
153
188
  return cloneRender;
154
189
  }
155
190
  }
156
- //# sourceMappingURL=p-impl.js.map