@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,625 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.commentBoxProps = void 0;
7
+ exports.deleteComment = deleteComment;
8
+ exports.drawArrow = drawArrow;
9
+ exports.editComment = editComment;
10
+ exports.getArrowCanvasSize = getArrowCanvasSize;
11
+ exports.getCellTopRightPostion = getCellTopRightPostion;
12
+ exports.getCommentBoxByRC = getCommentBoxByRC;
13
+ exports.getCommentBoxPosition = getCommentBoxPosition;
14
+ exports.newComment = newComment;
15
+ exports.onCommentBoxMove = onCommentBoxMove;
16
+ exports.onCommentBoxMoveEnd = onCommentBoxMoveEnd;
17
+ exports.onCommentBoxMoveStart = onCommentBoxMoveStart;
18
+ exports.onCommentBoxResize = onCommentBoxResize;
19
+ exports.onCommentBoxResizeEnd = onCommentBoxResizeEnd;
20
+ exports.onCommentBoxResizeStart = onCommentBoxResizeStart;
21
+ exports.overShowComment = overShowComment;
22
+ exports.removeEditingComment = removeEditingComment;
23
+ exports.removeOverShowComment = removeOverShowComment;
24
+ exports.setEditingComment = setEditingComment;
25
+ exports.showComments = showComments;
26
+ exports.showHideAllComments = showHideAllComments;
27
+ exports.showHideComment = showHideComment;
28
+ var _lodash = _interopRequireDefault(require("lodash"));
29
+ var _cell = require("./cell");
30
+ var _context = require("../context");
31
+ var _location = require("./location");
32
+ var _utils = require("../utils");
33
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
34
+ var __assign = void 0 && (void 0).__assign || function () {
35
+ __assign = Object.assign || function (t) {
36
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
37
+ s = arguments[i];
38
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
39
+ }
40
+ return t;
41
+ };
42
+ return __assign.apply(this, arguments);
43
+ };
44
+ function getArrowCanvasSize(fromX, fromY, toX, toY) {
45
+ var left = toX - 5;
46
+ if (fromX < toX) {
47
+ left = fromX - 5;
48
+ }
49
+ var top = toY - 5;
50
+ if (fromY < toY) {
51
+ top = fromY - 5;
52
+ }
53
+ var width = Math.abs(fromX - toX) + 10;
54
+ var height = Math.abs(fromY - toY) + 10;
55
+ var x1 = width - 5;
56
+ var x2 = 5;
57
+ if (fromX < toX) {
58
+ x1 = 5;
59
+ x2 = width - 5;
60
+ }
61
+ var y1 = height - 5;
62
+ var y2 = 5;
63
+ if (fromY < toY) {
64
+ y1 = 5;
65
+ y2 = height - 5;
66
+ }
67
+ return {
68
+ left: left,
69
+ top: top,
70
+ width: width,
71
+ height: height,
72
+ fromX: x1,
73
+ fromY: y1,
74
+ toX: x2,
75
+ toY: y2
76
+ };
77
+ }
78
+ function drawArrow(rc, _a, color, theta, headlen) {
79
+ var left = _a.left,
80
+ top = _a.top,
81
+ width = _a.width,
82
+ height = _a.height,
83
+ fromX = _a.fromX,
84
+ fromY = _a.fromY,
85
+ toX = _a.toX,
86
+ toY = _a.toY;
87
+ if (rc) return;
88
+ var canvas = document.getElementById("arrowCanvas-".concat(rc));
89
+ var ctx = canvas.getContext("2d");
90
+ if (!canvas || !ctx) return;
91
+ canvas.style.width = "".concat(width, "px");
92
+ canvas.style.height = "".concat(height, "px");
93
+ canvas.width = width;
94
+ canvas.height = height;
95
+ canvas.style.left = "".concat(left, "px");
96
+ canvas.style.top = "".concat(top, "px");
97
+ var _b = canvas.getBoundingClientRect(),
98
+ canvasWidth = _b.width,
99
+ canvasHeight = _b.height;
100
+ ctx.clearRect(0, 0, canvasWidth, canvasHeight);
101
+ theta = theta || 30;
102
+ headlen = headlen || 6;
103
+ var arrowWidth = 1;
104
+ color = color || "#000";
105
+ var angle = Math.atan2(fromY - toY, fromX - toX) * 180 / Math.PI;
106
+ var angle1 = (angle + theta) * Math.PI / 180;
107
+ var angle2 = (angle - theta) * Math.PI / 180;
108
+ var topX = headlen * Math.cos(angle1);
109
+ var topY = headlen * Math.sin(angle1);
110
+ var botX = headlen * Math.cos(angle2);
111
+ var botY = headlen * Math.sin(angle2);
112
+ ctx.save();
113
+ ctx.beginPath();
114
+ var arrowX = fromX - topX;
115
+ var arrowY = fromY - topY;
116
+ ctx.moveTo(arrowX, arrowY);
117
+ ctx.moveTo(fromX, fromY);
118
+ ctx.lineTo(toX, toY);
119
+ ctx.lineWidth = arrowWidth;
120
+ ctx.strokeStyle = color;
121
+ ctx.stroke();
122
+ arrowX = toX + topX;
123
+ arrowY = toY + topY;
124
+ ctx.moveTo(arrowX, arrowY);
125
+ ctx.lineTo(toX, toY);
126
+ arrowX = toX + botX;
127
+ arrowY = toY + botY;
128
+ ctx.lineTo(arrowX, arrowY);
129
+ ctx.fillStyle = color;
130
+ ctx.fill();
131
+ ctx.restore();
132
+ }
133
+ var commentBoxProps = exports.commentBoxProps = {
134
+ defaultWidth: 144,
135
+ defaultHeight: 84,
136
+ currentObj: null,
137
+ currentWinW: null,
138
+ currentWinH: null,
139
+ resize: null,
140
+ resizeXY: null,
141
+ move: false,
142
+ moveXY: null,
143
+ cursorStartPosition: null
144
+ };
145
+ function getCellTopRightPostion(ctx, flowdata, r, c) {
146
+ var _a;
147
+ var row_pre = r - 1 === -1 ? 0 : ctx.visibledatarow[r - 1];
148
+ var col = ctx.visibledatacolumn[c];
149
+ var margeset = (0, _cell.mergeBorder)(ctx, flowdata, r, c);
150
+ if (margeset) {
151
+ row_pre = margeset.row[0];
152
+ _a = margeset.column, col = _a[1];
153
+ }
154
+ var toX = col;
155
+ var toY = row_pre;
156
+ return {
157
+ toX: toX,
158
+ toY: toY
159
+ };
160
+ }
161
+ function getCommentBoxByRC(ctx, flowdata, r, c) {
162
+ var _a;
163
+ var comment = (_a = flowdata[r][c]) === null || _a === void 0 ? void 0 : _a.ps;
164
+ var _b = getCellTopRightPostion(ctx, flowdata, r, c),
165
+ toX = _b.toX,
166
+ toY = _b.toY;
167
+ var left = (comment === null || comment === void 0 ? void 0 : comment.left) == null ? toX + 18 * ctx.zoomRatio : comment.left * ctx.zoomRatio;
168
+ var top = (comment === null || comment === void 0 ? void 0 : comment.top) == null ? toY - 18 * ctx.zoomRatio : comment.top * ctx.zoomRatio;
169
+ var width = (comment === null || comment === void 0 ? void 0 : comment.width) == null ? commentBoxProps.defaultWidth * ctx.zoomRatio : comment.width * ctx.zoomRatio;
170
+ var height = (comment === null || comment === void 0 ? void 0 : comment.height) == null ? commentBoxProps.defaultHeight * ctx.zoomRatio : comment.height * ctx.zoomRatio;
171
+ var value = (comment === null || comment === void 0 ? void 0 : comment.value) == null ? "" : comment.value;
172
+ if (top < 0) {
173
+ top = 2;
174
+ }
175
+ var size = getArrowCanvasSize(left, top, toX, toY);
176
+ var rc = "".concat(r, "_").concat(c);
177
+ return {
178
+ r: r,
179
+ c: c,
180
+ rc: rc,
181
+ left: left,
182
+ top: top,
183
+ width: width,
184
+ height: height,
185
+ value: value,
186
+ size: size,
187
+ autoFocus: false
188
+ };
189
+ }
190
+ function setEditingComment(ctx, flowdata, r, c) {
191
+ ctx.editingCommentBox = getCommentBoxByRC(ctx, flowdata, r, c);
192
+ }
193
+ function removeEditingComment(ctx, globalCache) {
194
+ var _a, _b;
195
+ var editingCommentBoxEle = globalCache.editingCommentBoxEle;
196
+ ctx.editingCommentBox = undefined;
197
+ var r = editingCommentBoxEle === null || editingCommentBoxEle === void 0 ? void 0 : editingCommentBoxEle.dataset.r;
198
+ var c = editingCommentBoxEle === null || editingCommentBoxEle === void 0 ? void 0 : editingCommentBoxEle.dataset.c;
199
+ if (!r || !c || !editingCommentBoxEle) return;
200
+ r = parseInt(r, 10);
201
+ c = parseInt(c, 10);
202
+ var value = editingCommentBoxEle.innerHTML || "";
203
+ var flowdata = (0, _context.getFlowdata)(ctx);
204
+ globalCache.editingCommentBoxEle = undefined;
205
+ if (!flowdata) return;
206
+ if (((_b = (_a = ctx.hooks).beforeUpdateComment) === null || _b === void 0 ? void 0 : _b.call(_a, r, c, value)) === false) {
207
+ return;
208
+ }
209
+ var cell = flowdata === null || flowdata === void 0 ? void 0 : flowdata[r][c];
210
+ if (!(cell === null || cell === void 0 ? void 0 : cell.ps)) return;
211
+ var oldValue = cell.ps.value;
212
+ cell.ps.value = value;
213
+ if (!cell.ps.isShow) {
214
+ ctx.commentBoxes = _lodash.default.filter(ctx.commentBoxes, function (v) {
215
+ return v.rc !== "".concat(r, "_").concat(c);
216
+ });
217
+ }
218
+ if (ctx.hooks.afterUpdateComment) {
219
+ setTimeout(function () {
220
+ var _a, _b;
221
+ (_b = (_a = ctx.hooks).afterUpdateComment) === null || _b === void 0 ? void 0 : _b.call(_a, r, c, oldValue, value);
222
+ });
223
+ }
224
+ }
225
+ function newComment(ctx, globalCache, r, c) {
226
+ var _a, _b;
227
+ var allowEdit = (0, _utils.isAllowEdit)(ctx);
228
+ if (!allowEdit) return;
229
+ if (((_b = (_a = ctx.hooks).beforeInsertComment) === null || _b === void 0 ? void 0 : _b.call(_a, r, c)) === false) {
230
+ return;
231
+ }
232
+ if (globalCache) {
233
+ removeEditingComment(ctx, globalCache);
234
+ }
235
+ var flowdata = (0, _context.getFlowdata)(ctx);
236
+ if (!flowdata) return;
237
+ var cell = flowdata[r][c];
238
+ if (cell == null) {
239
+ cell = {};
240
+ flowdata[r][c] = cell;
241
+ }
242
+ cell.ps = {
243
+ left: null,
244
+ top: null,
245
+ width: null,
246
+ height: null,
247
+ value: "",
248
+ isShow: false
249
+ };
250
+ ctx.editingCommentBox = __assign(__assign({}, getCommentBoxByRC(ctx, flowdata, r, c)), {
251
+ autoFocus: true
252
+ });
253
+ if (ctx.hooks.afterInsertComment) {
254
+ setTimeout(function () {
255
+ var _a, _b;
256
+ (_b = (_a = ctx.hooks).afterInsertComment) === null || _b === void 0 ? void 0 : _b.call(_a, r, c);
257
+ });
258
+ }
259
+ }
260
+ function editComment(ctx, globalCache, r, c) {
261
+ var _a;
262
+ var allowEdit = (0, _utils.isAllowEdit)(ctx);
263
+ if (!allowEdit) return;
264
+ var flowdata = (0, _context.getFlowdata)(ctx);
265
+ removeEditingComment(ctx, globalCache);
266
+ var comment = (_a = flowdata === null || flowdata === void 0 ? void 0 : flowdata[r][c]) === null || _a === void 0 ? void 0 : _a.ps;
267
+ var commentBoxes = _lodash.default.concat(ctx.commentBoxes, ctx.editingCommentBox);
268
+ if (_lodash.default.findIndex(commentBoxes, function (v) {
269
+ return (v === null || v === void 0 ? void 0 : v.rc) === "".concat(r, "_").concat(c);
270
+ }) !== -1) {
271
+ var editCommentBox = document.getElementById("comment-editor-".concat(r, "_").concat(c));
272
+ editCommentBox === null || editCommentBox === void 0 ? void 0 : editCommentBox.focus();
273
+ }
274
+ if (comment) {
275
+ ctx.editingCommentBox = __assign(__assign({}, getCommentBoxByRC(ctx, flowdata, r, c)), {
276
+ autoFocus: true
277
+ });
278
+ }
279
+ }
280
+ function deleteComment(ctx, globalCache, r, c) {
281
+ var _a, _b;
282
+ var allowEdit = (0, _utils.isAllowEdit)(ctx);
283
+ if (!allowEdit) return;
284
+ if (((_b = (_a = ctx.hooks).beforeDeleteComment) === null || _b === void 0 ? void 0 : _b.call(_a, r, c)) === false) {
285
+ return;
286
+ }
287
+ var flowdata = (0, _context.getFlowdata)(ctx);
288
+ if (!flowdata) return;
289
+ var cell = flowdata[r][c];
290
+ if (!cell) return;
291
+ cell.ps = undefined;
292
+ if (ctx.hooks.afterDeleteComment) {
293
+ setTimeout(function () {
294
+ var _a, _b;
295
+ (_b = (_a = ctx.hooks).afterDeleteComment) === null || _b === void 0 ? void 0 : _b.call(_a, r, c);
296
+ });
297
+ }
298
+ }
299
+ function showComments(ctx, commentShowCells) {
300
+ var flowdata = (0, _context.getFlowdata)(ctx);
301
+ if (flowdata) {
302
+ var commentBoxes = commentShowCells.map(function (_a) {
303
+ var r = _a.r,
304
+ c = _a.c;
305
+ return getCommentBoxByRC(ctx, flowdata, r, c);
306
+ });
307
+ ctx.commentBoxes = commentBoxes;
308
+ }
309
+ }
310
+ function showHideComment(ctx, globalCache, r, c) {
311
+ var _a;
312
+ var flowdata = (0, _context.getFlowdata)(ctx);
313
+ var comment = (_a = flowdata === null || flowdata === void 0 ? void 0 : flowdata[r][c]) === null || _a === void 0 ? void 0 : _a.ps;
314
+ if (!comment) return;
315
+ var isShow = comment.isShow;
316
+ var rc = "".concat(r, "_").concat(c);
317
+ if (isShow) {
318
+ comment.isShow = false;
319
+ ctx.commentBoxes = _lodash.default.filter(ctx.commentBoxes, function (v) {
320
+ return v.rc !== rc;
321
+ });
322
+ } else {
323
+ comment.isShow = true;
324
+ }
325
+ }
326
+ function showHideAllComments(ctx) {
327
+ var _a, _b;
328
+ var flowdata = (0, _context.getFlowdata)(ctx);
329
+ if (!flowdata) return;
330
+ var isAllShow = true;
331
+ var allComments = [];
332
+ for (var r = 0; r < flowdata.length; r += 1) {
333
+ for (var c = 0; c < flowdata[0].length; c += 1) {
334
+ var cell = flowdata[r][c];
335
+ if (cell === null || cell === void 0 ? void 0 : cell.ps) {
336
+ allComments.push({
337
+ r: r,
338
+ c: c
339
+ });
340
+ if (!cell.ps.isShow) {
341
+ isAllShow = false;
342
+ }
343
+ }
344
+ }
345
+ }
346
+ var rcs = [];
347
+ if (allComments.length > 0) {
348
+ if (isAllShow) {
349
+ for (var i = 0; i < allComments.length; i += 1) {
350
+ var _c = allComments[i],
351
+ r = _c.r,
352
+ c = _c.c;
353
+ var comment = (_a = flowdata[r][c]) === null || _a === void 0 ? void 0 : _a.ps;
354
+ if (comment === null || comment === void 0 ? void 0 : comment.isShow) {
355
+ comment.isShow = false;
356
+ rcs.push("".concat(r, "_").concat(c));
357
+ }
358
+ }
359
+ ctx.commentBoxes = [];
360
+ } else {
361
+ for (var i = 0; i < allComments.length; i += 1) {
362
+ var _d = allComments[i],
363
+ r = _d.r,
364
+ c = _d.c;
365
+ var comment = (_b = flowdata[r][c]) === null || _b === void 0 ? void 0 : _b.ps;
366
+ if (comment && !comment.isShow) {
367
+ comment.isShow = true;
368
+ }
369
+ }
370
+ }
371
+ }
372
+ }
373
+ function removeOverShowComment(ctx) {
374
+ ctx.hoveredCommentBox = undefined;
375
+ }
376
+ function overShowComment(ctx, e, scrollX, scrollY, container) {
377
+ var _a, _b, _c;
378
+ var _d, _e, _f, _g, _h;
379
+ var flowdata = (0, _context.getFlowdata)(ctx);
380
+ if (!flowdata) return;
381
+ var scrollLeft = scrollX.scrollLeft;
382
+ var scrollTop = scrollY.scrollTop;
383
+ var rect = container.getBoundingClientRect();
384
+ var x = e.pageX - rect.left - ctx.rowHeaderWidth;
385
+ var y = e.pageY - rect.top - ctx.columnHeaderHeight;
386
+ var offsetX = 0;
387
+ var offsetY = 0;
388
+ x += scrollLeft;
389
+ y += scrollTop;
390
+ var r = (0, _location.rowLocation)(y, ctx.visibledatarow)[2];
391
+ var c = (0, _location.colLocation)(x, ctx.visibledatacolumn)[2];
392
+ var margeset = (0, _cell.mergeBorder)(ctx, flowdata, r, c);
393
+ if (margeset) {
394
+ _a = margeset.row, r = _a[2];
395
+ _b = margeset.column, c = _b[2];
396
+ }
397
+ var firstSelection = (_d = ctx.luckysheet_select_save) === null || _d === void 0 ? void 0 : _d[0];
398
+ var row_index = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.row_focus;
399
+ var col_index = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.column_focus;
400
+ if (r === row_index && c === col_index) {
401
+ ctx.hoveredCommentBox = undefined;
402
+ return;
403
+ }
404
+ var rc = "".concat(r, "_").concat(c);
405
+ var comment = (_f = (_e = flowdata[r]) === null || _e === void 0 ? void 0 : _e[c]) === null || _f === void 0 ? void 0 : _f.ps;
406
+ if (comment == null || comment.isShow || _lodash.default.findIndex(ctx.commentBoxes, function (v) {
407
+ return v.rc === rc;
408
+ }) !== -1 || ((_g = ctx.editingCommentBox) === null || _g === void 0 ? void 0 : _g.rc) === rc) {
409
+ ctx.hoveredCommentBox = undefined;
410
+ return;
411
+ }
412
+ if (((_h = ctx.hoveredCommentBox) === null || _h === void 0 ? void 0 : _h.rc) === rc) return;
413
+ var row_pre = r - 1 === -1 ? 0 : ctx.visibledatarow[r - 1];
414
+ var col = ctx.visibledatacolumn[c];
415
+ if (margeset) {
416
+ row_pre = margeset.row[0];
417
+ _c = margeset.column, col = _c[1];
418
+ }
419
+ var toX = col + offsetX;
420
+ var toY = row_pre + offsetY;
421
+ var left = comment.left == null ? toX + 18 * ctx.zoomRatio : comment.left * ctx.zoomRatio;
422
+ var top = comment.top == null ? toY - 18 * ctx.zoomRatio : comment.top * ctx.zoomRatio;
423
+ if (top < 0) {
424
+ top = 2;
425
+ }
426
+ var width = comment.width == null ? commentBoxProps.defaultWidth * ctx.zoomRatio : comment.width * ctx.zoomRatio;
427
+ var height = comment.height == null ? commentBoxProps.defaultHeight * ctx.zoomRatio : comment.height * ctx.zoomRatio;
428
+ var size = getArrowCanvasSize(left, top, toX, toY);
429
+ var value = comment.value == null ? "" : comment.value;
430
+ ctx.hoveredCommentBox = {
431
+ r: r,
432
+ c: c,
433
+ rc: rc,
434
+ left: left,
435
+ top: top,
436
+ width: width,
437
+ height: height,
438
+ size: size,
439
+ value: value,
440
+ autoFocus: false
441
+ };
442
+ }
443
+ function getCommentBoxPosition(commentId) {
444
+ var box = document.getElementById(commentId);
445
+ if (!box) return undefined;
446
+ var _a = box.getBoundingClientRect(),
447
+ width = _a.width,
448
+ height = _a.height;
449
+ var left = box.offsetLeft;
450
+ var top = box.offsetTop;
451
+ return {
452
+ left: left,
453
+ top: top,
454
+ width: width,
455
+ height: height
456
+ };
457
+ }
458
+ function onCommentBoxResizeStart(ctx, globalCache, e, _a, resizingId, resizingSide) {
459
+ var r = _a.r,
460
+ c = _a.c,
461
+ rc = _a.rc;
462
+ var position = getCommentBoxPosition(resizingId);
463
+ if (position) {
464
+ _lodash.default.set(globalCache, "commentBox", {
465
+ cursorMoveStartPosition: {
466
+ x: e.pageX,
467
+ y: e.pageY
468
+ },
469
+ resizingId: resizingId,
470
+ resizingSide: resizingSide,
471
+ commentRC: {
472
+ r: r,
473
+ c: c,
474
+ rc: rc
475
+ },
476
+ boxInitialPosition: position
477
+ });
478
+ }
479
+ }
480
+ function onCommentBoxResize(ctx, globalCache, e) {
481
+ if (ctx.allowEdit === false) return false;
482
+ var commentBox = globalCache === null || globalCache === void 0 ? void 0 : globalCache.commentBox;
483
+ if ((commentBox === null || commentBox === void 0 ? void 0 : commentBox.resizingId) && commentBox.resizingSide) {
484
+ var box = document.getElementById(commentBox.resizingId);
485
+ var _a = commentBox.cursorMoveStartPosition,
486
+ startX = _a.x,
487
+ startY = _a.y;
488
+ var _b = commentBox.boxInitialPosition,
489
+ top_1 = _b.top,
490
+ left = _b.left,
491
+ width = _b.width,
492
+ height = _b.height;
493
+ var dx = e.pageX - startX;
494
+ var dy = e.pageY - startY;
495
+ var minHeight = 60 * ctx.zoomRatio;
496
+ var minWidth = 1.5 * 60 * ctx.zoomRatio;
497
+ if (["lm", "lt", "lb"].includes(commentBox.resizingSide)) {
498
+ if (width - dx < minWidth) {
499
+ left += width - minWidth;
500
+ width = minWidth;
501
+ } else {
502
+ left += dx;
503
+ width -= dx;
504
+ }
505
+ if (left < 0) left = 0;
506
+ box.style.left = "".concat(left, "px");
507
+ }
508
+ if (["rm", "rt", "rb"].includes(commentBox.resizingSide)) {
509
+ width = width + dx < minWidth ? minWidth : width + dx;
510
+ }
511
+ if (["mt", "lt", "rt"].includes(commentBox.resizingSide)) {
512
+ if (height - dy < minHeight) {
513
+ top_1 += height - minHeight;
514
+ height = minHeight;
515
+ } else {
516
+ top_1 += dy;
517
+ height -= dy;
518
+ }
519
+ if (top_1 < 0) top_1 = 0;
520
+ box.style.top = "".concat(top_1, "px");
521
+ }
522
+ if (["mb", "lb", "rb"].includes(commentBox.resizingSide)) {
523
+ height = height + dy < minHeight ? minHeight : height + dy;
524
+ }
525
+ box.style.width = "".concat(width, "px");
526
+ box.style.height = "".concat(height, "px");
527
+ return true;
528
+ }
529
+ return false;
530
+ }
531
+ function onCommentBoxResizeEnd(ctx, globalCache) {
532
+ var _a;
533
+ if ((_a = globalCache.commentBox) === null || _a === void 0 ? void 0 : _a.resizingId) {
534
+ var _b = globalCache.commentBox,
535
+ resizingId = _b.resizingId,
536
+ _c = _b.commentRC,
537
+ r = _c.r,
538
+ c = _c.c;
539
+ globalCache.commentBox.resizingId = undefined;
540
+ var position = getCommentBoxPosition(resizingId);
541
+ if (position) {
542
+ var top_2 = position.top,
543
+ left = position.left,
544
+ width = position.width,
545
+ height = position.height;
546
+ var flowdata = (0, _context.getFlowdata)(ctx);
547
+ var cell = flowdata === null || flowdata === void 0 ? void 0 : flowdata[r][c];
548
+ if (!flowdata || !(cell === null || cell === void 0 ? void 0 : cell.ps)) return;
549
+ cell.ps.left = left / ctx.zoomRatio;
550
+ cell.ps.top = top_2 / ctx.zoomRatio;
551
+ cell.ps.width = width / ctx.zoomRatio;
552
+ cell.ps.height = height / ctx.zoomRatio;
553
+ setEditingComment(ctx, flowdata, r, c);
554
+ }
555
+ }
556
+ }
557
+ function onCommentBoxMoveStart(ctx, globalCache, e, _a, movingId) {
558
+ var r = _a.r,
559
+ c = _a.c,
560
+ rc = _a.rc;
561
+ var position = getCommentBoxPosition(movingId);
562
+ if (position) {
563
+ var top_3 = position.top,
564
+ left = position.left;
565
+ _lodash.default.set(globalCache, "commentBox", {
566
+ cursorMoveStartPosition: {
567
+ x: e.pageX,
568
+ y: e.pageY
569
+ },
570
+ movingId: movingId,
571
+ commentRC: {
572
+ r: r,
573
+ c: c,
574
+ rc: rc
575
+ },
576
+ boxInitialPosition: {
577
+ left: left,
578
+ top: top_3
579
+ }
580
+ });
581
+ }
582
+ }
583
+ function onCommentBoxMove(ctx, globalCache, e) {
584
+ var allowEdit = (0, _utils.isAllowEdit)(ctx);
585
+ if (!allowEdit) return false;
586
+ var commentBox = globalCache === null || globalCache === void 0 ? void 0 : globalCache.commentBox;
587
+ if (commentBox === null || commentBox === void 0 ? void 0 : commentBox.movingId) {
588
+ var box = document.getElementById(commentBox.movingId);
589
+ var _a = commentBox.cursorMoveStartPosition,
590
+ startX = _a.x,
591
+ startY = _a.y;
592
+ var _b = commentBox.boxInitialPosition,
593
+ top_4 = _b.top,
594
+ left = _b.left;
595
+ left += e.pageX - startX;
596
+ top_4 += e.pageY - startY;
597
+ if (top_4 < 0) top_4 = 0;
598
+ box.style.left = "".concat(left, "px");
599
+ box.style.top = "".concat(top_4, "px");
600
+ return true;
601
+ }
602
+ return false;
603
+ }
604
+ function onCommentBoxMoveEnd(ctx, globalCache) {
605
+ var _a;
606
+ if ((_a = globalCache.commentBox) === null || _a === void 0 ? void 0 : _a.movingId) {
607
+ var _b = globalCache.commentBox,
608
+ movingId = _b.movingId,
609
+ _c = _b.commentRC,
610
+ r = _c.r,
611
+ c = _c.c;
612
+ globalCache.commentBox.movingId = undefined;
613
+ var position = getCommentBoxPosition(movingId);
614
+ if (position) {
615
+ var top_5 = position.top,
616
+ left = position.left;
617
+ var flowdata = (0, _context.getFlowdata)(ctx);
618
+ var cell = flowdata === null || flowdata === void 0 ? void 0 : flowdata[r][c];
619
+ if (!flowdata || !(cell === null || cell === void 0 ? void 0 : cell.ps)) return;
620
+ cell.ps.left = left / ctx.zoomRatio;
621
+ cell.ps.top = top_5 / ctx.zoomRatio;
622
+ setEditingComment(ctx, flowdata, r, c);
623
+ }
624
+ }
625
+ }
@@ -0,0 +1,2 @@
1
+ import type { SingleRange } from "../types";
2
+ export declare function cfSplitRange(range1: SingleRange, range2: SingleRange, range3: SingleRange, type: string): SingleRange[];