@hailin-zheng/editor-core 1.0.3 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (303) hide show
  1. package/package.json +6 -2
  2. package/dist/doc-ruler.d.ts +0 -51
  3. package/dist/doc-ruler.js +0 -313
  4. package/dist/doc-ruler.js.map +0 -1
  5. package/dist/framework/common-util.d.ts +0 -63
  6. package/dist/framework/common-util.js +0 -178
  7. package/dist/framework/common-util.js.map +0 -1
  8. package/dist/framework/document-change.d.ts +0 -265
  9. package/dist/framework/document-change.js +0 -1342
  10. package/dist/framework/document-change.js.map +0 -1
  11. package/dist/framework/document-combine.d.ts +0 -24
  12. package/dist/framework/document-combine.js +0 -40
  13. package/dist/framework/document-combine.js.map +0 -1
  14. package/dist/framework/document-comment.d.ts +0 -46
  15. package/dist/framework/document-comment.js +0 -148
  16. package/dist/framework/document-comment.js.map +0 -1
  17. package/dist/framework/document-context.d.ts +0 -149
  18. package/dist/framework/document-context.js +0 -330
  19. package/dist/framework/document-context.js.map +0 -1
  20. package/dist/framework/document-eval-func.d.ts +0 -18
  21. package/dist/framework/document-eval-func.js +0 -48
  22. package/dist/framework/document-eval-func.js.map +0 -1
  23. package/dist/framework/document-event.d.ts +0 -213
  24. package/dist/framework/document-event.js +0 -1054
  25. package/dist/framework/document-event.js.map +0 -1
  26. package/dist/framework/document-history.d.ts +0 -26
  27. package/dist/framework/document-history.js +0 -65
  28. package/dist/framework/document-history.js.map +0 -1
  29. package/dist/framework/document-images-loader.d.ts +0 -16
  30. package/dist/framework/document-images-loader.js +0 -66
  31. package/dist/framework/document-images-loader.js.map +0 -1
  32. package/dist/framework/document-input-cursor.d.ts +0 -78
  33. package/dist/framework/document-input-cursor.js +0 -239
  34. package/dist/framework/document-input-cursor.js.map +0 -1
  35. package/dist/framework/document-paint.d.ts +0 -34
  36. package/dist/framework/document-paint.js +0 -103
  37. package/dist/framework/document-paint.js.map +0 -1
  38. package/dist/framework/document-print-offscreen.d.ts +0 -38
  39. package/dist/framework/document-print-offscreen.js +0 -128
  40. package/dist/framework/document-print-offscreen.js.map +0 -1
  41. package/dist/framework/document-print.d.ts +0 -60
  42. package/dist/framework/document-print.js +0 -203
  43. package/dist/framework/document-print.js.map +0 -1
  44. package/dist/framework/document-segmenter.d.ts +0 -2
  45. package/dist/framework/document-segmenter.js +0 -106
  46. package/dist/framework/document-segmenter.js.map +0 -1
  47. package/dist/framework/document-selection.d.ts +0 -89
  48. package/dist/framework/document-selection.js +0 -358
  49. package/dist/framework/document-selection.js.map +0 -1
  50. package/dist/framework/document-template.d.ts +0 -4
  51. package/dist/framework/document-template.js +0 -20
  52. package/dist/framework/document-template.js.map +0 -1
  53. package/dist/framework/document-textline-mode.d.ts +0 -7
  54. package/dist/framework/document-textline-mode.js +0 -30
  55. package/dist/framework/document-textline-mode.js.map +0 -1
  56. package/dist/framework/element-define.d.ts +0 -319
  57. package/dist/framework/element-define.js +0 -579
  58. package/dist/framework/element-define.js.map +0 -1
  59. package/dist/framework/element-event-define.d.ts +0 -99
  60. package/dist/framework/element-event-define.js +0 -108
  61. package/dist/framework/element-event-define.js.map +0 -1
  62. package/dist/framework/element-measure.d.ts +0 -97
  63. package/dist/framework/element-measure.js +0 -551
  64. package/dist/framework/element-measure.js.map +0 -1
  65. package/dist/framework/element-paint.d.ts +0 -42
  66. package/dist/framework/element-paint.js +0 -170
  67. package/dist/framework/element-paint.js.map +0 -1
  68. package/dist/framework/element-props.d.ts +0 -301
  69. package/dist/framework/element-props.js +0 -809
  70. package/dist/framework/element-props.js.map +0 -1
  71. package/dist/framework/element-reader.d.ts +0 -19
  72. package/dist/framework/element-reader.js +0 -151
  73. package/dist/framework/element-reader.js.map +0 -1
  74. package/dist/framework/element-render-cut.d.ts +0 -55
  75. package/dist/framework/element-render-cut.js +0 -449
  76. package/dist/framework/element-render-cut.js.map +0 -1
  77. package/dist/framework/element-serialize.d.ts +0 -30
  78. package/dist/framework/element-serialize.js +0 -113
  79. package/dist/framework/element-serialize.js.map +0 -1
  80. package/dist/framework/element-util.d.ts +0 -369
  81. package/dist/framework/element-util.js +0 -1463
  82. package/dist/framework/element-util.js.map +0 -1
  83. package/dist/framework/impl/checkbox/checkbox-impl.d.ts +0 -24
  84. package/dist/framework/impl/checkbox/checkbox-impl.js +0 -64
  85. package/dist/framework/impl/checkbox/checkbox-impl.js.map +0 -1
  86. package/dist/framework/impl/comments/comment-content-impl.d.ts +0 -40
  87. package/dist/framework/impl/comments/comment-content-impl.js +0 -105
  88. package/dist/framework/impl/comments/comment-content-impl.js.map +0 -1
  89. package/dist/framework/impl/comments/comment-element-impl.d.ts +0 -21
  90. package/dist/framework/impl/comments/comment-element-impl.js +0 -62
  91. package/dist/framework/impl/comments/comment-element-impl.js.map +0 -1
  92. package/dist/framework/impl/comments/comments-container-impl.d.ts +0 -22
  93. package/dist/framework/impl/comments/comments-container-impl.js +0 -62
  94. package/dist/framework/impl/comments/comments-container-impl.js.map +0 -1
  95. package/dist/framework/impl/comments/comments-util.d.ts +0 -12
  96. package/dist/framework/impl/comments/comments-util.js +0 -67
  97. package/dist/framework/impl/comments/comments-util.js.map +0 -1
  98. package/dist/framework/impl/comments/validate-msg-impl.d.ts +0 -21
  99. package/dist/framework/impl/comments/validate-msg-impl.js +0 -83
  100. package/dist/framework/impl/comments/validate-msg-impl.js.map +0 -1
  101. package/dist/framework/impl/data-element/data-decorate-impl.d.ts +0 -30
  102. package/dist/framework/impl/data-element/data-decorate-impl.js +0 -91
  103. package/dist/framework/impl/data-element/data-decorate-impl.js.map +0 -1
  104. package/dist/framework/impl/data-element/data-element-barcode.d.ts +0 -31
  105. package/dist/framework/impl/data-element/data-element-barcode.js +0 -115
  106. package/dist/framework/impl/data-element/data-element-barcode.js.map +0 -1
  107. package/dist/framework/impl/data-element/data-element-base-impl.d.ts +0 -68
  108. package/dist/framework/impl/data-element/data-element-base-impl.js +0 -205
  109. package/dist/framework/impl/data-element/data-element-base-impl.js.map +0 -1
  110. package/dist/framework/impl/data-element/data-element-check-impl.d.ts +0 -35
  111. package/dist/framework/impl/data-element/data-element-check-impl.js +0 -133
  112. package/dist/framework/impl/data-element/data-element-check-impl.js.map +0 -1
  113. package/dist/framework/impl/data-element/data-element-date-impl.d.ts +0 -23
  114. package/dist/framework/impl/data-element/data-element-date-impl.js +0 -111
  115. package/dist/framework/impl/data-element/data-element-date-impl.js.map +0 -1
  116. package/dist/framework/impl/data-element/data-element-group-impl.d.ts +0 -23
  117. package/dist/framework/impl/data-element/data-element-group-impl.js +0 -130
  118. package/dist/framework/impl/data-element/data-element-group-impl.js.map +0 -1
  119. package/dist/framework/impl/data-element/data-element-image-impl.d.ts +0 -30
  120. package/dist/framework/impl/data-element/data-element-image-impl.js +0 -137
  121. package/dist/framework/impl/data-element/data-element-image-impl.js.map +0 -1
  122. package/dist/framework/impl/data-element/data-element-list-impl.d.ts +0 -22
  123. package/dist/framework/impl/data-element/data-element-list-impl.js +0 -131
  124. package/dist/framework/impl/data-element/data-element-list-impl.js.map +0 -1
  125. package/dist/framework/impl/data-element/data-element-text-impl.d.ts +0 -23
  126. package/dist/framework/impl/data-element/data-element-text-impl.js +0 -103
  127. package/dist/framework/impl/data-element/data-element-text-impl.js.map +0 -1
  128. package/dist/framework/impl/decorate/fill-null-space-imple.d.ts +0 -21
  129. package/dist/framework/impl/decorate/fill-null-space-imple.js +0 -43
  130. package/dist/framework/impl/decorate/fill-null-space-imple.js.map +0 -1
  131. package/dist/framework/impl/document/doc-body-impl.d.ts +0 -27
  132. package/dist/framework/impl/document/doc-body-impl.js +0 -79
  133. package/dist/framework/impl/document/doc-body-impl.js.map +0 -1
  134. package/dist/framework/impl/document/doc-body-part-impl.d.ts +0 -30
  135. package/dist/framework/impl/document/doc-body-part-impl.js +0 -94
  136. package/dist/framework/impl/document/doc-body-part-impl.js.map +0 -1
  137. package/dist/framework/impl/document/doc-container-impl.d.ts +0 -16
  138. package/dist/framework/impl/document/doc-container-impl.js +0 -21
  139. package/dist/framework/impl/document/doc-container-impl.js.map +0 -1
  140. package/dist/framework/impl/document/doc-footer-impl.d.ts +0 -26
  141. package/dist/framework/impl/document/doc-footer-impl.js +0 -77
  142. package/dist/framework/impl/document/doc-footer-impl.js.map +0 -1
  143. package/dist/framework/impl/document/doc-header-impl.d.ts +0 -26
  144. package/dist/framework/impl/document/doc-header-impl.js +0 -83
  145. package/dist/framework/impl/document/doc-header-impl.js.map +0 -1
  146. package/dist/framework/impl/document/doc-impl.d.ts +0 -61
  147. package/dist/framework/impl/document/doc-impl.js +0 -209
  148. package/dist/framework/impl/document/doc-impl.js.map +0 -1
  149. package/dist/framework/impl/media-formula/menstrual-history.d.ts +0 -35
  150. package/dist/framework/impl/media-formula/menstrual-history.js +0 -153
  151. package/dist/framework/impl/media-formula/menstrual-history.js.map +0 -1
  152. package/dist/framework/impl/paragraph/p-impl.d.ts +0 -45
  153. package/dist/framework/impl/paragraph/p-impl.js +0 -156
  154. package/dist/framework/impl/paragraph/p-impl.js.map +0 -1
  155. package/dist/framework/impl/picture/image-impl.d.ts +0 -31
  156. package/dist/framework/impl/picture/image-impl.js +0 -124
  157. package/dist/framework/impl/picture/image-impl.js.map +0 -1
  158. package/dist/framework/impl/radio/radio-impl.d.ts +0 -22
  159. package/dist/framework/impl/radio/radio-impl.js +0 -72
  160. package/dist/framework/impl/radio/radio-impl.js.map +0 -1
  161. package/dist/framework/impl/symbol/br-symbol-impl.d.ts +0 -22
  162. package/dist/framework/impl/symbol/br-symbol-impl.js +0 -54
  163. package/dist/framework/impl/symbol/br-symbol-impl.js.map +0 -1
  164. package/dist/framework/impl/symbol/p-symbol-impl.d.ts +0 -19
  165. package/dist/framework/impl/symbol/p-symbol-impl.js +0 -54
  166. package/dist/framework/impl/symbol/p-symbol-impl.js.map +0 -1
  167. package/dist/framework/impl/table/table-cell-impl.d.ts +0 -37
  168. package/dist/framework/impl/table/table-cell-impl.js +0 -145
  169. package/dist/framework/impl/table/table-cell-impl.js.map +0 -1
  170. package/dist/framework/impl/table/table-impl.d.ts +0 -55
  171. package/dist/framework/impl/table/table-impl.js +0 -363
  172. package/dist/framework/impl/table/table-impl.js.map +0 -1
  173. package/dist/framework/impl/table/table-row-impl.d.ts +0 -26
  174. package/dist/framework/impl/table/table-row-impl.js +0 -75
  175. package/dist/framework/impl/table/table-row-impl.js.map +0 -1
  176. package/dist/framework/impl/table/table-split-cell-patch.d.ts +0 -20
  177. package/dist/framework/impl/table/table-split-cell-patch.js +0 -89
  178. package/dist/framework/impl/table/table-split-cell-patch.js.map +0 -1
  179. package/dist/framework/impl/table/table-split-cell.d.ts +0 -90
  180. package/dist/framework/impl/table/table-split-cell.js +0 -464
  181. package/dist/framework/impl/table/table-split-cell.js.map +0 -1
  182. package/dist/framework/impl/table/table-util.d.ts +0 -150
  183. package/dist/framework/impl/table/table-util.js +0 -678
  184. package/dist/framework/impl/table/table-util.js.map +0 -1
  185. package/dist/framework/impl/text/text-impl.d.ts +0 -32
  186. package/dist/framework/impl/text/text-impl.js +0 -149
  187. package/dist/framework/impl/text/text-impl.js.map +0 -1
  188. package/dist/framework/impl/text/track-run-impl.d.ts +0 -27
  189. package/dist/framework/impl/text/track-run-impl.js +0 -112
  190. package/dist/framework/impl/text/track-run-impl.js.map +0 -1
  191. package/dist/framework/notify.d.ts +0 -13
  192. package/dist/framework/notify.js +0 -116
  193. package/dist/framework/notify.js.map +0 -1
  194. package/dist/framework/range-util.d.ts +0 -40
  195. package/dist/framework/range-util.js +0 -312
  196. package/dist/framework/range-util.js.map +0 -1
  197. package/dist/framework/render-context.d.ts +0 -91
  198. package/dist/framework/render-context.js +0 -384
  199. package/dist/framework/render-context.js.map +0 -1
  200. package/dist/framework/render-define.d.ts +0 -109
  201. package/dist/framework/render-define.js +0 -195
  202. package/dist/framework/render-define.js.map +0 -1
  203. package/dist/framework/selection-overlays.d.ts +0 -30
  204. package/dist/framework/selection-overlays.js +0 -124
  205. package/dist/framework/selection-overlays.js.map +0 -1
  206. package/dist/texteditor.d.ts +0 -318
  207. package/dist/texteditor.js +0 -913
  208. package/dist/texteditor.js.map +0 -1
  209. package/dist/util/subject.d.ts +0 -34
  210. package/dist/util/subject.js +0 -88
  211. package/dist/util/subject.js.map +0 -1
  212. package/dist/util/table-bind.d.ts +0 -5
  213. package/dist/util/table-bind.js +0 -6
  214. package/dist/util/table-bind.js.map +0 -1
  215. package/src/med_editor/doc-ruler.ts +0 -340
  216. package/src/med_editor/framework/common-util.ts +0 -200
  217. package/src/med_editor/framework/document-change.ts +0 -1392
  218. package/src/med_editor/framework/document-combine.ts +0 -44
  219. package/src/med_editor/framework/document-comment.ts +0 -168
  220. package/src/med_editor/framework/document-context.ts +0 -410
  221. package/src/med_editor/framework/document-eval-func.ts +0 -53
  222. package/src/med_editor/framework/document-event.ts +0 -1082
  223. package/src/med_editor/framework/document-history.ts +0 -76
  224. package/src/med_editor/framework/document-images-loader.ts +0 -74
  225. package/src/med_editor/framework/document-input-cursor.ts +0 -244
  226. package/src/med_editor/framework/document-paint.ts +0 -110
  227. package/src/med_editor/framework/document-print-offscreen.ts +0 -134
  228. package/src/med_editor/framework/document-print.ts +0 -219
  229. package/src/med_editor/framework/document-segmenter.ts +0 -211
  230. package/src/med_editor/framework/document-selection.ts +0 -391
  231. package/src/med_editor/framework/document-template.ts +0 -20
  232. package/src/med_editor/framework/document-textline-mode.ts +0 -34
  233. package/src/med_editor/framework/element-define.ts +0 -674
  234. package/src/med_editor/framework/element-event-define.ts +0 -142
  235. package/src/med_editor/framework/element-measure.ts +0 -573
  236. package/src/med_editor/framework/element-paint.ts +0 -176
  237. package/src/med_editor/framework/element-props.ts +0 -938
  238. package/src/med_editor/framework/element-reader.ts +0 -159
  239. package/src/med_editor/framework/element-render-cut.ts +0 -456
  240. package/src/med_editor/framework/element-serialize.ts +0 -128
  241. package/src/med_editor/framework/element-util.ts +0 -1565
  242. package/src/med_editor/framework/impl/checkbox/checkbox-impl.ts +0 -71
  243. package/src/med_editor/framework/impl/comments/comment-content-impl.ts +0 -119
  244. package/src/med_editor/framework/impl/comments/comment-element-impl.ts +0 -65
  245. package/src/med_editor/framework/impl/comments/comments-container-impl.ts +0 -68
  246. package/src/med_editor/framework/impl/comments/comments-util.ts +0 -84
  247. package/src/med_editor/framework/impl/comments/validate-msg-impl.ts +0 -94
  248. package/src/med_editor/framework/impl/data-element/data-decorate-impl.ts +0 -95
  249. package/src/med_editor/framework/impl/data-element/data-element-barcode.ts +0 -127
  250. package/src/med_editor/framework/impl/data-element/data-element-base-impl.ts +0 -234
  251. package/src/med_editor/framework/impl/data-element/data-element-check-impl.ts +0 -146
  252. package/src/med_editor/framework/impl/data-element/data-element-date-impl.ts +0 -128
  253. package/src/med_editor/framework/impl/data-element/data-element-group-impl.ts +0 -150
  254. package/src/med_editor/framework/impl/data-element/data-element-image-impl.ts +0 -147
  255. package/src/med_editor/framework/impl/data-element/data-element-list-impl.ts +0 -142
  256. package/src/med_editor/framework/impl/data-element/data-element-text-impl.ts +0 -117
  257. package/src/med_editor/framework/impl/decorate/fill-null-space-imple.ts +0 -48
  258. package/src/med_editor/framework/impl/document/doc-body-impl.ts +0 -95
  259. package/src/med_editor/framework/impl/document/doc-body-part-impl.ts +0 -104
  260. package/src/med_editor/framework/impl/document/doc-container-impl.ts +0 -24
  261. package/src/med_editor/framework/impl/document/doc-footer-impl.ts +0 -88
  262. package/src/med_editor/framework/impl/document/doc-header-impl.ts +0 -100
  263. package/src/med_editor/framework/impl/document/doc-impl.ts +0 -226
  264. package/src/med_editor/framework/impl/media-formula/menstrual-history.ts +0 -175
  265. package/src/med_editor/framework/impl/paragraph/p-impl.ts +0 -190
  266. package/src/med_editor/framework/impl/picture/image-impl.ts +0 -136
  267. package/src/med_editor/framework/impl/radio/radio-impl.ts +0 -79
  268. package/src/med_editor/framework/impl/symbol/br-symbol-impl.ts +0 -60
  269. package/src/med_editor/framework/impl/symbol/p-symbol-impl.ts +0 -57
  270. package/src/med_editor/framework/impl/table/table-cell-impl.ts +0 -156
  271. package/src/med_editor/framework/impl/table/table-impl.ts +0 -401
  272. package/src/med_editor/framework/impl/table/table-row-impl.ts +0 -83
  273. package/src/med_editor/framework/impl/table/table-split-cell-patch.ts +0 -98
  274. package/src/med_editor/framework/impl/table/table-split-cell.ts +0 -475
  275. package/src/med_editor/framework/impl/table/table-util.ts +0 -716
  276. package/src/med_editor/framework/impl/text/text-impl.ts +0 -164
  277. package/src/med_editor/framework/impl/text/track-run-impl.ts +0 -135
  278. package/src/med_editor/framework/notify.ts +0 -130
  279. package/src/med_editor/framework/range-util.ts +0 -321
  280. package/src/med_editor/framework/render-context.ts +0 -431
  281. package/src/med_editor/framework/render-define.ts +0 -224
  282. package/src/med_editor/framework/selection-overlays.ts +0 -134
  283. package/src/med_editor/texteditor.ts +0 -1011
  284. package/src/med_editor/util/subject.ts +0 -118
  285. package/src/med_editor/util/table-bind.ts +0 -6
  286. package/src/med_editor//345/205/245/351/231/242/350/256/260/345/275/225.json +0 -3573
  287. 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
  288. 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
  289. 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
  290. 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
  291. 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
  292. package/src/med_editor//345/220/210/345/271/266/347/227/205/347/250/213/345/275/225.json +0 -2874
  293. package/src/med_editor//346/211/213/346/234/257/350/256/260/345/275/225.json +0 -341
  294. package/src/med_editor//346/231/256/351/200/232doc/347/261/273/346/226/207/346/241/243.json +0 -2201
  295. package/src/med_editor//346/243/200/351/252/214/347/224/263/350/257/267/345/215/225.json +0 -1069
  296. 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
  297. 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
  298. 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
  299. 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
  300. 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
  301. package/src/med_editor//351/225/277/346/234/237/345/214/273/345/230/261/345/215/225.json +0 -1070
  302. package/tsconfig.json +0 -25
  303. package/webpack.config.js +0 -46
@@ -1,678 +0,0 @@
1
- import { ElementUtil } from "@/med_editor/framework/element-util";
2
- import { ParagraphElement } from "../paragraph/p-impl";
3
- import { TableCellElement } from "./table-cell-impl";
4
- import { TableElement } from "./table-impl";
5
- import { TableRowElement } from "./table-row-impl";
6
- export class TableUtil {
7
- static canDeleteTable(ss) {
8
- const { startControl } = ss;
9
- if (!startControl) {
10
- return false;
11
- }
12
- const tb = ElementUtil.getParentByType(startControl, TableElement);
13
- return tb ? true : false;
14
- }
15
- /**
16
- * 校验当前选区是否可以执行合并单元格操作
17
- * @param ss
18
- * @returns
19
- */
20
- static canMergeCells(ss) {
21
- const { ancestorCommonControl, startControl, endControl, collapsed, selectedRange } = ss;
22
- if (collapsed) {
23
- return false;
24
- }
25
- if (ancestorCommonControl instanceof TableElement || ancestorCommonControl instanceof TableRowElement) {
26
- const tbElement = ancestorCommonControl instanceof TableElement ? ancestorCommonControl : ancestorCommonControl.parent;
27
- const startCell = ElementUtil.getParentByType(startControl, TableCellElement);
28
- const endCell = ElementUtil.getParentByType(endControl, TableCellElement);
29
- if (startCell?.parent?.parent === tbElement && endCell?.parent?.parent === tbElement) {
30
- const tbRegion = this.getTableRectSelectedRegion(tbElement, startCell, endCell);
31
- if (selectedRange && selectedRange.target === tbElement) {
32
- const selectedCells = [];
33
- selectedRange.selectedChildren.every(item => item.selectedChildren.every(cell => selectedCells.push(cell.target)));
34
- for (let i = tbRegion.startRow; i <= tbRegion.endRow; i++) {
35
- const currRow = tbElement.getChild(i);
36
- for (let j = tbRegion.startCol; j <= tbRegion.endCol; j++) {
37
- const currCell = currRow.getChild(j);
38
- if (currCell.isNotBeMergedCell() && selectedCells.indexOf(currCell) < 0) {
39
- return false;
40
- }
41
- }
42
- }
43
- return true;
44
- }
45
- }
46
- }
47
- return false;
48
- }
49
- /**
50
- * 获取横向合并当前单元格合并结束索引位置
51
- * @param tb
52
- * @param rowIndex
53
- * @param colIndex
54
- */
55
- static getHMergeEndIndex(tb, rowIndex, colIndex) {
56
- const currRow = tb.getChild(rowIndex);
57
- let index = colIndex;
58
- for (let i = colIndex + 1; i < tb.getColsCount(); i++) {
59
- const cell = currRow.getChild(i);
60
- if (cell.props.hMerge === 'continue') {
61
- index = i;
62
- }
63
- else {
64
- break;
65
- }
66
- }
67
- return index;
68
- }
69
- /**
70
- * 获取横向合并当前单元格合并开始索引位置
71
- * @param tb
72
- * @param rowIndex
73
- * @param colIndex
74
- */
75
- static getHMergeStartIndex(tb, rowIndex, colIndex) {
76
- const row = tb.getChild(rowIndex);
77
- for (let i = colIndex - 1; i >= 0; i--) {
78
- const cell = row.getChild(i);
79
- if (cell.props.hMerge === 'restart') {
80
- return i;
81
- }
82
- }
83
- throw new Error('未找到主合并单元格');
84
- }
85
- /**
86
- * 获取纵向合并当前单元格合并结束索引位置
87
- * @param tb
88
- * @param rowIndex
89
- * @param colIndex i
90
- */
91
- static getVMergeEndIndex(tb, rowIndex, colIndex) {
92
- let index = rowIndex;
93
- for (let i = rowIndex + 1; i < tb.length; i++) {
94
- const currRow = tb.getChild(i);
95
- const cell = currRow.getChild(colIndex);
96
- if (cell.props.vMerge === 'continue') {
97
- index = i;
98
- }
99
- else {
100
- break;
101
- }
102
- }
103
- return index;
104
- }
105
- /**
106
- * 获取纵向合并当前单元格合并开始索引位置
107
- * @param tb
108
- * @param rowIndex
109
- * @param colIndex i
110
- */
111
- static getVMergeStartIndex(tb, rowIndex, colIndex) {
112
- for (let i = rowIndex - 1; i >= 0; i--) {
113
- const currRow = tb.getChild(i);
114
- const cell = currRow.getChild(colIndex);
115
- if (cell.props.vMerge === 'restart') {
116
- return i;
117
- }
118
- }
119
- throw new Error('未找到主合并单元格');
120
- }
121
- /**
122
- * 合并单元格
123
- * @param ss
124
- * @returns
125
- */
126
- static mergeCells(ss) {
127
- const { ancestorCommonControl, startControl, endControl, collapsed } = ss;
128
- if (collapsed) {
129
- return;
130
- }
131
- if (ancestorCommonControl instanceof TableElement || ancestorCommonControl instanceof TableRowElement) {
132
- const tbElement = ancestorCommonControl instanceof TableElement ? ancestorCommonControl : ancestorCommonControl.parent;
133
- const startCell = ElementUtil.getParentByType(startControl, TableCellElement);
134
- const endCell = ElementUtil.getParentByType(endControl, TableCellElement);
135
- if (startCell?.parent?.parent === tbElement && endCell?.parent?.parent === tbElement) {
136
- //this.combineCellContent(tbElement, startCell, endCell);
137
- this.combineCells(tbElement, startCell, endCell);
138
- }
139
- this.checkRowBeMerged(ss);
140
- ss.clear();
141
- }
142
- }
143
- /**
144
- * 在合并单元格后需要校验
145
- * 1.如果某个行的所有单元格都不是normal,则需要删除当前行
146
- * 2.如果某个列的所有的单元格都不是normal,则需要删除当前列
147
- */
148
- static checkRowBeMerged(ss) {
149
- const tb = ElementUtil.getParentByType(ss.startControl, TableElement);
150
- if (!tb) {
151
- return;
152
- }
153
- const colsCount = tb.getColsCount();
154
- const fullMergeRows = [];
155
- for (let i = 0; i < tb.length; i++) {
156
- const row = tb.getChild(i);
157
- let count = 0;
158
- for (let j = 0; j < colsCount; j++) {
159
- const cell = row.getChild(j);
160
- if (!cell.isNotBeMergedCell()) {
161
- count++;
162
- }
163
- }
164
- //当前行所有的单元格都被合并,需要删除
165
- if (count === colsCount) {
166
- fullMergeRows.push(row);
167
- }
168
- }
169
- fullMergeRows.forEach(row => this.removeRow(row));
170
- }
171
- /**
172
- * 移除行
173
- * @param row
174
- */
175
- static removeRow(row) {
176
- const rowIndex = row.getIndex();
177
- const tb = row.parent;
178
- for (let i = 0; i < row.length; i++) {
179
- const cell = row.getChild(i);
180
- if (cell.props.vMerge === 'restart') {
181
- const vMergeEndIndex = this.getVMergeEndIndex(tb, rowIndex, i);
182
- if (vMergeEndIndex > rowIndex) {
183
- const nextRow = tb.getChild(rowIndex + 1);
184
- nextRow.getChild(i).props.vMerge = vMergeEndIndex - rowIndex > 2 ? 'restart' : null;
185
- }
186
- }
187
- else if (cell.props.vMerge === 'continue') {
188
- // const vMergeEndIndex = this.getVMergeEndIndex(tb, rowIndex, i);
189
- // if (vMergeEndIndex > rowIndex) {
190
- // const nextRow = tb.getChild<TableRowElement>(rowIndex + 1);
191
- // nextRow.getChild<TableCellElement>(i).cellProps.vMerge = 'continue';
192
- // }
193
- const vMergeStartIndex = this.getVMergeStartIndex(tb, rowIndex, i);
194
- const vMergeEndIndex = this.getVMergeEndIndex(tb, rowIndex, i);
195
- //当前单元格处于合并行的最后一行,并且合并的行数为2行
196
- if (vMergeEndIndex === rowIndex && vMergeEndIndex - vMergeStartIndex === 1) {
197
- const aboveCell = tb.getChild(vMergeStartIndex).getChild(i);
198
- aboveCell.props.vMerge = null;
199
- }
200
- }
201
- }
202
- tb.removeChild(row);
203
- }
204
- /**
205
- * 移除列
206
- * @param tb
207
- * @param colIndex
208
- */
209
- static removeCol(tb, colIndex) {
210
- for (let i = 0; i < tb.length; i++) {
211
- const row = tb.getChild(i);
212
- const cell = row.getChild(colIndex);
213
- if (cell.props.hMerge === 'restart') {
214
- const hMergeEndIndex = this.getHMergeEndIndex(tb, i, colIndex);
215
- if (hMergeEndIndex > colIndex) {
216
- const nextCell = row.getChild(colIndex + 1);
217
- nextCell.props.hMerge = hMergeEndIndex - colIndex > 2 ? 'restart' : null;
218
- }
219
- }
220
- else if (cell.props.hMerge === 'continue') {
221
- const hMergeStartIndex = this.getHMergeStartIndex(tb, i, colIndex);
222
- const hMergeEndIndex = this.getHMergeEndIndex(tb, i, colIndex);
223
- //当前单元格处于合并行的最后一行,并且合并的行数为2行
224
- if (hMergeEndIndex === colIndex && hMergeEndIndex - hMergeStartIndex === 1) {
225
- const masterVMergeCell = tb.getChild(hMergeStartIndex).getChild(i);
226
- masterVMergeCell.props.hMerge = null;
227
- }
228
- }
229
- row.removeChild(cell);
230
- }
231
- tb.removeCol(colIndex);
232
- }
233
- /**
234
- * 移除光标所在的当前行
235
- * @param ss
236
- */
237
- static removeCurrRow(ss) {
238
- const startCell = ElementUtil.getParentByType(ss.startControl, TableCellElement);
239
- if (!startCell?.parent) {
240
- throw new Error('parent is null');
241
- }
242
- const currRow = startCell.parent;
243
- const tb = currRow.parent;
244
- this.removeRow(currRow);
245
- tb.pubOnChange('self');
246
- tb.refreshView();
247
- }
248
- /**
249
- * 移除光标所在的当前列
250
- * @param ss
251
- */
252
- static removeCurrCol(ss) {
253
- const startCell = ElementUtil.getParentByType(ss.startControl, TableCellElement);
254
- if (!startCell?.parent) {
255
- throw new Error('parent is null');
256
- }
257
- if (ss.collapsed) {
258
- const currRow = startCell.parent;
259
- const tb = currRow.parent;
260
- this.removeCol(tb, startCell.getIndex());
261
- ss.clear();
262
- return;
263
- }
264
- const { ancestorCommonControl, startControl, endControl } = ss;
265
- if (ancestorCommonControl instanceof TableElement || ancestorCommonControl instanceof TableRowElement) {
266
- const tbElement = ancestorCommonControl instanceof TableElement ? ancestorCommonControl : ancestorCommonControl.parent;
267
- const startCell = ElementUtil.getParentByType(startControl, TableCellElement);
268
- const endCell = ElementUtil.getParentByType(endControl, TableCellElement);
269
- if (startCell?.parent?.parent === tbElement && endCell?.parent?.parent === tbElement) {
270
- const startColIndex = startCell.getIndex();
271
- let endColIndex = endCell.getIndex();
272
- while (startColIndex <= endColIndex) {
273
- this.removeCol(tbElement, endColIndex);
274
- endColIndex--;
275
- }
276
- }
277
- tbElement.pubOnChange('self');
278
- }
279
- ss.clear();
280
- }
281
- /**
282
- * 合并单元格
283
- */
284
- static combineCells(tbElement, startCell, endCell) {
285
- const tbRegion = this.getTableRectSelectedRegion(tbElement, startCell, endCell);
286
- const cellContents = [];
287
- for (let i = tbRegion.startRow; i <= tbRegion.endRow; i++) {
288
- const currRow = tbElement.getChild(i);
289
- for (let j = tbRegion.startCol; j <= tbRegion.endCol; j++) {
290
- const currCell = currRow.getChild(j);
291
- currCell.props.vMerge = null;
292
- currCell.props.hMerge = 'continue';
293
- if (j === tbRegion.startCol) {
294
- currCell.props.vMerge = i === tbRegion.startRow ? 'restart' : 'continue';
295
- currCell.props.hMerge = 'restart';
296
- }
297
- if (currCell !== startCell) {
298
- cellContents.push(...ElementUtil.getChildrenElements(currCell));
299
- currCell.clearItems();
300
- }
301
- }
302
- }
303
- //如果合并的单元格都是空段落,则不合并内容
304
- if (!cellContents.every((item) => (item instanceof ParagraphElement && item.length === 1))) {
305
- for (let i = 0; i < cellContents.length; i++) {
306
- startCell.addChild(cellContents[i]);
307
- }
308
- }
309
- }
310
- static canSplitCell(ss) {
311
- const { ancestorCommonControl, startControl, endControl, collapsed } = ss;
312
- if (ancestorCommonControl instanceof TableElement || ancestorCommonControl instanceof TableRowElement) {
313
- const tbElement = ancestorCommonControl instanceof TableElement ? ancestorCommonControl : ancestorCommonControl.parent;
314
- const startCell = ElementUtil.getParentByType(startControl, TableCellElement);
315
- const endCell = ElementUtil.getParentByType(endControl, TableCellElement);
316
- if (startCell?.parent?.parent === tbElement && endCell?.parent?.parent === tbElement) {
317
- if (startCell === endCell) {
318
- return startCell.props.hMerge === 'restart' || startCell.props.vMerge === 'restart';
319
- }
320
- }
321
- }
322
- else {
323
- const startCell = ElementUtil.getParentByType(startControl, TableCellElement);
324
- if (!startCell) {
325
- throw new Error('startCell is null');
326
- }
327
- const { hMerge, vMerge } = startCell?.props;
328
- return hMerge === 'restart' || vMerge === 'restart' || !hMerge || !vMerge;
329
- }
330
- return false;
331
- }
332
- /**
333
- * 将合并的单元格合并还原
334
- * @param ss
335
- */
336
- static restoreCell(ss) {
337
- const { ancestorCommonControl, startControl, endControl, collapsed } = ss;
338
- const startCell = ElementUtil.getParentByType(startControl, TableCellElement);
339
- if (startCell) {
340
- this.restoreCellMerge(startCell);
341
- ss.resetRange(startCell, 0);
342
- startCell.refreshView();
343
- }
344
- }
345
- static restoreCellMerge(cell) {
346
- const { vMerge, hMerge } = cell.props;
347
- const row = cell.parent;
348
- const tb = row.parent;
349
- const rowIndex = row.getIndex();
350
- const colIndex = cell.getIndex();
351
- if (vMerge === 'restart') {
352
- for (let i = rowIndex + 1; i < tb.length; i++) {
353
- const row = tb.getChild(i);
354
- const cell = row.getChild(colIndex);
355
- if (cell.props.vMerge === "continue") {
356
- cell.props.vMerge = null;
357
- if (cell.props.hMerge === "restart") {
358
- this.restoreCellMerge(cell);
359
- }
360
- }
361
- }
362
- }
363
- if (hMerge === 'restart') {
364
- for (let i = colIndex + 1; i < row.length; i++) {
365
- const cell = row.getChild(i);
366
- if (cell.props.hMerge === "continue") {
367
- cell.props.hMerge = null;
368
- if (cell.props.vMerge === "restart") {
369
- this.restoreCellMerge(cell);
370
- }
371
- }
372
- }
373
- }
374
- cell.props.hMerge = null;
375
- cell.props.vMerge = null;
376
- }
377
- static getVMergeRows(tb, masterRowIndex, masterColIndex) {
378
- const items = [];
379
- for (let i = masterRowIndex + 1; i < tb.length; i++) {
380
- const row = tb.getChild(i);
381
- const cell = row.getChild(masterColIndex);
382
- if (cell.props.vMerge === 'continue') {
383
- items.push(row);
384
- }
385
- else {
386
- return items;
387
- }
388
- }
389
- return items;
390
- }
391
- static insertCol(ss, insertColIndex) {
392
- const startCell = ElementUtil.getParentByType(ss.startControl, TableCellElement);
393
- if (!startCell?.parent) {
394
- throw new Error('parent is null');
395
- }
396
- const startRow = startCell.parent;
397
- const tb = startRow.parent;
398
- const currColIndex = startCell.getIndex();
399
- const colsCount = tb.getColsCount();
400
- insertColIndex = insertColIndex < 0 ? 0 : insertColIndex;
401
- insertColIndex = insertColIndex > colsCount ? colsCount : insertColIndex;
402
- //插入列需要将之前列分割
403
- const insertColWidth = insertColIndex === colsCount ? tb.getCellWidth(colsCount - 1) : tb.getCellWidth(insertColIndex);
404
- const newColWidth = Math.floor(insertColWidth / 2);
405
- if (newColWidth < 20) {
406
- console.warn('插入列的最小宽度不能小于20,当前为:' + newColWidth);
407
- return;
408
- }
409
- for (let i = 0; i < tb.length; i++) {
410
- const row = tb.getChild(i);
411
- const newCell = new TableCellElement();
412
- if (insertColIndex === 0 || insertColIndex === colsCount) {
413
- row.addChild(newCell, insertColIndex);
414
- continue;
415
- }
416
- const focusCell = row.getChild(insertColIndex);
417
- if (focusCell) {
418
- if (focusCell.props.hMerge === 'continue') {
419
- //获取合并行的最后的行索引
420
- const hMergeEndColIndex = this.getHMergeEndIndex(tb, i, currColIndex);
421
- if (hMergeEndColIndex > insertColIndex || (hMergeEndColIndex === insertColIndex && currColIndex < insertColIndex)) {
422
- newCell.props.hMerge = 'continue';
423
- }
424
- }
425
- else if (focusCell.props.hMerge === 'restart' && currColIndex > insertColIndex) {
426
- newCell.props.hMerge = 'continue';
427
- }
428
- }
429
- row.addChild(newCell, insertColIndex);
430
- }
431
- tb.setCellWidth(insertColIndex === colsCount ? insertColIndex - 1 : insertColIndex, insertColWidth - newColWidth);
432
- tb.insertCol(insertColIndex, newColWidth);
433
- tb.pubOnChange('self');
434
- tb.refreshView();
435
- }
436
- static insertRow(ss, insertRowIndex) {
437
- const startCell = ElementUtil.getParentByType(ss.startControl, TableCellElement);
438
- if (!startCell?.parent) {
439
- throw new Error('parent is null');
440
- }
441
- const startRow = startCell.parent;
442
- const tb = startRow.parent;
443
- const currRowIndex = startRow.getIndex();
444
- insertRowIndex = insertRowIndex < 0 ? 0 : insertRowIndex;
445
- insertRowIndex = insertRowIndex > tb.length ? tb.length : insertRowIndex;
446
- const newRow = TableRowElement.createRow(tb.getColsCount());
447
- //新行插在第一行或者最后一行
448
- if (insertRowIndex === 0 || insertRowIndex === tb.length) {
449
- tb.addChild(newRow, insertRowIndex);
450
- tb.refreshView();
451
- return newRow;
452
- }
453
- const destRow = tb.getChild(insertRowIndex);
454
- for (let i = 0; i < destRow.length; i++) {
455
- const destCell = destRow.getChild(i);
456
- const newCell = newRow.getChild(i);
457
- //如果当前单元格是普通单元格或者合并列的最后一个单元格,则不做处理
458
- if (destCell.props.vMerge === 'continue') {
459
- //获取合并列的最后的行索引
460
- const vMergeEndRowIndex = this.getVMergeEndIndex(tb, insertRowIndex, i);
461
- if (vMergeEndRowIndex > insertRowIndex || (vMergeEndRowIndex === insertRowIndex && currRowIndex < insertRowIndex)) {
462
- newCell.props.vMerge = 'continue';
463
- //newCell.cellProps.hMerge = destCell.cellProps.hMerge;
464
- }
465
- }
466
- else if (destCell.props.vMerge === 'restart' && currRowIndex > insertRowIndex) {
467
- //在上方新增行,目标行单元格属于合并的起点
468
- newCell.props.vMerge = 'continue';
469
- //newCell.cellProps.hMerge = destCell.cellProps.hMerge;
470
- }
471
- }
472
- tb.addChild(newRow, insertRowIndex);
473
- tb.refreshView();
474
- return newRow;
475
- }
476
- /**
477
- * 在下方插入行
478
- */
479
- static insertRowBelow(ss) {
480
- const startCell = ElementUtil.getParentByType(ss.startControl, TableCellElement);
481
- if (!startCell?.parent) {
482
- throw new Error('parent is null');
483
- }
484
- const startRow = startCell.parent;
485
- const currRowIndex = startRow.getIndex();
486
- this.insertRow(ss, currRowIndex + 1);
487
- }
488
- /**
489
- * 在上方插入行
490
- */
491
- static insertRowAbove(ss) {
492
- const startCell = ElementUtil.getParentByType(ss.startControl, TableCellElement);
493
- if (!startCell?.parent) {
494
- throw new Error('parent is null');
495
- }
496
- const startRow = startCell.parent;
497
- const currRowIndex = startRow.getIndex();
498
- this.insertRow(ss, currRowIndex);
499
- }
500
- /**
501
- * 在右侧插入列
502
- */
503
- static insertColToRight(ss) {
504
- const startCell = ElementUtil.getParentByType(ss.startControl, TableCellElement);
505
- if (!startCell?.parent) {
506
- throw new Error('parent is null');
507
- }
508
- const currColIndex = startCell.getIndex();
509
- this.insertCol(ss, currColIndex + 1);
510
- }
511
- /**
512
- * 在左侧插入列
513
- */
514
- static insertColToLeft(ss) {
515
- const startCell = ElementUtil.getParentByType(ss.startControl, TableCellElement);
516
- if (!startCell?.parent) {
517
- throw new Error('parent is null');
518
- }
519
- const currColIndex = startCell.getIndex();
520
- this.insertCol(ss, currColIndex);
521
- }
522
- /**
523
- * 跳转到下一个单元格中
524
- * @param ss
525
- */
526
- static moveNextCell(ss) {
527
- const startCell = ElementUtil.getParentByType(ss.startControl, TableCellElement);
528
- if (!startCell?.parent) {
529
- throw new Error('parent is null');
530
- }
531
- const rowIndex = startCell.parent.getIndex();
532
- const nextCell = this.getNextCell(ss);
533
- if (nextCell) {
534
- ss.resetRange(nextCell, 0);
535
- nextCell.refreshView();
536
- return;
537
- }
538
- //新增行,并定位
539
- const newRow = this.insertRow(ss, rowIndex + 1);
540
- ss.resetRange(newRow, 0);
541
- newRow.refreshView();
542
- }
543
- /**
544
- * 获取下一个可定位的单元格
545
- * @param ss
546
- * @returns
547
- */
548
- static getNextCell(ss) {
549
- const startCell = ElementUtil.getParentByType(ss.startControl, TableCellElement);
550
- if (!startCell?.parent) {
551
- throw new Error('parent is null');
552
- }
553
- const rowIndex = startCell.parent.getIndex();
554
- const colIndex = startCell.getIndex();
555
- const tb = startCell.parent.parent;
556
- for (let i = rowIndex; i < tb.length; i++) {
557
- let j = i === rowIndex ? colIndex + 1 : 0;
558
- const currRow = tb.getChild(i);
559
- for (; j < tb.getColsCount(); j++) {
560
- const currCell = currRow.getChild(j);
561
- if (currCell.isNotBeMergedCell()) {
562
- return currCell;
563
- }
564
- }
565
- }
566
- //throw new Error('getNextCell is null')
567
- }
568
- /**
569
- * 当前光标是否在最后一个单元格中
570
- */
571
- static isLastVisiableCell(ss) {
572
- return !this.getNextCell(ss);
573
- }
574
- /**
575
- * 移除当前table
576
- */
577
- static removeTable(ss) {
578
- const tb = ElementUtil.getParentByType(ss.startControl, TableElement);
579
- if (!tb) {
580
- console.warn('当前位置不存在表格');
581
- return;
582
- }
583
- tb.parent.refreshView();
584
- tb.remove();
585
- }
586
- /**
587
- * 设置表格单元格对角线
588
- * @param ss
589
- * @param diagonal
590
- * @returns
591
- */
592
- static setTableCellDiagonal(ss, diagonal) {
593
- const tc = ElementUtil.getParentByType(ss.startControl, TableCellElement);
594
- if (!tc) {
595
- console.warn('当前位置不存在表格');
596
- return;
597
- }
598
- if (!tc.props.diagonal || tc.props.diagonal !== diagonal) {
599
- tc.props.diagonal = diagonal;
600
- }
601
- else if (tc.props.diagonal === diagonal) {
602
- tc.props.diagonal = null;
603
- }
604
- tc.refreshView();
605
- }
606
- /**
607
- * 将当前表格截断成两个相邻的表格
608
- * @param tb
609
- * @param rowIndex
610
- */
611
- static cutTable(tb, rowIndex) {
612
- if (rowIndex === 0 || rowIndex === tb.length - 1) {
613
- return;
614
- }
615
- const newTb = tb.clone(false);
616
- const len = tb.length - 1;
617
- while (len > rowIndex) {
618
- const child = tb.getChild(len);
619
- newTb.addChild(child.clone(true), 0);
620
- tb.removeChild(child);
621
- }
622
- if (newTb.length > 0) {
623
- tb.parent.addChild(newTb, tb.getIndex() + 1);
624
- }
625
- }
626
- /**
627
- * 获取表格选区区域最大的矩形区域
628
- * @param tb
629
- * @param startCell
630
- * @param endCell
631
- * @returns
632
- */
633
- static getTableRectSelectedRegion(tb, startCell, endCell) {
634
- let startRow = startCell.parent.getIndex();
635
- let startCol = startCell.getIndex();
636
- let endRow = endCell.parent.getIndex();
637
- let endCol = endCell.getIndex();
638
- if (startRow > endRow) {
639
- [endRow, startRow] = [startRow, endRow];
640
- }
641
- if (startCol > endCol) {
642
- [endCol, startCol] = [startCol, endCol];
643
- }
644
- for (let i = startRow; i <= endRow; i++) {
645
- const row = tb.getChild(i);
646
- for (let j = startCol; j <= endCol; j++) {
647
- const cell = row.getChild(j);
648
- const { hMerge, vMerge } = cell.props;
649
- if (hMerge === 'continue') {
650
- const startColIndex = TableUtil.getHMergeStartIndex(tb, i, j);
651
- const endColIndex = TableUtil.getHMergeEndIndex(tb, i, j);
652
- startCol = Math.min(startCol, startColIndex);
653
- endCol = Math.max(endCol, endColIndex);
654
- }
655
- if (vMerge === 'continue') {
656
- const startRowIndex = TableUtil.getVMergeStartIndex(tb, i, j);
657
- const endRowIndex = TableUtil.getVMergeEndIndex(tb, i, j);
658
- startRow = Math.min(startRow, startRowIndex);
659
- endRow = Math.max(endRow, endRowIndex);
660
- }
661
- if (vMerge === 'restart') {
662
- const rowIndex = TableUtil.getVMergeEndIndex(tb, i, j);
663
- if (rowIndex > endRow) {
664
- endRow = rowIndex;
665
- }
666
- }
667
- if (hMerge === 'restart') {
668
- const colIndex = TableUtil.getHMergeEndIndex(tb, i, j);
669
- if (colIndex > endCol) {
670
- endCol = colIndex;
671
- }
672
- }
673
- }
674
- }
675
- return { startRow, endRow, startCol, endCol };
676
- }
677
- }
678
- //# sourceMappingURL=table-util.js.map