@fileverse-dev/fortune-core 1.0.26 → 2.0.0

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/index.esm.js +80254 -0
  2. package/dist/index.js +80600 -0
  3. package/{es → dist/packages/core/src}/api/cell.d.ts +10 -10
  4. package/{lib → dist/packages/core/src}/api/common.d.ts +66 -71
  5. package/{es → dist/packages/core/src}/api/errors.d.ts +2 -2
  6. package/{es → dist/packages/core/src}/api/index.d.ts +9 -9
  7. package/{es → dist/packages/core/src}/api/merge.d.ts +5 -5
  8. package/{lib → dist/packages/core/src}/api/range.d.ts +22 -22
  9. package/{lib → dist/packages/core/src}/api/rowcol.d.ts +14 -14
  10. package/{lib → dist/packages/core/src}/api/sheet.d.ts +10 -10
  11. package/{lib → dist/packages/core/src}/api/workbook.d.ts +15 -15
  12. package/{lib → dist/packages/core/src}/canvas.d.ts +46 -46
  13. package/{es → dist/packages/core/src}/context.d.ts +197 -198
  14. package/{es → dist/packages/core/src}/events/copy.d.ts +2 -2
  15. package/{lib → dist/packages/core/src}/events/index.d.ts +4 -4
  16. package/{lib → dist/packages/core/src}/events/keyboard.d.ts +6 -6
  17. package/{es → dist/packages/core/src}/events/mouse.d.ts +22 -22
  18. package/{es → dist/packages/core/src}/events/paste.d.ts +3 -3
  19. package/{lib → dist/packages/core/src}/index.d.ts +10 -10
  20. package/{lib → dist/packages/core/src}/locale/en.d.ts +992 -992
  21. package/{lib → dist/packages/core/src}/locale/es.d.ts +1134 -1134
  22. package/{lib → dist/packages/core/src}/locale/hi.d.ts +1030 -1030
  23. package/{lib → dist/packages/core/src}/locale/index.d.ts +1049 -1049
  24. package/{es → dist/packages/core/src}/locale/zh.d.ts +1048 -1048
  25. package/{lib → dist/packages/core/src}/locale/zh_tw.d.ts +1187 -1187
  26. package/{lib → dist/packages/core/src}/modules/ConditionFormat.d.ts +17 -17
  27. package/{lib → dist/packages/core/src}/modules/border.d.ts +3 -3
  28. package/{lib → dist/packages/core/src}/modules/cell.d.ts +32 -32
  29. package/{es → dist/packages/core/src}/modules/clipboard.d.ts +3 -3
  30. package/{es → dist/packages/core/src}/modules/color.d.ts +1 -1
  31. package/{lib → dist/packages/core/src}/modules/comment.d.ts +97 -97
  32. package/{es → dist/packages/core/src}/modules/conditionalFormat.d.ts +2 -2
  33. package/{es → dist/packages/core/src}/modules/cursor.d.ts +3 -3
  34. package/{es → dist/packages/core/src}/modules/dataVerification.d.ts +11 -11
  35. package/{es → dist/packages/core/src}/modules/dropCell.d.ts +10 -10
  36. package/{lib → dist/packages/core/src}/modules/filter.d.ts +45 -45
  37. package/{es → dist/packages/core/src}/modules/format.d.ts +6 -6
  38. package/{lib → dist/packages/core/src}/modules/formula.d.ts +54 -54
  39. package/{es → dist/packages/core/src}/modules/freeze.d.ts +5 -5
  40. package/{es → dist/packages/core/src}/modules/hyperlink.d.ts +21 -21
  41. package/{lib → dist/packages/core/src}/modules/iframe.d.ts +12 -12
  42. package/{es → dist/packages/core/src}/modules/image.d.ts +31 -31
  43. package/{es → dist/packages/core/src}/modules/index.d.ts +36 -36
  44. package/{lib → dist/packages/core/src}/modules/inline-string.d.ts +36 -36
  45. package/{es → dist/packages/core/src}/modules/location.d.ts +6 -6
  46. package/{es → dist/packages/core/src}/modules/locationCondition.d.ts +21 -21
  47. package/{es → dist/packages/core/src}/modules/merge.d.ts +3 -3
  48. package/{es → dist/packages/core/src}/modules/mobile.d.ts +5 -5
  49. package/{lib → dist/packages/core/src}/modules/moveCells.d.ts +5 -5
  50. package/{lib → dist/packages/core/src}/modules/protection.d.ts +5 -5
  51. package/{lib → dist/packages/core/src}/modules/refresh.d.ts +3 -3
  52. package/{es → dist/packages/core/src}/modules/rowcol.d.ts +19 -19
  53. package/{lib → dist/packages/core/src}/modules/screenshot.d.ts +2 -2
  54. package/{es → dist/packages/core/src}/modules/searchReplace.d.ts +36 -36
  55. package/{lib → dist/packages/core/src}/modules/selection.d.ts +46 -46
  56. package/{es → dist/packages/core/src}/modules/sheet.d.ts +10 -10
  57. package/{es → dist/packages/core/src}/modules/sort.d.ts +7 -7
  58. package/{es → dist/packages/core/src}/modules/splitColumn.d.ts +5 -5
  59. package/{es → dist/packages/core/src}/modules/text.d.ts +10 -10
  60. package/{lib → dist/packages/core/src}/modules/toolbar.d.ts +32 -32
  61. package/{es → dist/packages/core/src}/modules/validation.d.ts +19 -19
  62. package/{es → dist/packages/core/src}/modules/zoom.d.ts +3 -3
  63. package/{es → dist/packages/core/src}/settings.d.ts +100 -100
  64. package/{es → dist/packages/core/src}/types.d.ts +371 -376
  65. package/{es → dist/packages/core/src}/utils/freeze.d.ts +7 -7
  66. package/{es → dist/packages/core/src}/utils/index.d.ts +18 -19
  67. package/{lib → dist/packages/core/src}/utils/patch.d.ts +37 -37
  68. package/dist/packages/react/src/components/ChangeColor/index.d.ts +7 -0
  69. package/dist/packages/react/src/components/ConditionFormat/ConditionRules.d.ts +6 -0
  70. package/dist/packages/react/src/components/ConditionFormat/index.d.ts +7 -0
  71. package/dist/packages/react/src/components/ContextMenu/Divider.d.ts +3 -0
  72. package/dist/packages/react/src/components/ContextMenu/FilterMenu.d.ts +3 -0
  73. package/dist/packages/react/src/components/ContextMenu/Menu.d.ts +8 -0
  74. package/dist/packages/react/src/components/ContextMenu/SheetTab.d.ts +4 -0
  75. package/dist/packages/react/src/components/ContextMenu/index.d.ts +5 -0
  76. package/dist/packages/react/src/components/CustomSort/index.d.ts +4 -0
  77. package/dist/packages/react/src/components/DataVerification/DropdownList.d.ts +4 -0
  78. package/dist/packages/react/src/components/DataVerification/RangeDialog.d.ts +4 -0
  79. package/dist/packages/react/src/components/DataVerification/getDisplayedRangeTxt.d.ts +2 -0
  80. package/dist/packages/react/src/components/DataVerification/index.d.ts +4 -0
  81. package/dist/packages/react/src/components/Dialog/index.d.ts +15 -0
  82. package/dist/packages/react/src/components/DuneChartsInputModal/DuneChartsInputModal.d.ts +11 -0
  83. package/dist/packages/react/src/components/DunePreview/DunePreview.d.ts +13 -0
  84. package/dist/packages/react/src/components/FilterOption/index.d.ts +5 -0
  85. package/dist/packages/react/src/components/FormatSearch/index.d.ts +6 -0
  86. package/dist/packages/react/src/components/FormulaSearch/index.d.ts +5 -0
  87. package/dist/packages/react/src/components/FxEditor/NameBox.d.ts +3 -0
  88. package/dist/packages/react/src/components/FxEditor/index.d.ts +4 -0
  89. package/dist/packages/react/src/components/IFrameBoxs/iFrameBoxs.d.ts +4 -0
  90. package/dist/packages/react/src/components/ImgBoxs/index.d.ts +3 -0
  91. package/dist/packages/react/src/components/LinkEidtCard/index.d.ts +5 -0
  92. package/dist/packages/react/src/components/LocationCondition/index.d.ts +3 -0
  93. package/dist/packages/react/src/components/MessageBox/index.d.ts +9 -0
  94. package/dist/packages/react/src/components/NotationBoxes/index.d.ts +3 -0
  95. package/dist/packages/react/src/components/ResetColumnWidth/index.d.ts +2 -0
  96. package/dist/packages/react/src/components/SVGDefines.d.ts +5 -0
  97. package/dist/packages/react/src/components/SVGIcon.d.ts +9 -0
  98. package/dist/packages/react/src/components/SearchReplace/index.d.ts +6 -0
  99. package/dist/packages/react/src/components/Sheet/index.d.ts +8 -0
  100. package/dist/packages/react/src/components/SheetList/SheetHiddenButton.d.ts +8 -0
  101. package/dist/packages/react/src/components/SheetList/SheetListItem.d.ts +9 -0
  102. package/dist/packages/react/src/components/SheetList/index.d.ts +4 -0
  103. package/dist/packages/react/src/components/SheetOverlay/ColumnHeader.d.ts +3 -0
  104. package/dist/packages/react/src/components/SheetOverlay/ContentEditable.d.ts +11 -0
  105. package/dist/packages/react/src/components/SheetOverlay/FormulaHint/index.d.ts +4 -0
  106. package/dist/packages/react/src/components/SheetOverlay/FormulaSearch/constant.d.ts +63 -0
  107. package/dist/packages/react/src/components/SheetOverlay/FormulaSearch/index.d.ts +4 -0
  108. package/dist/packages/react/src/components/SheetOverlay/InputBox.d.ts +3 -0
  109. package/dist/packages/react/src/components/SheetOverlay/RowHeader.d.ts +3 -0
  110. package/dist/packages/react/src/components/SheetOverlay/ScrollBar/index.d.ts +7 -0
  111. package/dist/packages/react/src/components/SheetOverlay/index.d.ts +4 -0
  112. package/dist/packages/react/src/components/SheetTab/SheetItem.d.ts +8 -0
  113. package/dist/packages/react/src/components/SheetTab/index.d.ts +4 -0
  114. package/dist/packages/react/src/components/SplitColumn/index.d.ts +3 -0
  115. package/dist/packages/react/src/components/Toolbar/Button.d.ts +12 -0
  116. package/dist/packages/react/src/components/Toolbar/ColorPicker.d.ts +6 -0
  117. package/dist/packages/react/src/components/Toolbar/Combo.d.ts +12 -0
  118. package/dist/packages/react/src/components/Toolbar/CustomBorder.d.ts +7 -0
  119. package/dist/packages/react/src/components/Toolbar/CustomButton.d.ts +11 -0
  120. package/dist/packages/react/src/components/Toolbar/CustomColor.d.ts +8 -0
  121. package/dist/packages/react/src/components/Toolbar/CustomIcon.d.ts +9 -0
  122. package/dist/packages/react/src/components/Toolbar/Divider.d.ts +4 -0
  123. package/dist/packages/react/src/components/Toolbar/MoreItemsContainer.d.ts +6 -0
  124. package/dist/packages/react/src/components/Toolbar/Select.d.ts +14 -0
  125. package/dist/packages/react/src/components/Toolbar/index.d.ts +10 -0
  126. package/dist/packages/react/src/components/Workbook/api.d.ts +1177 -0
  127. package/dist/packages/react/src/components/Workbook/index.d.ts +1185 -0
  128. package/dist/packages/react/src/components/ZoomControl/index.d.ts +4 -0
  129. package/dist/packages/react/src/components/index.d.ts +4 -0
  130. package/dist/packages/react/src/constants.d.ts +1 -0
  131. package/dist/packages/react/src/context/index.d.ts +25 -0
  132. package/dist/packages/react/src/context/modal.d.ts +10 -0
  133. package/dist/packages/react/src/hooks/useAlert.d.ts +4 -0
  134. package/dist/packages/react/src/hooks/useDialog.d.ts +5 -0
  135. package/dist/packages/react/src/hooks/useOutsideClick.d.ts +2 -0
  136. package/dist/packages/react/src/hooks/usePrevious.d.ts +2 -0
  137. package/dist/packages/react/src/index.d.ts +1 -0
  138. package/dist/packages/react/src/utils/datepickerStyles.d.ts +2 -0
  139. package/dist/stories/API.stories.d.ts +1210 -0
  140. package/dist/stories/Collabration.stories.d.ts +2359 -0
  141. package/dist/stories/Features.stories.d.ts +9430 -0
  142. package/dist/stories/data/cell.d.ts +983 -0
  143. package/dist/stories/data/dataVerification.d.ts +131 -0
  144. package/dist/stories/data/empty.d.ts +10 -0
  145. package/dist/stories/data/formula.d.ts +362 -0
  146. package/dist/stories/data/freeze.d.ts +34 -0
  147. package/dist/stories/data/protected.d.ts +40 -0
  148. package/dist/stories/utils.d.ts +1 -0
  149. package/package.json +6 -7
  150. package/es/api/cell.js +0 -204
  151. package/es/api/common.d.ts +0 -71
  152. package/es/api/common.js +0 -79
  153. package/es/api/errors.js +0 -2
  154. package/es/api/index.js +0 -8
  155. package/es/api/merge.js +0 -15
  156. package/es/api/range.d.ts +0 -22
  157. package/es/api/range.js +0 -123
  158. package/es/api/rowcol.d.ts +0 -14
  159. package/es/api/rowcol.js +0 -207
  160. package/es/api/sheet.d.ts +0 -10
  161. package/es/api/sheet.js +0 -128
  162. package/es/api/workbook.d.ts +0 -15
  163. package/es/api/workbook.js +0 -85
  164. package/es/canvas.d.ts +0 -46
  165. package/es/canvas.js +0 -1350
  166. package/es/context.js +0 -381
  167. package/es/events/copy.js +0 -78
  168. package/es/events/index.d.ts +0 -4
  169. package/es/events/index.js +0 -4
  170. package/es/events/keyboard.d.ts +0 -6
  171. package/es/events/keyboard.js +0 -332
  172. package/es/events/mouse.js +0 -1725
  173. package/es/events/paste.js +0 -1378
  174. package/es/index.d.ts +0 -10
  175. package/es/index.js +0 -10
  176. package/es/locale/en.d.ts +0 -992
  177. package/es/locale/en.js +0 -10564
  178. package/es/locale/es.d.ts +0 -1134
  179. package/es/locale/es.js +0 -10010
  180. package/es/locale/hi.d.ts +0 -1030
  181. package/es/locale/hi.js +0 -10550
  182. package/es/locale/index.d.ts +0 -1049
  183. package/es/locale/index.js +0 -23
  184. package/es/locale/zh.js +0 -10568
  185. package/es/locale/zh_tw.d.ts +0 -1187
  186. package/es/locale/zh_tw.js +0 -10072
  187. package/es/modules/ConditionFormat.d.ts +0 -17
  188. package/es/modules/ConditionFormat.js +0 -1258
  189. package/es/modules/border.d.ts +0 -3
  190. package/es/modules/border.js +0 -1240
  191. package/es/modules/cell.d.ts +0 -32
  192. package/es/modules/cell.js +0 -1055
  193. package/es/modules/clipboard.js +0 -36
  194. package/es/modules/color.js +0 -1
  195. package/es/modules/comment.d.ts +0 -97
  196. package/es/modules/comment.js +0 -597
  197. package/es/modules/conditionalFormat.js +0 -441
  198. package/es/modules/cursor.js +0 -62
  199. package/es/modules/dataVerification.js +0 -701
  200. package/es/modules/dropCell.js +0 -2267
  201. package/es/modules/filter.d.ts +0 -45
  202. package/es/modules/filter.js +0 -434
  203. package/es/modules/format.js +0 -323
  204. package/es/modules/formula.d.ts +0 -54
  205. package/es/modules/formula.js +0 -2301
  206. package/es/modules/freeze.js +0 -148
  207. package/es/modules/hyperlink.js +0 -216
  208. package/es/modules/iframe.d.ts +0 -12
  209. package/es/modules/iframe.js +0 -220
  210. package/es/modules/image.js +0 -253
  211. package/es/modules/index.js +0 -36
  212. package/es/modules/inline-string.d.ts +0 -36
  213. package/es/modules/inline-string.js +0 -437
  214. package/es/modules/location.js +0 -46
  215. package/es/modules/locationCondition.js +0 -218
  216. package/es/modules/merge.js +0 -216
  217. package/es/modules/mobile.js +0 -33
  218. package/es/modules/moveCells.d.ts +0 -5
  219. package/es/modules/moveCells.js +0 -348
  220. package/es/modules/protection.d.ts +0 -5
  221. package/es/modules/protection.js +0 -96
  222. package/es/modules/refresh.d.ts +0 -3
  223. package/es/modules/refresh.js +0 -34
  224. package/es/modules/rowcol.js +0 -1922
  225. package/es/modules/screenshot.d.ts +0 -2
  226. package/es/modules/screenshot.js +0 -90
  227. package/es/modules/searchReplace.js +0 -388
  228. package/es/modules/selection.d.ts +0 -46
  229. package/es/modules/selection.js +0 -1674
  230. package/es/modules/sheet.js +0 -237
  231. package/es/modules/sort.js +0 -134
  232. package/es/modules/splitColumn.js +0 -126
  233. package/es/modules/ssf.js +0 -1533
  234. package/es/modules/text.js +0 -1207
  235. package/es/modules/toolbar.d.ts +0 -32
  236. package/es/modules/toolbar.js +0 -970
  237. package/es/modules/validation.js +0 -190
  238. package/es/modules/zoom.js +0 -29
  239. package/es/settings.js +0 -36
  240. package/es/types.js +0 -1
  241. package/es/utils/freeze.js +0 -86
  242. package/es/utils/index.js +0 -198
  243. package/es/utils/patch.d.ts +0 -37
  244. package/es/utils/patch.js +0 -381
  245. package/lib/api/cell.d.ts +0 -10
  246. package/lib/api/cell.js +0 -215
  247. package/lib/api/common.js +0 -88
  248. package/lib/api/errors.d.ts +0 -2
  249. package/lib/api/errors.js +0 -8
  250. package/lib/api/index.d.ts +0 -9
  251. package/lib/api/index.js +0 -101
  252. package/lib/api/merge.d.ts +0 -5
  253. package/lib/api/merge.js +0 -22
  254. package/lib/api/range.js +0 -138
  255. package/lib/api/rowcol.js +0 -222
  256. package/lib/api/sheet.js +0 -145
  257. package/lib/api/workbook.js +0 -98
  258. package/lib/canvas.js +0 -1356
  259. package/lib/context.d.ts +0 -198
  260. package/lib/context.js +0 -393
  261. package/lib/events/copy.d.ts +0 -2
  262. package/lib/events/copy.js +0 -85
  263. package/lib/events/index.js +0 -49
  264. package/lib/events/keyboard.js +0 -342
  265. package/lib/events/mouse.d.ts +0 -22
  266. package/lib/events/mouse.js +0 -1744
  267. package/lib/events/paste.d.ts +0 -3
  268. package/lib/events/paste.js +0 -1386
  269. package/lib/index.js +0 -109
  270. package/lib/locale/en.js +0 -10570
  271. package/lib/locale/es.js +0 -10016
  272. package/lib/locale/hi.js +0 -10556
  273. package/lib/locale/index.js +0 -29
  274. package/lib/locale/zh.d.ts +0 -1048
  275. package/lib/locale/zh.js +0 -10574
  276. package/lib/locale/zh_tw.js +0 -10078
  277. package/lib/modules/ConditionFormat.js +0 -1273
  278. package/lib/modules/border.js +0 -1248
  279. package/lib/modules/cell.js +0 -1085
  280. package/lib/modules/clipboard.d.ts +0 -3
  281. package/lib/modules/clipboard.js +0 -42
  282. package/lib/modules/color.d.ts +0 -1
  283. package/lib/modules/color.js +0 -7
  284. package/lib/modules/comment.js +0 -625
  285. package/lib/modules/conditionalFormat.d.ts +0 -2
  286. package/lib/modules/conditionalFormat.js +0 -447
  287. package/lib/modules/cursor.d.ts +0 -3
  288. package/lib/modules/cursor.js +0 -70
  289. package/lib/modules/dataVerification.d.ts +0 -11
  290. package/lib/modules/dataVerification.js +0 -716
  291. package/lib/modules/dropCell.d.ts +0 -10
  292. package/lib/modules/dropCell.js +0 -2283
  293. package/lib/modules/filter.js +0 -448
  294. package/lib/modules/format.d.ts +0 -6
  295. package/lib/modules/format.js +0 -334
  296. package/lib/modules/formula.js +0 -2330
  297. package/lib/modules/freeze.d.ts +0 -5
  298. package/lib/modules/freeze.js +0 -158
  299. package/lib/modules/hyperlink.d.ts +0 -21
  300. package/lib/modules/hyperlink.js +0 -232
  301. package/lib/modules/iframe.js +0 -236
  302. package/lib/modules/image.d.ts +0 -31
  303. package/lib/modules/image.js +0 -272
  304. package/lib/modules/index.d.ts +0 -36
  305. package/lib/modules/index.js +0 -401
  306. package/lib/modules/inline-string.js +0 -452
  307. package/lib/modules/location.d.ts +0 -6
  308. package/lib/modules/location.js +0 -57
  309. package/lib/modules/locationCondition.d.ts +0 -21
  310. package/lib/modules/locationCondition.js +0 -229
  311. package/lib/modules/merge.d.ts +0 -3
  312. package/lib/modules/merge.js +0 -223
  313. package/lib/modules/mobile.d.ts +0 -5
  314. package/lib/modules/mobile.js +0 -41
  315. package/lib/modules/moveCells.js +0 -357
  316. package/lib/modules/protection.js +0 -106
  317. package/lib/modules/refresh.js +0 -40
  318. package/lib/modules/rowcol.d.ts +0 -19
  319. package/lib/modules/rowcol.js +0 -1935
  320. package/lib/modules/screenshot.js +0 -96
  321. package/lib/modules/searchReplace.d.ts +0 -36
  322. package/lib/modules/searchReplace.js +0 -402
  323. package/lib/modules/selection.js +0 -1703
  324. package/lib/modules/sheet.d.ts +0 -10
  325. package/lib/modules/sheet.js +0 -250
  326. package/lib/modules/sort.d.ts +0 -7
  327. package/lib/modules/sort.js +0 -143
  328. package/lib/modules/splitColumn.d.ts +0 -5
  329. package/lib/modules/splitColumn.js +0 -136
  330. package/lib/modules/ssf.js +0 -1539
  331. package/lib/modules/text.d.ts +0 -10
  332. package/lib/modules/text.js +0 -1221
  333. package/lib/modules/toolbar.js +0 -1003
  334. package/lib/modules/validation.d.ts +0 -19
  335. package/lib/modules/validation.js +0 -205
  336. package/lib/modules/zoom.d.ts +0 -3
  337. package/lib/modules/zoom.js +0 -36
  338. package/lib/settings.d.ts +0 -100
  339. package/lib/settings.js +0 -42
  340. package/lib/types.d.ts +0 -376
  341. package/lib/types.js +0 -5
  342. package/lib/utils/freeze.d.ts +0 -7
  343. package/lib/utils/freeze.js +0 -92
  344. package/lib/utils/index.d.ts +0 -19
  345. package/lib/utils/index.js +0 -258
  346. package/lib/utils/patch.js +0 -392
@@ -1,1221 +0,0 @@
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
- }