@fileverse-dev/fortune-core 1.0.4 → 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 (346) hide show
  1. package/{dist/packages/core/src → es}/api/cell.d.ts +10 -10
  2. package/es/api/cell.js +204 -0
  3. package/{dist/packages/core/src → es}/api/common.d.ts +66 -66
  4. package/es/api/common.js +79 -0
  5. package/{dist/packages/core/src → es}/api/errors.d.ts +2 -2
  6. package/es/api/errors.js +2 -0
  7. package/{dist/packages/core/src → es}/api/index.d.ts +9 -9
  8. package/es/api/index.js +8 -0
  9. package/{dist/packages/core/src → es}/api/merge.d.ts +5 -5
  10. package/es/api/merge.js +15 -0
  11. package/{dist/packages/core/src → es}/api/range.d.ts +22 -22
  12. package/es/api/range.js +123 -0
  13. package/{dist/packages/core/src → es}/api/rowcol.d.ts +14 -14
  14. package/es/api/rowcol.js +207 -0
  15. package/{dist/packages/core/src → es}/api/sheet.d.ts +10 -10
  16. package/es/api/sheet.js +128 -0
  17. package/{dist/packages/core/src → es}/api/workbook.d.ts +15 -15
  18. package/es/api/workbook.js +85 -0
  19. package/{dist/packages/core/src → es}/canvas.d.ts +46 -46
  20. package/es/canvas.js +1350 -0
  21. package/{dist/packages/core/src → es}/context.d.ts +197 -197
  22. package/es/context.js +380 -0
  23. package/{dist/packages/core/src → es}/events/copy.d.ts +2 -2
  24. package/es/events/copy.js +78 -0
  25. package/{dist/packages/core/src → es}/events/index.d.ts +4 -4
  26. package/es/events/index.js +4 -0
  27. package/{dist/packages/core/src → es}/events/keyboard.d.ts +6 -6
  28. package/es/events/keyboard.js +332 -0
  29. package/{dist/packages/core/src → es}/events/mouse.d.ts +22 -22
  30. package/es/events/mouse.js +1725 -0
  31. package/{dist/packages/core/src → es}/events/paste.d.ts +3 -3
  32. package/es/events/paste.js +1358 -0
  33. package/{dist/packages/core/src → es}/index.d.ts +10 -10
  34. package/es/index.js +10 -0
  35. package/{dist/packages/core/src → es}/locale/en.d.ts +992 -992
  36. package/es/locale/en.js +10564 -0
  37. package/{dist/packages/core/src → es}/locale/es.d.ts +1134 -1134
  38. package/es/locale/es.js +10010 -0
  39. package/{dist/packages/core/src → es}/locale/hi.d.ts +1030 -1030
  40. package/es/locale/hi.js +10550 -0
  41. package/{dist/packages/core/src → es}/locale/index.d.ts +1049 -1049
  42. package/es/locale/index.js +23 -0
  43. package/{dist/packages/core/src → es}/locale/zh.d.ts +1048 -1048
  44. package/es/locale/zh.js +10568 -0
  45. package/{dist/packages/core/src → es}/locale/zh_tw.d.ts +1187 -1187
  46. package/es/locale/zh_tw.js +10072 -0
  47. package/{dist/packages/core/src → es}/modules/ConditionFormat.d.ts +17 -17
  48. package/es/modules/ConditionFormat.js +1258 -0
  49. package/{dist/packages/core/src → es}/modules/border.d.ts +3 -3
  50. package/es/modules/border.js +1240 -0
  51. package/{dist/packages/core/src → es}/modules/cell.d.ts +32 -32
  52. package/es/modules/cell.js +1055 -0
  53. package/{dist/packages/core/src → es}/modules/clipboard.d.ts +3 -3
  54. package/es/modules/clipboard.js +36 -0
  55. package/{dist/packages/core/src → es}/modules/color.d.ts +1 -1
  56. package/es/modules/color.js +1 -0
  57. package/{dist/packages/core/src → es}/modules/comment.d.ts +97 -97
  58. package/es/modules/comment.js +597 -0
  59. package/{dist/packages/core/src → es}/modules/conditionalFormat.d.ts +2 -2
  60. package/es/modules/conditionalFormat.js +441 -0
  61. package/{dist/packages/core/src → es}/modules/cursor.d.ts +3 -3
  62. package/es/modules/cursor.js +62 -0
  63. package/{dist/packages/core/src → es}/modules/dataVerification.d.ts +11 -11
  64. package/es/modules/dataVerification.js +700 -0
  65. package/{dist/packages/core/src → es}/modules/dropCell.d.ts +10 -10
  66. package/es/modules/dropCell.js +2266 -0
  67. package/{dist/packages/core/src → es}/modules/filter.d.ts +45 -45
  68. package/es/modules/filter.js +434 -0
  69. package/{dist/packages/core/src → es}/modules/format.d.ts +6 -6
  70. package/es/modules/format.js +323 -0
  71. package/{dist/packages/core/src → es}/modules/formula.d.ts +54 -54
  72. package/es/modules/formula.js +2301 -0
  73. package/{dist/packages/core/src → es}/modules/freeze.d.ts +5 -5
  74. package/es/modules/freeze.js +148 -0
  75. package/{dist/packages/core/src → es}/modules/hyperlink.d.ts +21 -21
  76. package/es/modules/hyperlink.js +216 -0
  77. package/{dist/packages/core/src → es}/modules/iframe.d.ts +12 -12
  78. package/es/modules/iframe.js +220 -0
  79. package/{dist/packages/core/src → es}/modules/image.d.ts +31 -31
  80. package/es/modules/image.js +253 -0
  81. package/{dist/packages/core/src → es}/modules/index.d.ts +36 -36
  82. package/es/modules/index.js +36 -0
  83. package/{dist/packages/core/src → es}/modules/inline-string.d.ts +36 -36
  84. package/es/modules/inline-string.js +437 -0
  85. package/{dist/packages/core/src → es}/modules/location.d.ts +6 -6
  86. package/es/modules/location.js +46 -0
  87. package/{dist/packages/core/src → es}/modules/locationCondition.d.ts +21 -21
  88. package/es/modules/locationCondition.js +218 -0
  89. package/{dist/packages/core/src → es}/modules/merge.d.ts +3 -3
  90. package/es/modules/merge.js +216 -0
  91. package/{dist/packages/core/src → es}/modules/mobile.d.ts +5 -5
  92. package/es/modules/mobile.js +33 -0
  93. package/{dist/packages/core/src → es}/modules/moveCells.d.ts +5 -5
  94. package/es/modules/moveCells.js +348 -0
  95. package/{dist/packages/core/src → es}/modules/protection.d.ts +5 -5
  96. package/es/modules/protection.js +96 -0
  97. package/{dist/packages/core/src → es}/modules/refresh.d.ts +3 -3
  98. package/es/modules/refresh.js +34 -0
  99. package/{dist/packages/core/src → es}/modules/rowcol.d.ts +19 -19
  100. package/es/modules/rowcol.js +1922 -0
  101. package/{dist/packages/core/src → es}/modules/screenshot.d.ts +2 -2
  102. package/es/modules/screenshot.js +90 -0
  103. package/{dist/packages/core/src → es}/modules/searchReplace.d.ts +36 -36
  104. package/es/modules/searchReplace.js +388 -0
  105. package/{dist/packages/core/src → es}/modules/selection.d.ts +46 -46
  106. package/es/modules/selection.js +1674 -0
  107. package/{dist/packages/core/src → es}/modules/sheet.d.ts +10 -10
  108. package/es/modules/sheet.js +237 -0
  109. package/{dist/packages/core/src → es}/modules/sort.d.ts +7 -7
  110. package/es/modules/sort.js +150 -0
  111. package/{dist/packages/core/src → es}/modules/splitColumn.d.ts +5 -5
  112. package/es/modules/splitColumn.js +126 -0
  113. package/es/modules/ssf.js +1533 -0
  114. package/{dist/packages/core/src → es}/modules/text.d.ts +10 -10
  115. package/es/modules/text.js +1207 -0
  116. package/{dist/packages/core/src → es}/modules/toolbar.d.ts +32 -32
  117. package/es/modules/toolbar.js +970 -0
  118. package/{dist/packages/core/src → es}/modules/validation.d.ts +19 -19
  119. package/es/modules/validation.js +190 -0
  120. package/{dist/packages/core/src → es}/modules/zoom.d.ts +3 -3
  121. package/es/modules/zoom.js +29 -0
  122. package/{dist/packages/core/src → es}/settings.d.ts +100 -100
  123. package/es/settings.js +36 -0
  124. package/{dist/packages/core/src → es}/types.d.ts +371 -371
  125. package/es/types.js +1 -0
  126. package/{dist/packages/core/src → es}/utils/freeze.d.ts +7 -7
  127. package/es/utils/freeze.js +86 -0
  128. package/{dist/packages/core/src → es}/utils/index.d.ts +18 -18
  129. package/es/utils/index.js +173 -0
  130. package/{dist/packages/core/src → es}/utils/patch.d.ts +37 -37
  131. package/es/utils/patch.js +381 -0
  132. package/lib/api/cell.d.ts +10 -0
  133. package/lib/api/cell.js +215 -0
  134. package/lib/api/common.d.ts +66 -0
  135. package/lib/api/common.js +88 -0
  136. package/lib/api/errors.d.ts +2 -0
  137. package/lib/api/errors.js +8 -0
  138. package/lib/api/index.d.ts +9 -0
  139. package/lib/api/index.js +101 -0
  140. package/lib/api/merge.d.ts +5 -0
  141. package/lib/api/merge.js +22 -0
  142. package/lib/api/range.d.ts +22 -0
  143. package/lib/api/range.js +138 -0
  144. package/lib/api/rowcol.d.ts +14 -0
  145. package/lib/api/rowcol.js +222 -0
  146. package/lib/api/sheet.d.ts +10 -0
  147. package/lib/api/sheet.js +145 -0
  148. package/lib/api/workbook.d.ts +15 -0
  149. package/lib/api/workbook.js +98 -0
  150. package/lib/canvas.d.ts +46 -0
  151. package/lib/canvas.js +1356 -0
  152. package/lib/context.d.ts +197 -0
  153. package/lib/context.js +392 -0
  154. package/lib/events/copy.d.ts +2 -0
  155. package/lib/events/copy.js +85 -0
  156. package/lib/events/index.d.ts +4 -0
  157. package/lib/events/index.js +49 -0
  158. package/lib/events/keyboard.d.ts +6 -0
  159. package/lib/events/keyboard.js +342 -0
  160. package/lib/events/mouse.d.ts +22 -0
  161. package/lib/events/mouse.js +1744 -0
  162. package/lib/events/paste.d.ts +3 -0
  163. package/lib/events/paste.js +1366 -0
  164. package/lib/index.d.ts +10 -0
  165. package/lib/index.js +109 -0
  166. package/lib/locale/en.d.ts +992 -0
  167. package/lib/locale/en.js +10570 -0
  168. package/lib/locale/es.d.ts +1134 -0
  169. package/lib/locale/es.js +10016 -0
  170. package/lib/locale/hi.d.ts +1030 -0
  171. package/lib/locale/hi.js +10556 -0
  172. package/lib/locale/index.d.ts +1049 -0
  173. package/lib/locale/index.js +29 -0
  174. package/lib/locale/zh.d.ts +1048 -0
  175. package/lib/locale/zh.js +10574 -0
  176. package/lib/locale/zh_tw.d.ts +1187 -0
  177. package/lib/locale/zh_tw.js +10078 -0
  178. package/lib/modules/ConditionFormat.d.ts +17 -0
  179. package/lib/modules/ConditionFormat.js +1273 -0
  180. package/lib/modules/border.d.ts +3 -0
  181. package/lib/modules/border.js +1248 -0
  182. package/lib/modules/cell.d.ts +32 -0
  183. package/lib/modules/cell.js +1085 -0
  184. package/lib/modules/clipboard.d.ts +3 -0
  185. package/lib/modules/clipboard.js +42 -0
  186. package/lib/modules/color.d.ts +1 -0
  187. package/lib/modules/color.js +7 -0
  188. package/lib/modules/comment.d.ts +97 -0
  189. package/lib/modules/comment.js +625 -0
  190. package/lib/modules/conditionalFormat.d.ts +2 -0
  191. package/lib/modules/conditionalFormat.js +447 -0
  192. package/lib/modules/cursor.d.ts +3 -0
  193. package/lib/modules/cursor.js +70 -0
  194. package/lib/modules/dataVerification.d.ts +11 -0
  195. package/lib/modules/dataVerification.js +715 -0
  196. package/lib/modules/dropCell.d.ts +10 -0
  197. package/lib/modules/dropCell.js +2282 -0
  198. package/lib/modules/filter.d.ts +45 -0
  199. package/lib/modules/filter.js +448 -0
  200. package/lib/modules/format.d.ts +6 -0
  201. package/lib/modules/format.js +334 -0
  202. package/lib/modules/formula.d.ts +54 -0
  203. package/lib/modules/formula.js +2330 -0
  204. package/lib/modules/freeze.d.ts +5 -0
  205. package/lib/modules/freeze.js +158 -0
  206. package/lib/modules/hyperlink.d.ts +21 -0
  207. package/lib/modules/hyperlink.js +232 -0
  208. package/lib/modules/iframe.d.ts +12 -0
  209. package/lib/modules/iframe.js +236 -0
  210. package/lib/modules/image.d.ts +31 -0
  211. package/lib/modules/image.js +272 -0
  212. package/lib/modules/index.d.ts +36 -0
  213. package/lib/modules/index.js +401 -0
  214. package/lib/modules/inline-string.d.ts +36 -0
  215. package/lib/modules/inline-string.js +452 -0
  216. package/lib/modules/location.d.ts +6 -0
  217. package/lib/modules/location.js +57 -0
  218. package/lib/modules/locationCondition.d.ts +21 -0
  219. package/lib/modules/locationCondition.js +229 -0
  220. package/lib/modules/merge.d.ts +3 -0
  221. package/lib/modules/merge.js +223 -0
  222. package/lib/modules/mobile.d.ts +5 -0
  223. package/lib/modules/mobile.js +41 -0
  224. package/lib/modules/moveCells.d.ts +5 -0
  225. package/lib/modules/moveCells.js +357 -0
  226. package/lib/modules/protection.d.ts +5 -0
  227. package/lib/modules/protection.js +106 -0
  228. package/lib/modules/refresh.d.ts +3 -0
  229. package/lib/modules/refresh.js +40 -0
  230. package/lib/modules/rowcol.d.ts +19 -0
  231. package/lib/modules/rowcol.js +1935 -0
  232. package/lib/modules/screenshot.d.ts +2 -0
  233. package/lib/modules/screenshot.js +96 -0
  234. package/lib/modules/searchReplace.d.ts +36 -0
  235. package/lib/modules/searchReplace.js +402 -0
  236. package/lib/modules/selection.d.ts +46 -0
  237. package/lib/modules/selection.js +1703 -0
  238. package/lib/modules/sheet.d.ts +10 -0
  239. package/lib/modules/sheet.js +250 -0
  240. package/lib/modules/sort.d.ts +7 -0
  241. package/lib/modules/sort.js +159 -0
  242. package/lib/modules/splitColumn.d.ts +5 -0
  243. package/lib/modules/splitColumn.js +136 -0
  244. package/lib/modules/ssf.js +1539 -0
  245. package/lib/modules/text.d.ts +10 -0
  246. package/lib/modules/text.js +1221 -0
  247. package/lib/modules/toolbar.d.ts +32 -0
  248. package/lib/modules/toolbar.js +1003 -0
  249. package/lib/modules/validation.d.ts +19 -0
  250. package/lib/modules/validation.js +205 -0
  251. package/lib/modules/zoom.d.ts +3 -0
  252. package/lib/modules/zoom.js +36 -0
  253. package/lib/settings.d.ts +100 -0
  254. package/lib/settings.js +42 -0
  255. package/lib/types.d.ts +371 -0
  256. package/lib/types.js +5 -0
  257. package/lib/utils/freeze.d.ts +7 -0
  258. package/lib/utils/freeze.js +92 -0
  259. package/lib/utils/index.d.ts +18 -0
  260. package/lib/utils/index.js +231 -0
  261. package/lib/utils/patch.d.ts +37 -0
  262. package/lib/utils/patch.js +392 -0
  263. package/package.json +7 -6
  264. package/dist/index.esm.js +0 -80255
  265. package/dist/index.js +0 -80601
  266. package/dist/packages/react/src/components/ChangeColor/index.d.ts +0 -7
  267. package/dist/packages/react/src/components/ConditionFormat/ConditionRules.d.ts +0 -6
  268. package/dist/packages/react/src/components/ConditionFormat/index.d.ts +0 -7
  269. package/dist/packages/react/src/components/ContextMenu/Divider.d.ts +0 -3
  270. package/dist/packages/react/src/components/ContextMenu/FilterMenu.d.ts +0 -3
  271. package/dist/packages/react/src/components/ContextMenu/Menu.d.ts +0 -8
  272. package/dist/packages/react/src/components/ContextMenu/SheetTab.d.ts +0 -4
  273. package/dist/packages/react/src/components/ContextMenu/index.d.ts +0 -5
  274. package/dist/packages/react/src/components/CustomSort/index.d.ts +0 -4
  275. package/dist/packages/react/src/components/DataVerification/DropdownList.d.ts +0 -4
  276. package/dist/packages/react/src/components/DataVerification/RangeDialog.d.ts +0 -4
  277. package/dist/packages/react/src/components/DataVerification/getDisplayedRangeTxt.d.ts +0 -2
  278. package/dist/packages/react/src/components/DataVerification/index.d.ts +0 -4
  279. package/dist/packages/react/src/components/Dialog/index.d.ts +0 -15
  280. package/dist/packages/react/src/components/DuneChartsInputModal/DuneChartsInputModal.d.ts +0 -11
  281. package/dist/packages/react/src/components/DunePreview/DunePreview.d.ts +0 -13
  282. package/dist/packages/react/src/components/FilterOption/index.d.ts +0 -5
  283. package/dist/packages/react/src/components/FormatSearch/index.d.ts +0 -6
  284. package/dist/packages/react/src/components/FormulaSearch/index.d.ts +0 -5
  285. package/dist/packages/react/src/components/FxEditor/NameBox.d.ts +0 -3
  286. package/dist/packages/react/src/components/FxEditor/index.d.ts +0 -4
  287. package/dist/packages/react/src/components/IFrameBoxs/iFrameBoxs.d.ts +0 -4
  288. package/dist/packages/react/src/components/ImgBoxs/index.d.ts +0 -3
  289. package/dist/packages/react/src/components/LinkEidtCard/index.d.ts +0 -5
  290. package/dist/packages/react/src/components/LocationCondition/index.d.ts +0 -3
  291. package/dist/packages/react/src/components/MessageBox/index.d.ts +0 -9
  292. package/dist/packages/react/src/components/NotationBoxes/index.d.ts +0 -3
  293. package/dist/packages/react/src/components/ResetColumnWidth/index.d.ts +0 -2
  294. package/dist/packages/react/src/components/SVGDefines.d.ts +0 -5
  295. package/dist/packages/react/src/components/SVGIcon.d.ts +0 -9
  296. package/dist/packages/react/src/components/SearchReplace/index.d.ts +0 -6
  297. package/dist/packages/react/src/components/Sheet/index.d.ts +0 -8
  298. package/dist/packages/react/src/components/SheetList/SheetHiddenButton.d.ts +0 -8
  299. package/dist/packages/react/src/components/SheetList/SheetListItem.d.ts +0 -9
  300. package/dist/packages/react/src/components/SheetList/index.d.ts +0 -4
  301. package/dist/packages/react/src/components/SheetOverlay/ColumnHeader.d.ts +0 -3
  302. package/dist/packages/react/src/components/SheetOverlay/ContentEditable.d.ts +0 -11
  303. package/dist/packages/react/src/components/SheetOverlay/FormulaHint/index.d.ts +0 -4
  304. package/dist/packages/react/src/components/SheetOverlay/FormulaSearch/constant.d.ts +0 -63
  305. package/dist/packages/react/src/components/SheetOverlay/FormulaSearch/index.d.ts +0 -4
  306. package/dist/packages/react/src/components/SheetOverlay/InputBox.d.ts +0 -3
  307. package/dist/packages/react/src/components/SheetOverlay/RowHeader.d.ts +0 -3
  308. package/dist/packages/react/src/components/SheetOverlay/ScrollBar/index.d.ts +0 -7
  309. package/dist/packages/react/src/components/SheetOverlay/index.d.ts +0 -4
  310. package/dist/packages/react/src/components/SheetTab/SheetItem.d.ts +0 -8
  311. package/dist/packages/react/src/components/SheetTab/index.d.ts +0 -4
  312. package/dist/packages/react/src/components/SplitColumn/index.d.ts +0 -3
  313. package/dist/packages/react/src/components/Toolbar/Button.d.ts +0 -12
  314. package/dist/packages/react/src/components/Toolbar/ColorPicker.d.ts +0 -6
  315. package/dist/packages/react/src/components/Toolbar/Combo.d.ts +0 -12
  316. package/dist/packages/react/src/components/Toolbar/CustomBorder.d.ts +0 -7
  317. package/dist/packages/react/src/components/Toolbar/CustomButton.d.ts +0 -11
  318. package/dist/packages/react/src/components/Toolbar/CustomColor.d.ts +0 -8
  319. package/dist/packages/react/src/components/Toolbar/CustomIcon.d.ts +0 -9
  320. package/dist/packages/react/src/components/Toolbar/Divider.d.ts +0 -4
  321. package/dist/packages/react/src/components/Toolbar/MoreItemsContainer.d.ts +0 -6
  322. package/dist/packages/react/src/components/Toolbar/Select.d.ts +0 -14
  323. package/dist/packages/react/src/components/Toolbar/index.d.ts +0 -10
  324. package/dist/packages/react/src/components/Workbook/api.d.ts +0 -1177
  325. package/dist/packages/react/src/components/Workbook/index.d.ts +0 -1185
  326. package/dist/packages/react/src/components/ZoomControl/index.d.ts +0 -4
  327. package/dist/packages/react/src/components/index.d.ts +0 -4
  328. package/dist/packages/react/src/constants.d.ts +0 -1
  329. package/dist/packages/react/src/context/index.d.ts +0 -25
  330. package/dist/packages/react/src/context/modal.d.ts +0 -10
  331. package/dist/packages/react/src/hooks/useAlert.d.ts +0 -4
  332. package/dist/packages/react/src/hooks/useDialog.d.ts +0 -5
  333. package/dist/packages/react/src/hooks/useOutsideClick.d.ts +0 -2
  334. package/dist/packages/react/src/hooks/usePrevious.d.ts +0 -2
  335. package/dist/packages/react/src/index.d.ts +0 -1
  336. package/dist/packages/react/src/utils/datepickerStyles.d.ts +0 -2
  337. package/dist/stories/API.stories.d.ts +0 -1210
  338. package/dist/stories/Collabration.stories.d.ts +0 -2359
  339. package/dist/stories/Features.stories.d.ts +0 -9430
  340. package/dist/stories/data/cell.d.ts +0 -983
  341. package/dist/stories/data/dataVerification.d.ts +0 -131
  342. package/dist/stories/data/empty.d.ts +0 -10
  343. package/dist/stories/data/formula.d.ts +0 -362
  344. package/dist/stories/data/freeze.d.ts +0 -34
  345. package/dist/stories/data/protected.d.ts +0 -40
  346. package/dist/stories/utils.d.ts +0 -1
@@ -0,0 +1,1221 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.clearMeasureTextCache = clearMeasureTextCache;
7
+ exports.defaultFont = defaultFont;
8
+ exports.drawLineInfo = drawLineInfo;
9
+ exports.getCellTextInfo = getCellTextInfo;
10
+ exports.getFontSet = getFontSet;
11
+ exports.getMeasureText = getMeasureText;
12
+ exports.hasChinaword = hasChinaword;
13
+ exports.isSupportBoundingBox = isSupportBoundingBox;
14
+ var _lodash = _interopRequireDefault(require("lodash"));
15
+ var _2 = require(".");
16
+ var _locale = require("../locale");
17
+ var _cell = require("./cell");
18
+ var _inlineString = require("./inline-string");
19
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
20
+ function checkWordByteLength(value) {
21
+ return Math.ceil(value.charCodeAt(0).toString(2).length / 8);
22
+ }
23
+ function hasChinaword(s) {
24
+ var patrn = /[\u4E00-\u9FA5]|[\uFE30-\uFFA0]/gi;
25
+ if (!patrn.exec(s)) {
26
+ return false;
27
+ }
28
+ return true;
29
+ }
30
+ var textHeightCache = {};
31
+ var measureTextCache = {};
32
+ var measureTextCellInfoCache = {};
33
+ function clearMeasureTextCache() {
34
+ measureTextCache = {};
35
+ measureTextCellInfoCache = {};
36
+ }
37
+ function getTextSize(text, font) {
38
+ if (font in textHeightCache) {
39
+ return textHeightCache[font];
40
+ }
41
+ var ele = document.createElement("span");
42
+ ele.style.float = "left";
43
+ ele.style.whiteSpace = "nowrap";
44
+ ele.style.visibility = "hidden";
45
+ ele.style.margin = "0";
46
+ ele.style.padding = "0";
47
+ ele.innerHTML = text;
48
+ document.body.append(ele);
49
+ var w = Math.max(ele.scrollWidth, ele.offsetWidth, ele.clientWidth);
50
+ var h = Math.max(ele.scrollHeight, ele.offsetHeight, ele.clientHeight);
51
+ textHeightCache[font] = [w, h];
52
+ ele.remove();
53
+ return [w, h];
54
+ }
55
+ function defaultFont(defaultFontSize) {
56
+ return "normal normal normal ".concat(defaultFontSize, "pt \"Helvetica Neue\", Helvetica, Arial, \"PingFang SC\", \"Hiragino Sans GB\", \"Heiti SC\", \"WenQuanYi Micro Hei\", sans-serif");
57
+ }
58
+ function getFontSet(format, defaultFontSize, ctx) {
59
+ if (_lodash.default.isPlainObject(format)) {
60
+ var fontAttr = [];
61
+ if (format.it === "0" || format.it === 0 || _lodash.default.isNil(format.it)) {
62
+ fontAttr.push("normal");
63
+ } else {
64
+ fontAttr.push("italic");
65
+ }
66
+ fontAttr.push("normal");
67
+ if (format.bl === "0" || format.bl === 0 || _lodash.default.isNil(format.bl)) {
68
+ fontAttr.push("normal");
69
+ } else {
70
+ fontAttr.push("bold");
71
+ }
72
+ if (!format.fs) {
73
+ fontAttr.push("".concat(defaultFontSize, "pt"));
74
+ } else {
75
+ fontAttr.push("".concat(Math.ceil(format.fs), "pt"));
76
+ }
77
+ var fontSet = "\"Helvetica Neue\", Helvetica, Arial, \"PingFang SC\", \"Hiragino Sans GB\", \"Heiti SC\", \"Microsoft YaHei\", \"WenQuanYi Micro Hei\", sans-serif";
78
+ if (ctx) {
79
+ var fontarray = (0, _locale.locale)(ctx).fontarray;
80
+ if (!format.ff) {
81
+ fontSet = "".concat(fontarray[0], ",").concat(fontSet);
82
+ } else {
83
+ var fontfamily = null;
84
+ if (ctx) {
85
+ if ((0, _2.isdatatypemulti)(format.ff).num) {
86
+ fontfamily = fontarray[parseInt(format.ff, 10)];
87
+ } else {
88
+ fontfamily = format.ff;
89
+ fontfamily = fontfamily.replace(/"/g, "").replace(/'/g, "");
90
+ if (fontfamily.indexOf(" ") > -1) {
91
+ fontfamily = "\"".concat(fontfamily, "\"");
92
+ }
93
+ }
94
+ }
95
+ fontSet = "".concat(fontfamily, ",").concat(fontSet);
96
+ }
97
+ }
98
+ return "".concat(fontAttr.join(" "), " ").concat(fontSet);
99
+ }
100
+ return defaultFont(defaultFontSize);
101
+ }
102
+ function getMeasureText(value, renderCtx, sheetCtx, fontset) {
103
+ var mtc = measureTextCache["".concat(value, "_").concat(renderCtx.font)];
104
+ if (fontset) {
105
+ mtc = measureTextCache["".concat(value, "_").concat(fontset)];
106
+ }
107
+ if (mtc != null) {
108
+ return mtc;
109
+ }
110
+ if (fontset) {
111
+ renderCtx.font = fontset;
112
+ }
113
+ var measureText = renderCtx.measureText(value);
114
+ var cache = {};
115
+ cache.width = measureText.width;
116
+ if (fontset) {
117
+ renderCtx.font = fontset;
118
+ }
119
+ cache.actualBoundingBoxDescent = measureText.actualBoundingBoxDescent;
120
+ cache.actualBoundingBoxAscent = measureText.actualBoundingBoxAscent;
121
+ if (cache.actualBoundingBoxDescent == null || cache.actualBoundingBoxAscent == null || Number.isNaN(cache.actualBoundingBoxDescent) || Number.isNaN(cache.actualBoundingBoxAscent)) {
122
+ var commonWord = "M";
123
+ if (hasChinaword(value)) {
124
+ commonWord = "田";
125
+ }
126
+ var oneLineTextHeight = getTextSize(commonWord, renderCtx.font)[1] * 0.8;
127
+ if (renderCtx.textBaseline === "top") {
128
+ cache.actualBoundingBoxDescent = oneLineTextHeight;
129
+ cache.actualBoundingBoxAscent = 0;
130
+ } else if (renderCtx.textBaseline === "middle") {
131
+ cache.actualBoundingBoxDescent = oneLineTextHeight / 2;
132
+ cache.actualBoundingBoxAscent = oneLineTextHeight / 2;
133
+ } else {
134
+ cache.actualBoundingBoxDescent = 0;
135
+ cache.actualBoundingBoxAscent = oneLineTextHeight;
136
+ }
137
+ }
138
+ if (renderCtx.textBaseline === "alphabetic") {
139
+ var descText = "gjpqy";
140
+ var matchText = "abcdABCD";
141
+ var descTextMeasure = measureTextCache["".concat(descText, "_").concat(renderCtx.font)];
142
+ if (fontset) {
143
+ descTextMeasure = measureTextCache["".concat(descText, "_").concat(fontset)];
144
+ }
145
+ var matchTextMeasure = measureTextCache["".concat(matchText, "_").concat(renderCtx.font)];
146
+ if (fontset) {
147
+ matchTextMeasure = measureTextCache["".concat(matchText, "_").concat(fontset)];
148
+ }
149
+ if (descTextMeasure == null) {
150
+ descTextMeasure = renderCtx.measureText(descText);
151
+ }
152
+ if (matchTextMeasure == null) {
153
+ matchTextMeasure = renderCtx.measureText(matchText);
154
+ }
155
+ if (cache.actualBoundingBoxDescent <= matchTextMeasure.actualBoundingBoxDescent) {
156
+ cache.actualBoundingBoxDescent = descTextMeasure.actualBoundingBoxDescent;
157
+ if (!cache.actualBoundingBoxDescent) {
158
+ cache.actualBoundingBoxDescent = 0;
159
+ }
160
+ }
161
+ }
162
+ cache.width *= sheetCtx.zoomRatio;
163
+ cache.actualBoundingBoxDescent *= sheetCtx.zoomRatio;
164
+ cache.actualBoundingBoxAscent *= sheetCtx.zoomRatio;
165
+ measureTextCache["".concat(value, "_").concat(sheetCtx.zoomRatio, "_").concat(renderCtx.font)] = cache;
166
+ return cache;
167
+ }
168
+ function isSupportBoundingBox(ctx) {
169
+ var measureText = ctx.measureText("田");
170
+ if (_lodash.default.isNil(measureText.actualBoundingBoxAscent)) {
171
+ return false;
172
+ }
173
+ return true;
174
+ }
175
+ function drawLineInfo(wordGroup, cancelLine, underLine, option) {
176
+ var left = option.left;
177
+ var top = option.top;
178
+ var width = option.width;
179
+ var asc = option.asc;
180
+ var desc = option.desc;
181
+ var fs = option.fs;
182
+ if (wordGroup.wrap === true) {
183
+ return;
184
+ }
185
+ if (wordGroup.inline === true && !_lodash.default.isNil(wordGroup.style)) {
186
+ cancelLine = wordGroup.style.cl;
187
+ underLine = wordGroup.style.un;
188
+ }
189
+ if (Number(cancelLine) !== 0) {
190
+ wordGroup.cancelLine = {};
191
+ wordGroup.cancelLine.startX = left;
192
+ wordGroup.cancelLine.startY = top - asc / 2 + 1;
193
+ wordGroup.cancelLine.endX = left + width;
194
+ wordGroup.cancelLine.endY = top - asc / 2 + 1;
195
+ wordGroup.cancelLine.fs = fs;
196
+ }
197
+ var nUnderline = Number(underLine);
198
+ if (nUnderline !== 0) {
199
+ wordGroup.underLine = [];
200
+ if (nUnderline === 1 || nUnderline === 2) {
201
+ var item = {};
202
+ item.startX = left;
203
+ item.startY = top + 3;
204
+ item.endX = left + width;
205
+ item.endY = top + 3;
206
+ item.fs = fs;
207
+ wordGroup.underLine.push(item);
208
+ }
209
+ if (nUnderline === 2) {
210
+ var item = {};
211
+ item.startX = left;
212
+ item.startY = top + desc;
213
+ item.endX = left + width;
214
+ item.endY = top + desc;
215
+ item.fs = fs;
216
+ wordGroup.underLine.push(item);
217
+ }
218
+ if (nUnderline === 3 || nUnderline === 4) {
219
+ var item = {};
220
+ item.startX = left;
221
+ item.startY = top + desc;
222
+ item.endX = left + width;
223
+ item.endY = top + desc;
224
+ item.fs = fs;
225
+ wordGroup.underLine.push(item);
226
+ }
227
+ if (nUnderline === 4) {
228
+ var item = {};
229
+ item.startX = left;
230
+ item.startY = top + desc + 2;
231
+ item.endX = left + width;
232
+ item.endY = top + desc + 2;
233
+ item.fs = fs;
234
+ wordGroup.underLine.push(item);
235
+ }
236
+ }
237
+ }
238
+ function getCellTextInfo(cell, renderCtx, sheetCtx, option, ctx) {
239
+ var cellWidth = option.cellWidth;
240
+ var cellHeight = option.cellHeight;
241
+ var isMode = "";
242
+ var isModeSplit = "";
243
+ if (cellWidth == null) {
244
+ isMode = "onlyWidth";
245
+ isModeSplit = "_";
246
+ }
247
+ var textInfo = measureTextCellInfoCache["".concat(option.r, "_").concat(option.c).concat(isModeSplit).concat(isMode)];
248
+ if (textInfo) {
249
+ return textInfo;
250
+ }
251
+ var space_width = option.space_width;
252
+ var space_height = option.space_height;
253
+ if (space_width === undefined) {
254
+ space_width = 2;
255
+ }
256
+ if (space_height === undefined) {
257
+ space_height = 2;
258
+ }
259
+ var horizonAlign = (0, _cell.normalizedCellAttr)(cell, "ht");
260
+ var verticalAlign = (0, _cell.normalizedCellAttr)(cell, "vt");
261
+ var tb = (0, _cell.normalizedCellAttr)(cell, "tb");
262
+ var tr = (0, _cell.normalizedCellAttr)(cell, "tr");
263
+ var rt = (0, _cell.normalizedCellAttr)(cell, "rt");
264
+ var isRotateUp = 1;
265
+ if (_lodash.default.isNil(rt)) {
266
+ if (tr === "0") {
267
+ rt = 0;
268
+ } else if (tr === "1") {
269
+ rt = 45;
270
+ } else if (tr === "4") {
271
+ rt = 90;
272
+ } else if (tr === "2") {
273
+ rt = 135;
274
+ } else if (tr === "5") {
275
+ rt = 180;
276
+ }
277
+ if (_lodash.default.isNil(rt)) {
278
+ rt = 0;
279
+ }
280
+ }
281
+ if (rt > 180 || rt < 0) {
282
+ rt = 0;
283
+ }
284
+ rt = parseInt(rt, 10);
285
+ if (rt > 90) {
286
+ rt = 90 - rt;
287
+ isRotateUp = 0;
288
+ }
289
+ renderCtx.textAlign = "start";
290
+ var textContent = {};
291
+ textContent.values = [];
292
+ var fontset;
293
+ var cancelLine = "0";
294
+ var underLine = "0";
295
+ var fontSize = 11;
296
+ var isInline = false;
297
+ var value;
298
+ var inlineStringArr = [];
299
+ if ((0, _inlineString.isInlineStringCell)(cell)) {
300
+ var sharedStrings = cell.ct.s;
301
+ var similarIndex = 0;
302
+ for (var i = 0; i < sharedStrings.length; i += 1) {
303
+ var shareCell = sharedStrings[i];
304
+ var scfontset = getFontSet(shareCell, sheetCtx.defaultFontSize, ctx);
305
+ var fc = shareCell.fc;
306
+ var cl = shareCell.cl;
307
+ var un = shareCell.un;
308
+ var v = shareCell.v;
309
+ var fs = shareCell.fs;
310
+ v = v.replace(/\r\n/g, "_x000D_").replace(/&#13;&#10;/g, "_x000D_").replace(/\r/g, "_x000D_").replace(/\n/g, "_x000D_");
311
+ var splitArr = v.split("_x000D_");
312
+ for (var x = 0; x < splitArr.length; x += 1) {
313
+ var newValue = splitArr[x];
314
+ if (newValue === "" && x !== splitArr.length - 1) {
315
+ inlineStringArr.push({
316
+ fontset: scfontset,
317
+ fc: !fc ? "#000" : fc,
318
+ cl: !cl ? 0 : cl,
319
+ un: !un ? 0 : un,
320
+ wrap: true,
321
+ fs: !fs ? 11 : fs
322
+ });
323
+ similarIndex += 1;
324
+ } else {
325
+ inlineStringArr.push({
326
+ fontset: scfontset,
327
+ fc: !fc ? "#000" : fc,
328
+ cl: !cl ? 0 : cl,
329
+ un: !un ? 0 : un,
330
+ v: newValue,
331
+ si: similarIndex,
332
+ fs: !fs ? 11 : fs
333
+ });
334
+ if (x !== splitArr.length - 1) {
335
+ inlineStringArr.push({
336
+ fontset: scfontset,
337
+ fc: !fc ? "#000" : fc,
338
+ cl: !cl ? 0 : cl,
339
+ un: !un ? 0 : un,
340
+ wrap: true,
341
+ fs: !fs ? 11 : fs
342
+ });
343
+ similarIndex += 1;
344
+ }
345
+ }
346
+ }
347
+ similarIndex += 1;
348
+ }
349
+ isInline = true;
350
+ } else {
351
+ fontset = getFontSet(cell, sheetCtx.defaultFontSize, ctx);
352
+ renderCtx.font = fontset;
353
+ cancelLine = (0, _cell.normalizedCellAttr)(cell, "cl");
354
+ underLine = (0, _cell.normalizedCellAttr)(cell, "un");
355
+ fontSize = (0, _cell.normalizedCellAttr)(cell, "fs");
356
+ if (cell instanceof Object) {
357
+ value = cell.m;
358
+ if (_lodash.default.isNil(value)) {
359
+ value = cell.v;
360
+ }
361
+ } else {
362
+ value = cell;
363
+ }
364
+ if (_lodash.default.isEmpty(value)) {
365
+ return null;
366
+ }
367
+ }
368
+ if (tr === "3") {
369
+ renderCtx.textBaseline = "top";
370
+ var textW_all = 0;
371
+ var textH_all = 0;
372
+ var colIndex = 0;
373
+ var textH_all_cache = 0;
374
+ var textH_all_Column = {};
375
+ var textH_all_ColumnHeight = [];
376
+ if (isInline) {
377
+ var preShareCell = null;
378
+ for (var i = 0; i < inlineStringArr.length; i += 1) {
379
+ var shareCell = inlineStringArr[i];
380
+ var value1 = shareCell.v;
381
+ var showValue = shareCell.v;
382
+ if (shareCell.wrap === true) {
383
+ value1 = "M";
384
+ showValue = "";
385
+ if (!_lodash.default.isNil(preShareCell) && preShareCell.wrap !== true && i < inlineStringArr.length - 1) {
386
+ textH_all_ColumnHeight.push(textH_all_cache);
387
+ textH_all_cache = 0;
388
+ colIndex += 1;
389
+ preShareCell = shareCell;
390
+ continue;
391
+ }
392
+ }
393
+ var measureText = getMeasureText(value1, renderCtx, sheetCtx, shareCell.fontset);
394
+ var textW = measureText.width + space_width;
395
+ var textH = measureText.actualBoundingBoxAscent + measureText.actualBoundingBoxDescent + space_height;
396
+ textH_all_cache += textH;
397
+ if (tb === "2" && !shareCell.wrap) {
398
+ if (textH_all_cache > cellHeight && !_lodash.default.isNil(textH_all_Column[colIndex])) {
399
+ textH_all_ColumnHeight.push(textH_all_cache - textH);
400
+ textH_all_cache = textH;
401
+ colIndex += 1;
402
+ }
403
+ }
404
+ if (i === inlineStringArr.length - 1) {
405
+ textH_all_ColumnHeight.push(textH_all_cache);
406
+ }
407
+ if (_lodash.default.isNil(textH_all_Column[colIndex])) {
408
+ textH_all_Column[colIndex] = [];
409
+ }
410
+ var item = {
411
+ content: showValue,
412
+ style: shareCell,
413
+ width: textW,
414
+ height: textH,
415
+ left: 0,
416
+ top: 0,
417
+ colIndex: colIndex,
418
+ asc: measureText.actualBoundingBoxAscent,
419
+ desc: measureText.actualBoundingBoxDescent,
420
+ inline: true,
421
+ wrap: false
422
+ };
423
+ if (shareCell.wrap === true) {
424
+ item.wrap = true;
425
+ }
426
+ textH_all_Column[colIndex].push(item);
427
+ preShareCell = shareCell;
428
+ }
429
+ } else {
430
+ var measureText = getMeasureText(value, renderCtx, sheetCtx);
431
+ var textHeight = measureText.actualBoundingBoxDescent + measureText.actualBoundingBoxAscent;
432
+ value = value.toString();
433
+ var vArr = [];
434
+ if (value.length > 1) {
435
+ vArr = value.split("");
436
+ } else {
437
+ vArr.push(value);
438
+ }
439
+ var oneWordWidth = getMeasureText(vArr[0], renderCtx, sheetCtx).width;
440
+ for (var i = 0; i < vArr.length; i += 1) {
441
+ var textW = oneWordWidth + space_width;
442
+ var textH = textHeight + space_height;
443
+ textH_all_cache += textH;
444
+ if (tb === "2") {
445
+ if (textH_all_cache > cellHeight && !_lodash.default.isNil(textH_all_Column[colIndex])) {
446
+ textH_all_ColumnHeight.push(textH_all_cache - textH);
447
+ textH_all_cache = textH;
448
+ colIndex += 1;
449
+ }
450
+ }
451
+ if (i === vArr.length - 1) {
452
+ textH_all_ColumnHeight.push(textH_all_cache);
453
+ }
454
+ if (_lodash.default.isNil(textH_all_Column[colIndex])) {
455
+ textH_all_Column[colIndex] = [];
456
+ }
457
+ textH_all_Column[colIndex].push({
458
+ content: vArr[i],
459
+ style: fontset,
460
+ width: textW,
461
+ height: textH,
462
+ left: 0,
463
+ top: 0,
464
+ colIndex: colIndex,
465
+ asc: measureText.actualBoundingBoxAscent,
466
+ desc: measureText.actualBoundingBoxDescent
467
+ });
468
+ }
469
+ }
470
+ var textH_all_ColumWidth = [];
471
+ for (var i = 0; i < textH_all_ColumnHeight.length; i += 1) {
472
+ var columnHeight = textH_all_ColumnHeight[i];
473
+ var col = textH_all_Column[i];
474
+ var colMaxW = 0;
475
+ for (var c = 0; c < col.length; c += 1) {
476
+ var word = col[c];
477
+ colMaxW = Math.max(colMaxW, word.width);
478
+ }
479
+ textH_all_ColumWidth.push(colMaxW);
480
+ textW_all += colMaxW;
481
+ textH_all = Math.max(textH_all, columnHeight);
482
+ }
483
+ textContent.type = "verticalWrap";
484
+ textContent.textWidthAll = textW_all;
485
+ textContent.textHeightAll = textH_all;
486
+ if (isMode === "onlyWidth") {
487
+ return textContent;
488
+ }
489
+ var cumColumnWidth = 0;
490
+ for (var i = 0; i < textH_all_ColumnHeight.length; i += 1) {
491
+ var columnHeight = textH_all_ColumnHeight[i];
492
+ var columnWidth = textH_all_ColumWidth[i];
493
+ var col = textH_all_Column[i];
494
+ var cumWordHeight = 0;
495
+ for (var c = 0; c < col.length; c += 1) {
496
+ var word = col[c];
497
+ var left = space_width + cumColumnWidth;
498
+ if (horizonAlign === "0") {
499
+ left = cellWidth / 2 + cumColumnWidth - textW_all / 2 + space_width * textH_all_ColumnHeight.length;
500
+ } else if (horizonAlign === "2") {
501
+ left = cellWidth + cumColumnWidth - textW_all + space_width;
502
+ }
503
+ var top_1 = cellHeight - space_height + cumWordHeight - columnHeight;
504
+ if (verticalAlign === "0") {
505
+ top_1 = cellHeight / 2 + cumWordHeight - columnHeight / 2;
506
+ } else if (verticalAlign === "1") {
507
+ top_1 = space_height + cumWordHeight;
508
+ }
509
+ cumWordHeight += word.height;
510
+ word.left = left;
511
+ word.top = top_1;
512
+ drawLineInfo(word, cancelLine, underLine, {
513
+ width: columnWidth,
514
+ height: word.height,
515
+ left: left,
516
+ top: top_1 + word.height - space_height,
517
+ asc: word.height,
518
+ desc: 0,
519
+ fs: fontSize
520
+ });
521
+ textContent.values.push(word);
522
+ }
523
+ cumColumnWidth += columnWidth;
524
+ }
525
+ } else {
526
+ var supportBoundBox = isSupportBoundingBox(renderCtx);
527
+ if (supportBoundBox) {
528
+ renderCtx.textBaseline = "alphabetic";
529
+ } else {
530
+ renderCtx.textBaseline = "bottom";
531
+ }
532
+ if (tb === "2" || isInline) {
533
+ var textW_all = 0;
534
+ var textH_all = 0;
535
+ var textW_all_inner = 0;
536
+ var splitIndex = 0;
537
+ var text_all_split = {};
538
+ textContent.rotate = rt;
539
+ rt = Math.abs(rt);
540
+ var anchor = 0;
541
+ var preStr = void 0;
542
+ var preTextHeight = void 0;
543
+ var preTextWidth = void 0;
544
+ var preMeasureText = void 0;
545
+ var i = 1;
546
+ var spaceOrTwoByte = null;
547
+ var spaceOrTwoByteIndex = null;
548
+ if (isInline) {
549
+ while (i <= inlineStringArr.length) {
550
+ var shareCells = inlineStringArr.slice(anchor, i);
551
+ if (shareCells[shareCells.length - 1].wrap === true) {
552
+ anchor = i;
553
+ if (shareCells.length > 1) {
554
+ for (var s = 0; s < shareCells.length - 1; s += 1) {
555
+ var sc = shareCells[s];
556
+ var item = {
557
+ content: sc.v,
558
+ style: sc,
559
+ width: sc.measureText.width,
560
+ height: sc.measureText.actualBoundingBoxAscent + sc.measureText.actualBoundingBoxDescent,
561
+ left: 0,
562
+ top: 0,
563
+ splitIndex: splitIndex,
564
+ asc: sc.measureText.actualBoundingBoxAscent,
565
+ desc: sc.measureText.actualBoundingBoxDescent,
566
+ inline: true,
567
+ fs: sc.fs
568
+ };
569
+ text_all_split[splitIndex].push(item);
570
+ }
571
+ }
572
+ if (shareCells.length === 1) {
573
+ var sc = shareCells[0];
574
+ var measureText = getMeasureText("M", renderCtx, sheetCtx, sc.fontset);
575
+ if (_lodash.default.isNil(text_all_split[splitIndex])) {
576
+ text_all_split[splitIndex] = [];
577
+ }
578
+ text_all_split[splitIndex].push({
579
+ content: "",
580
+ style: sc,
581
+ width: measureText.width,
582
+ height: measureText.actualBoundingBoxAscent + measureText.actualBoundingBoxDescent,
583
+ left: 0,
584
+ top: 0,
585
+ splitIndex: splitIndex,
586
+ asc: measureText.actualBoundingBoxAscent,
587
+ desc: measureText.actualBoundingBoxDescent,
588
+ inline: true,
589
+ wrap: true,
590
+ fs: sc.fs
591
+ });
592
+ }
593
+ splitIndex += 1;
594
+ i += 1;
595
+ continue;
596
+ }
597
+ var textWidth = 0;
598
+ var textHeight = 0;
599
+ for (var s = 0; s < shareCells.length; s += 1) {
600
+ var sc = shareCells[s];
601
+ if (_lodash.default.isNil(sc.measureText)) {
602
+ sc.measureText = getMeasureText(sc.v, renderCtx, sheetCtx, sc.fontset);
603
+ }
604
+ textWidth += sc.measureText.width;
605
+ textHeight = Math.max(sc.measureText.actualBoundingBoxAscent + sc.measureText.actualBoundingBoxDescent);
606
+ }
607
+ var width = textWidth * Math.cos(rt * Math.PI / 180) + textHeight * Math.sin(rt * Math.PI / 180);
608
+ var height = textWidth * Math.sin(rt * Math.PI / 180) + textHeight * Math.cos(rt * Math.PI / 180);
609
+ var lastWord = shareCells[shareCells.length - 1];
610
+ if (lastWord.v === " " || checkWordByteLength(lastWord.v) === 2) {
611
+ spaceOrTwoByteIndex = i;
612
+ }
613
+ if (rt !== 0) {
614
+ if (height + space_height > cellHeight && !_lodash.default.isNil(text_all_split[splitIndex]) && tb === "2") {
615
+ if (!_lodash.default.isNil(spaceOrTwoByteIndex) && spaceOrTwoByteIndex < i) {
616
+ for (var s = 0; s < spaceOrTwoByteIndex - anchor; s += 1) {
617
+ var sc = shareCells[s];
618
+ text_all_split[splitIndex].push({
619
+ content: sc.v,
620
+ style: sc,
621
+ width: sc.measureText.width,
622
+ height: sc.measureText.actualBoundingBoxAscent + sc.measureText.actualBoundingBoxDescent,
623
+ left: 0,
624
+ top: 0,
625
+ splitIndex: splitIndex,
626
+ asc: sc.measureText.actualBoundingBoxAscent,
627
+ desc: sc.measureText.actualBoundingBoxDescent,
628
+ inline: true,
629
+ fs: sc.fs
630
+ });
631
+ }
632
+ anchor = spaceOrTwoByteIndex;
633
+ i = spaceOrTwoByteIndex + 1;
634
+ splitIndex += 1;
635
+ spaceOrTwoByteIndex = null;
636
+ } else {
637
+ anchor = i - 1;
638
+ for (var s = 0; s < shareCells.length - 1; s += 1) {
639
+ var sc = shareCells[s];
640
+ text_all_split[splitIndex].push({
641
+ content: sc.v,
642
+ style: sc,
643
+ width: sc.measureText.width,
644
+ height: sc.measureText.actualBoundingBoxAscent + sc.measureText.actualBoundingBoxDescent,
645
+ left: 0,
646
+ top: 0,
647
+ splitIndex: splitIndex,
648
+ asc: sc.measureText.actualBoundingBoxAscent,
649
+ desc: sc.measureText.actualBoundingBoxDescent,
650
+ inline: true,
651
+ fs: sc.fs
652
+ });
653
+ }
654
+ splitIndex += 1;
655
+ }
656
+ } else if (i === inlineStringArr.length) {
657
+ if (_lodash.default.isNil(text_all_split[splitIndex])) {
658
+ text_all_split[splitIndex] = [];
659
+ }
660
+ for (var s = 0; s < shareCells.length; s += 1) {
661
+ var sc = shareCells[s];
662
+ text_all_split[splitIndex].push({
663
+ content: sc.v,
664
+ style: sc,
665
+ width: sc.measureText.width,
666
+ height: sc.measureText.actualBoundingBoxAscent + sc.measureText.actualBoundingBoxDescent,
667
+ left: 0,
668
+ top: 0,
669
+ splitIndex: splitIndex,
670
+ asc: sc.measureText.actualBoundingBoxAscent,
671
+ desc: sc.measureText.actualBoundingBoxDescent,
672
+ inline: true,
673
+ fs: sc.fs
674
+ });
675
+ }
676
+ break;
677
+ } else {
678
+ if (_lodash.default.isNil(text_all_split[splitIndex])) {
679
+ text_all_split[splitIndex] = [];
680
+ }
681
+ i += 1;
682
+ }
683
+ } else {
684
+ if (width + space_width > cellWidth && !_lodash.default.isNil(text_all_split[splitIndex]) && tb === "2") {
685
+ if (!_lodash.default.isNil(spaceOrTwoByteIndex) && spaceOrTwoByteIndex < i) {
686
+ for (var s = 0; s < spaceOrTwoByteIndex - anchor; s += 1) {
687
+ var sc = shareCells[s];
688
+ text_all_split[splitIndex].push({
689
+ content: sc.v,
690
+ style: sc,
691
+ width: sc.measureText.width,
692
+ height: sc.measureText.actualBoundingBoxAscent + sc.measureText.actualBoundingBoxDescent,
693
+ left: 0,
694
+ top: 0,
695
+ splitIndex: splitIndex,
696
+ asc: sc.measureText.actualBoundingBoxAscent,
697
+ desc: sc.measureText.actualBoundingBoxDescent,
698
+ inline: true,
699
+ fs: sc.fs
700
+ });
701
+ }
702
+ anchor = spaceOrTwoByteIndex;
703
+ i = spaceOrTwoByteIndex + 1;
704
+ splitIndex += 1;
705
+ spaceOrTwoByteIndex = null;
706
+ } else {
707
+ anchor = i - 1;
708
+ for (var s = 0; s < shareCells.length - 1; s += 1) {
709
+ var sc = shareCells[s];
710
+ text_all_split[splitIndex].push({
711
+ content: sc.v,
712
+ style: sc,
713
+ width: sc.measureText.width,
714
+ height: sc.measureText.actualBoundingBoxAscent + sc.measureText.actualBoundingBoxDescent,
715
+ left: 0,
716
+ top: 0,
717
+ splitIndex: splitIndex,
718
+ asc: sc.measureText.actualBoundingBoxAscent,
719
+ desc: sc.measureText.actualBoundingBoxDescent,
720
+ inline: true,
721
+ fs: sc.fs
722
+ });
723
+ }
724
+ splitIndex += 1;
725
+ }
726
+ } else if (i === inlineStringArr.length) {
727
+ if (_lodash.default.isNil(text_all_split[splitIndex])) {
728
+ text_all_split[splitIndex] = [];
729
+ }
730
+ for (var s = 0; s < shareCells.length; s += 1) {
731
+ var sc = shareCells[s];
732
+ text_all_split[splitIndex].push({
733
+ content: sc.v,
734
+ style: sc,
735
+ width: sc.measureText.width,
736
+ height: sc.measureText.actualBoundingBoxAscent + sc.measureText.actualBoundingBoxDescent,
737
+ left: 0,
738
+ top: 0,
739
+ splitIndex: splitIndex,
740
+ asc: sc.measureText.actualBoundingBoxAscent,
741
+ desc: sc.measureText.actualBoundingBoxDescent,
742
+ inline: true,
743
+ fs: sc.fs
744
+ });
745
+ }
746
+ break;
747
+ } else {
748
+ if (_lodash.default.isNil(text_all_split[splitIndex])) {
749
+ text_all_split[splitIndex] = [];
750
+ }
751
+ i += 1;
752
+ }
753
+ }
754
+ }
755
+ } else {
756
+ value = value.toString();
757
+ while (i <= value.length) {
758
+ var str = value.substring(anchor, i);
759
+ var measureText = getMeasureText(str, renderCtx, sheetCtx);
760
+ var textWidth = measureText.width;
761
+ var textHeight = measureText.actualBoundingBoxAscent + measureText.actualBoundingBoxDescent;
762
+ var width = textWidth * Math.cos(rt * Math.PI / 180) + textHeight * Math.sin(rt * Math.PI / 180);
763
+ var height = textWidth * Math.sin(rt * Math.PI / 180) + textHeight * Math.cos(rt * Math.PI / 180);
764
+ var lastWord = str.substr(str.length - 1, 1);
765
+ if (lastWord === " " || checkWordByteLength(lastWord) === 2) {
766
+ spaceOrTwoByte = {
767
+ index: i,
768
+ str: str,
769
+ width: width,
770
+ height: height,
771
+ asc: measureText.actualBoundingBoxAscent,
772
+ desc: measureText.actualBoundingBoxDescent
773
+ };
774
+ }
775
+ if (rt !== 0) {
776
+ if (height + space_height > cellHeight && !_lodash.default.isNil(text_all_split[splitIndex])) {
777
+ if (!_lodash.default.isNil(spaceOrTwoByte) && spaceOrTwoByte.index < i) {
778
+ anchor = spaceOrTwoByte.index;
779
+ i = spaceOrTwoByte.index + 1;
780
+ text_all_split[splitIndex].push({
781
+ content: spaceOrTwoByte.str,
782
+ style: fontset,
783
+ width: spaceOrTwoByte.width,
784
+ height: spaceOrTwoByte.height,
785
+ left: 0,
786
+ top: 0,
787
+ splitIndex: splitIndex,
788
+ asc: spaceOrTwoByte.asc,
789
+ desc: spaceOrTwoByte.desc,
790
+ fs: fontSize
791
+ });
792
+ splitIndex += 1;
793
+ spaceOrTwoByte = null;
794
+ } else {
795
+ anchor = i - 1;
796
+ text_all_split[splitIndex].push({
797
+ content: preStr,
798
+ style: fontset,
799
+ left: 0,
800
+ top: 0,
801
+ splitIndex: splitIndex,
802
+ height: preTextHeight,
803
+ width: preTextWidth,
804
+ asc: measureText.actualBoundingBoxAscent,
805
+ desc: measureText.actualBoundingBoxDescent,
806
+ fs: fontSize
807
+ });
808
+ splitIndex += 1;
809
+ }
810
+ } else if (i === value.length) {
811
+ if (_lodash.default.isNil(text_all_split[splitIndex])) {
812
+ text_all_split[splitIndex] = [];
813
+ }
814
+ text_all_split[splitIndex].push({
815
+ content: str,
816
+ style: fontset,
817
+ left: 0,
818
+ top: 0,
819
+ splitIndex: splitIndex,
820
+ height: textHeight,
821
+ width: textWidth,
822
+ asc: measureText.actualBoundingBoxAscent,
823
+ desc: measureText.actualBoundingBoxDescent,
824
+ fs: fontSize
825
+ });
826
+ break;
827
+ } else {
828
+ if (_lodash.default.isNil(text_all_split[splitIndex])) {
829
+ text_all_split[splitIndex] = [];
830
+ }
831
+ i += 1;
832
+ }
833
+ } else {
834
+ if (width + space_width > cellWidth && !_lodash.default.isNil(text_all_split[splitIndex])) {
835
+ if (!_lodash.default.isNil(spaceOrTwoByte) && spaceOrTwoByte.index < i) {
836
+ anchor = spaceOrTwoByte.index;
837
+ i = spaceOrTwoByte.index + 1;
838
+ text_all_split[splitIndex].push({
839
+ content: spaceOrTwoByte.str,
840
+ style: fontset,
841
+ width: spaceOrTwoByte.width,
842
+ height: spaceOrTwoByte.height,
843
+ left: 0,
844
+ top: 0,
845
+ splitIndex: splitIndex,
846
+ asc: spaceOrTwoByte.asc,
847
+ desc: spaceOrTwoByte.desc,
848
+ fs: fontSize
849
+ });
850
+ splitIndex += 1;
851
+ spaceOrTwoByte = null;
852
+ } else {
853
+ spaceOrTwoByte = null;
854
+ anchor = i - 1;
855
+ text_all_split[splitIndex].push({
856
+ content: preStr,
857
+ style: fontset,
858
+ width: preTextWidth,
859
+ height: preTextHeight,
860
+ left: 0,
861
+ top: 0,
862
+ splitIndex: splitIndex,
863
+ asc: preMeasureText.actualBoundingBoxAscent,
864
+ desc: preMeasureText.actualBoundingBoxDescent,
865
+ fs: fontSize
866
+ });
867
+ splitIndex += 1;
868
+ }
869
+ } else if (i === value.length) {
870
+ if (_lodash.default.isNil(text_all_split[splitIndex])) {
871
+ text_all_split[splitIndex] = [];
872
+ }
873
+ text_all_split[splitIndex].push({
874
+ content: str,
875
+ style: fontset,
876
+ width: textWidth,
877
+ height: textHeight,
878
+ left: 0,
879
+ top: 0,
880
+ splitIndex: splitIndex,
881
+ asc: measureText.actualBoundingBoxAscent,
882
+ desc: measureText.actualBoundingBoxDescent,
883
+ fs: fontSize
884
+ });
885
+ break;
886
+ } else {
887
+ if (_lodash.default.isNil(text_all_split[splitIndex])) {
888
+ text_all_split[splitIndex] = [];
889
+ }
890
+ i += 1;
891
+ }
892
+ }
893
+ preStr = str;
894
+ preTextHeight = textHeight;
895
+ preTextWidth = textWidth;
896
+ preMeasureText = measureText;
897
+ }
898
+ }
899
+ var split_all_size = [];
900
+ var oneLinemaxWordCount = 0;
901
+ var splitLen = Object.keys(text_all_split).length;
902
+ if (splitLen === 0) return textContent;
903
+ for (var j = 0; j < splitLen; j += 1) {
904
+ var splitLists = text_all_split[j];
905
+ if (_lodash.default.isNil(splitLists)) {
906
+ continue;
907
+ }
908
+ var sWidth = 0;
909
+ var sHeight = 0;
910
+ var maxDesc = 0;
911
+ var maxAsc = 0;
912
+ var lineHeight = 0;
913
+ var maxWordCount = 0;
914
+ for (var s = 0; s < splitLists.length; s += 1) {
915
+ var sp = splitLists[s];
916
+ if (rt !== 0) {
917
+ sWidth += sp.width;
918
+ sHeight = Math.max(sHeight, sp.height - (supportBoundBox ? sp.desc : 0));
919
+ } else {
920
+ sWidth += sp.width;
921
+ sHeight = Math.max(sHeight, sp.height - (supportBoundBox ? sp.desc : 0));
922
+ }
923
+ maxDesc = Math.max(maxDesc, supportBoundBox ? sp.desc : 0);
924
+ maxAsc = Math.max(maxAsc, sp.asc);
925
+ maxWordCount += 1;
926
+ }
927
+ lineHeight = sHeight / 2;
928
+ oneLinemaxWordCount = Math.max(oneLinemaxWordCount, maxWordCount);
929
+ if (rt !== 0) {
930
+ sHeight += lineHeight;
931
+ textW_all_inner = Math.max(textW_all_inner, sWidth);
932
+ textH_all += sHeight;
933
+ } else {
934
+ sHeight += lineHeight;
935
+ textW_all = Math.max(textW_all, sWidth);
936
+ textH_all += sHeight;
937
+ }
938
+ split_all_size.push({
939
+ width: sWidth,
940
+ height: sHeight,
941
+ desc: maxDesc,
942
+ asc: maxAsc,
943
+ lineHeight: lineHeight,
944
+ wordCount: maxWordCount
945
+ });
946
+ }
947
+ var cumWordHeight = 0;
948
+ var cumColumnWidth = 0;
949
+ var rtPI = rt * Math.PI / 180;
950
+ var lastLine = split_all_size[splitLen - 1];
951
+ var lastLineSpaceHeight = lastLine.lineHeight;
952
+ textH_all = textH_all - lastLineSpaceHeight + lastLine.desc;
953
+ var rw = textH_all / Math.sin(rtPI) + textW_all_inner * Math.cos(rtPI);
954
+ var rh = textW_all_inner * Math.sin(rtPI);
955
+ var fixOneLineLeft = 0;
956
+ if (rt !== 0) {
957
+ if (splitLen === 1) {
958
+ textW_all = textW_all_inner + 2 * (textH_all / Math.tan(rtPI));
959
+ fixOneLineLeft = textH_all / Math.tan(rtPI);
960
+ } else {
961
+ textW_all = textW_all_inner + textH_all / Math.tan(rtPI);
962
+ }
963
+ textContent.textWidthAll = rw;
964
+ textContent.textHeightAll = rh;
965
+ } else {
966
+ textContent.textWidthAll = textW_all;
967
+ textContent.textHeightAll = textH_all;
968
+ }
969
+ if (isMode === "onlyWidth") {
970
+ return textContent;
971
+ }
972
+ if (rt !== 0 && Number(isRotateUp) === 1) {
973
+ renderCtx.textAlign = "end";
974
+ for (var j = 0; j < splitLen; j += 1) {
975
+ var splitLists = text_all_split[j];
976
+ if (_lodash.default.isNil(splitLists)) {
977
+ continue;
978
+ }
979
+ var size = split_all_size[j];
980
+ cumColumnWidth = 0;
981
+ for (var c = splitLists.length - 1; c >= 0; c -= 1) {
982
+ var wordGroup = splitLists[c];
983
+ var left = void 0;
984
+ var top_2 = void 0;
985
+ if (rt !== 0) {
986
+ var y = cumWordHeight + size.asc;
987
+ var x = cumWordHeight / Math.tan(rtPI) - cumColumnWidth + textW_all_inner;
988
+ if (horizonAlign === "0") {
989
+ if (verticalAlign === "0") {
990
+ left = x + cellWidth / 2 - textW_all / 2 + lastLineSpaceHeight * Math.cos(rtPI) / 2;
991
+ top_2 = y + cellHeight / 2 - textH_all / 2 - lastLineSpaceHeight * Math.cos(rtPI) / 2;
992
+ } else if (verticalAlign === "1") {
993
+ left = x + cellWidth / 2 - textW_all / 2;
994
+ top_2 = y - (textH_all / 2 - rh / 2);
995
+ } else if (verticalAlign === "2") {
996
+ left = x + cellWidth / 2 - textW_all / 2 + lastLineSpaceHeight * Math.cos(rtPI);
997
+ top_2 = y + cellHeight - rh / 2 - textH_all / 2 - lastLineSpaceHeight * Math.cos(rtPI);
998
+ }
999
+ } else if (horizonAlign === "1") {
1000
+ if (verticalAlign === "0") {
1001
+ left = x - rh * Math.sin(rtPI) / 2 + lastLineSpaceHeight * Math.cos(rtPI) / 2;
1002
+ top_2 = y + cellHeight / 2 + rh * Math.cos(rtPI) / 2 - lastLineSpaceHeight * Math.cos(rtPI) / 2;
1003
+ } else if (verticalAlign === "1") {
1004
+ left = x - rh * Math.sin(rtPI);
1005
+ top_2 = y + rh * Math.cos(rtPI);
1006
+ } else if (verticalAlign === "2") {
1007
+ left = x + lastLineSpaceHeight * Math.cos(rtPI);
1008
+ top_2 = y + cellHeight - lastLineSpaceHeight * Math.cos(rtPI);
1009
+ }
1010
+ } else if (horizonAlign === "2") {
1011
+ if (verticalAlign === "0") {
1012
+ left = x + cellWidth - rw / 2 - (textW_all_inner / 2 + textH_all / 2 / Math.tan(rtPI)) + lastLineSpaceHeight * Math.cos(rtPI) / 2;
1013
+ top_2 = y + cellHeight / 2 - textH_all / 2 - lastLineSpaceHeight * Math.cos(rtPI) / 2;
1014
+ } else if (verticalAlign === "1") {
1015
+ left = x + cellWidth - textW_all + fixOneLineLeft;
1016
+ top_2 = y - textH_all;
1017
+ } else if (verticalAlign === "2") {
1018
+ left = x + cellWidth - rw * Math.cos(rtPI) + lastLineSpaceHeight * Math.cos(rtPI);
1019
+ top_2 = y + cellHeight - rw * Math.sin(rtPI) - lastLineSpaceHeight * Math.cos(rtPI);
1020
+ }
1021
+ }
1022
+ }
1023
+ wordGroup.left = left;
1024
+ wordGroup.top = top_2;
1025
+ drawLineInfo(wordGroup, cancelLine, underLine, {
1026
+ width: wordGroup.width,
1027
+ height: wordGroup.height,
1028
+ left: (left || 0) - wordGroup.width,
1029
+ top: top_2,
1030
+ asc: size.asc,
1031
+ desc: size.desc,
1032
+ fs: wordGroup.fs
1033
+ });
1034
+ textContent.values.push(wordGroup);
1035
+ cumColumnWidth += wordGroup.width;
1036
+ }
1037
+ cumWordHeight += size.height;
1038
+ }
1039
+ } else {
1040
+ for (var j = 0; j < splitLen; j += 1) {
1041
+ var splitLists = text_all_split[j];
1042
+ if (_lodash.default.isNil(splitLists)) {
1043
+ continue;
1044
+ }
1045
+ var size = split_all_size[j];
1046
+ cumColumnWidth = 0;
1047
+ for (var c = 0; c < splitLists.length; c += 1) {
1048
+ var wordGroup = splitLists[c];
1049
+ var left = void 0;
1050
+ var top_3 = void 0;
1051
+ if (rt !== 0) {
1052
+ var y = cumWordHeight + size.asc;
1053
+ var x = (textH_all - cumWordHeight) / Math.tan(rtPI) + cumColumnWidth;
1054
+ if (horizonAlign === "0") {
1055
+ if (verticalAlign === "0") {
1056
+ left = x + cellWidth / 2 - textW_all / 2 - lastLineSpaceHeight * Math.cos(rtPI) / 2;
1057
+ top_3 = y + cellHeight / 2 - textH_all / 2 + lastLineSpaceHeight * Math.cos(rtPI) / 2;
1058
+ } else if (verticalAlign === "1") {
1059
+ left = x + cellWidth / 2 - textW_all / 2 - lastLineSpaceHeight * Math.cos(rtPI) / 2;
1060
+ top_3 = y - (textH_all / 2 - rh / 2) + lastLineSpaceHeight * Math.cos(rtPI) / 2;
1061
+ } else if (verticalAlign === "2") {
1062
+ left = x + cellWidth / 2 - textW_all / 2 - lastLineSpaceHeight * Math.cos(rtPI);
1063
+ top_3 = y + cellHeight - rh / 2 - textH_all / 2 - lastLineSpaceHeight * Math.cos(rtPI);
1064
+ }
1065
+ } else if (horizonAlign === "1") {
1066
+ if (verticalAlign === "0") {
1067
+ left = x - rh * Math.sin(rtPI) / 2 - lastLineSpaceHeight * Math.cos(rtPI) / 2;
1068
+ top_3 = y - textH_all + cellHeight / 2 - rh * Math.cos(rtPI) / 2 - lastLineSpaceHeight * Math.cos(rtPI) / 2;
1069
+ } else if (verticalAlign === "1") {
1070
+ left = x;
1071
+ top_3 = y - textH_all;
1072
+ } else if (verticalAlign === "2") {
1073
+ left = x - rh * Math.sin(rtPI) - lastLineSpaceHeight * Math.cos(rtPI);
1074
+ top_3 = y - textH_all + cellHeight - rh * Math.cos(rtPI) - lastLineSpaceHeight * Math.cos(rtPI);
1075
+ }
1076
+ } else if (horizonAlign === "2") {
1077
+ if (verticalAlign === "0") {
1078
+ left = x + cellWidth - rw / 2 - textW_all / 2 - lastLineSpaceHeight * Math.cos(rtPI) / 2;
1079
+ top_3 = y + cellHeight / 2 - textH_all / 2 - lastLineSpaceHeight * Math.cos(rtPI) / 2;
1080
+ } else if (verticalAlign === "1") {
1081
+ left = x + cellWidth - rw * Math.cos(rtPI);
1082
+ top_3 = y + rh * Math.cos(rtPI);
1083
+ } else if (verticalAlign === "2") {
1084
+ left = x + cellWidth - textW_all - lastLineSpaceHeight * Math.cos(rtPI) + fixOneLineLeft;
1085
+ top_3 = y + cellHeight - lastLineSpaceHeight * Math.cos(rtPI);
1086
+ }
1087
+ }
1088
+ drawLineInfo(wordGroup, cancelLine, underLine, {
1089
+ width: wordGroup.width,
1090
+ height: wordGroup.height,
1091
+ left: left,
1092
+ top: top_3,
1093
+ asc: size.asc,
1094
+ desc: size.desc,
1095
+ fs: wordGroup.fs
1096
+ });
1097
+ } else {
1098
+ left = space_width + cumColumnWidth;
1099
+ if (horizonAlign === "0") {
1100
+ left = cellWidth / 2 + cumColumnWidth - size.width / 2;
1101
+ } else if (horizonAlign === "2") {
1102
+ left = cellWidth + cumColumnWidth - size.width;
1103
+ }
1104
+ top_3 = cellHeight - space_height + cumWordHeight + size.asc - textH_all;
1105
+ if (verticalAlign === "0") {
1106
+ top_3 = cellHeight / 2 + cumWordHeight - textH_all / 2 + size.asc;
1107
+ } else if (verticalAlign === "1") {
1108
+ top_3 = space_height + cumWordHeight + size.asc;
1109
+ }
1110
+ drawLineInfo(wordGroup, cancelLine, underLine, {
1111
+ width: wordGroup.width,
1112
+ height: wordGroup.height,
1113
+ left: left,
1114
+ top: top_3,
1115
+ asc: size.asc,
1116
+ desc: size.desc,
1117
+ fs: wordGroup.fs
1118
+ });
1119
+ }
1120
+ wordGroup.left = left;
1121
+ wordGroup.top = top_3;
1122
+ textContent.values.push(wordGroup);
1123
+ cumColumnWidth += wordGroup.width;
1124
+ }
1125
+ cumWordHeight += size.height;
1126
+ }
1127
+ }
1128
+ textContent.type = "plainWrap";
1129
+ if (rt !== 0) {
1130
+ if (horizonAlign === "0") {
1131
+ textContent.textLeftAll = cellWidth / 2;
1132
+ if (verticalAlign === "0") {
1133
+ textContent.textTopAll = cellHeight / 2;
1134
+ } else if (verticalAlign === "1") {
1135
+ textContent.textTopAll = rh / 2;
1136
+ } else if (verticalAlign === "2") {
1137
+ textContent.textTopAll = cellHeight - rh / 2;
1138
+ }
1139
+ } else if (horizonAlign === "1") {
1140
+ if (verticalAlign === "0") {
1141
+ textContent.textLeftAll = 0;
1142
+ textContent.textTopAll = cellHeight / 2;
1143
+ } else if (verticalAlign === "1") {
1144
+ textContent.textLeftAll = 0;
1145
+ textContent.textTopAll = 0;
1146
+ } else if (verticalAlign === "2") {
1147
+ textContent.textLeftAll = 0;
1148
+ textContent.textTopAll = cellHeight;
1149
+ }
1150
+ } else if (horizonAlign === "2") {
1151
+ if (verticalAlign === "0") {
1152
+ textContent.textLeftAll = cellWidth - rw / 2;
1153
+ textContent.textTopAll = cellHeight / 2;
1154
+ } else if (verticalAlign === "1") {
1155
+ textContent.textLeftAll = cellWidth;
1156
+ textContent.textTopAll = 0;
1157
+ } else if (verticalAlign === "2") {
1158
+ textContent.textLeftAll = cellWidth;
1159
+ textContent.textTopAll = cellHeight;
1160
+ }
1161
+ }
1162
+ }
1163
+ } else {
1164
+ var measureText = getMeasureText(value, renderCtx, sheetCtx);
1165
+ var textWidth = measureText.width;
1166
+ var textHeight = measureText.actualBoundingBoxDescent + measureText.actualBoundingBoxAscent;
1167
+ textContent.rotate = rt;
1168
+ rt = Math.abs(rt);
1169
+ var rtPI = rt * Math.PI / 180;
1170
+ var textWidthAll = textWidth * Math.cos(rtPI) + textHeight * Math.sin(rtPI);
1171
+ var textHeightAll = textWidth * Math.sin(rtPI) + textHeight * Math.cos(rtPI);
1172
+ if (rt !== 0) {
1173
+ textContent.textHeightAll = textHeightAll;
1174
+ } else {
1175
+ textContent.textHeightAll = textHeightAll + textHeight / 2 - measureText.actualBoundingBoxDescent - space_height;
1176
+ }
1177
+ textContent.textWidthAll = textWidthAll;
1178
+ if (isMode === "onlyWidth") {
1179
+ return textContent;
1180
+ }
1181
+ var width = textWidthAll;
1182
+ var height = textHeightAll;
1183
+ var left = space_width + textHeight * Math.sin(rtPI) * isRotateUp;
1184
+ if (horizonAlign === "0") {
1185
+ left = cellWidth / 2 - width / 2 + textHeight * Math.sin(rtPI) * isRotateUp;
1186
+ } else if (horizonAlign === "2") {
1187
+ left = cellWidth - space_width - width + textHeight * Math.sin(rtPI) * isRotateUp;
1188
+ }
1189
+ var top_4 = cellHeight - space_height - height + measureText.actualBoundingBoxAscent * Math.cos(rtPI) + textWidth * Math.sin(rtPI) * isRotateUp;
1190
+ if (verticalAlign === "0") {
1191
+ top_4 = cellHeight / 2 - height / 2 + measureText.actualBoundingBoxAscent * Math.cos(rtPI) + textWidth * Math.sin(rtPI) * isRotateUp;
1192
+ } else if (verticalAlign === "1") {
1193
+ top_4 = space_height + measureText.actualBoundingBoxAscent * Math.cos(rtPI) + textWidth * Math.sin(rtPI) * isRotateUp;
1194
+ }
1195
+ textContent.type = "plain";
1196
+ var wordGroup = {
1197
+ content: value,
1198
+ style: fontset,
1199
+ width: width,
1200
+ height: height,
1201
+ left: left,
1202
+ top: top_4
1203
+ };
1204
+ drawLineInfo(wordGroup, cancelLine, underLine, {
1205
+ width: textWidth,
1206
+ height: textHeight,
1207
+ left: left,
1208
+ top: top_4,
1209
+ asc: measureText.actualBoundingBoxAscent,
1210
+ desc: measureText.actualBoundingBoxDescent,
1211
+ fs: fontSize
1212
+ });
1213
+ textContent.values.push(wordGroup);
1214
+ textContent.textLeftAll = left;
1215
+ textContent.textTopAll = top_4;
1216
+ textContent.asc = measureText.actualBoundingBoxAscent;
1217
+ textContent.desc = measureText.actualBoundingBoxDescent;
1218
+ }
1219
+ }
1220
+ return textContent;
1221
+ }