@fileverse-dev/fortune-core 1.1.0 → 1.1.2

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 +71 -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 +198 -197
  22. package/es/context.js +381 -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 +360 -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 +4 -3
  32. package/es/events/paste.js +1416 -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 +993 -992
  36. package/es/locale/en.js +10140 -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 +1092 -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 +701 -0
  65. package/{dist/packages/core/src → es}/modules/dropCell.d.ts +10 -10
  66. package/es/modules/dropCell.js +2267 -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 +2346 -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 +50 -46
  106. package/es/modules/selection.js +1856 -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 +134 -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 +380 -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 +19 -18
  129. package/es/utils/index.js +198 -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 +71 -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 +198 -0
  153. package/lib/context.js +393 -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 +370 -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 +4 -0
  163. package/lib/events/paste.js +1425 -0
  164. package/lib/index.d.ts +10 -0
  165. package/lib/index.js +109 -0
  166. package/lib/locale/en.d.ts +993 -0
  167. package/lib/locale/en.js +10146 -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 +1122 -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 +716 -0
  196. package/lib/modules/dropCell.d.ts +10 -0
  197. package/lib/modules/dropCell.js +2283 -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 +2375 -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 +50 -0
  237. package/lib/modules/selection.js +1889 -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 +143 -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 +380 -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 +19 -0
  260. package/lib/utils/index.js +258 -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,1425 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.handlePaste = handlePaste;
7
+ exports.handlePasteByClick = handlePasteByClick;
8
+ exports.parseAsLinkIfUrl = parseAsLinkIfUrl;
9
+ var _lodash = _interopRequireDefault(require("lodash"));
10
+ var _context = require("../context");
11
+ var _locale = require("../locale");
12
+ var _formula = require("../modules/formula");
13
+ var _cell = require("../modules/cell");
14
+ var _format = require("../modules/format");
15
+ var _selection = require("../modules/selection");
16
+ var _utils = require("../utils");
17
+ var _validation = require("../modules/validation");
18
+ var _border = require("../modules/border");
19
+ var _sheet = require("../modules/sheet");
20
+ var _refresh = require("../modules/refresh");
21
+ var _api = require("../api");
22
+ var _modules = require("../modules");
23
+ var _clipboard = _interopRequireDefault(require("../modules/clipboard"));
24
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
25
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
26
+ var __assign = void 0 && (void 0).__assign || function () {
27
+ __assign = Object.assign || function (t) {
28
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
29
+ s = arguments[i];
30
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
31
+ }
32
+ return t;
33
+ };
34
+ return __assign.apply(this, arguments);
35
+ };
36
+ function postPasteCut(ctx, source, target, RowlChange) {
37
+ var execF_rc = {};
38
+ ctx.formulaCache.execFunctionExist = [];
39
+ for (var r = source.range.row[0]; r <= source.range.row[1]; r += 1) {
40
+ for (var c = source.range.column[0]; c <= source.range.column[1]; c += 1) {
41
+ if ("".concat(r, "_").concat(c, "_").concat(source.sheetId) in execF_rc) {
42
+ continue;
43
+ }
44
+ execF_rc["".concat(r, "_").concat(c, "_").concat(source.sheetId)] = 0;
45
+ ctx.formulaCache.execFunctionExist.push({
46
+ r: r,
47
+ c: c,
48
+ i: source.sheetId
49
+ });
50
+ }
51
+ }
52
+ for (var r = target.range.row[0]; r <= target.range.row[1]; r += 1) {
53
+ for (var c = target.range.column[0]; c <= target.range.column[1]; c += 1) {
54
+ if ("".concat(r, "_").concat(c, "_").concat(target.sheetId) in execF_rc) {
55
+ continue;
56
+ }
57
+ execF_rc["".concat(r, "_").concat(c, "_").concat(target.sheetId)] = 0;
58
+ ctx.formulaCache.execFunctionExist.push({
59
+ r: r,
60
+ c: c,
61
+ i: target.sheetId
62
+ });
63
+ }
64
+ }
65
+ var rowHeight;
66
+ if (ctx.currentSheetId === source.sheetId) {
67
+ ctx.config = source.curConfig;
68
+ rowHeight = source.curData.length;
69
+ ctx.luckysheetfile[(0, _utils.getSheetIndex)(ctx, target.sheetId)].config = target.curConfig;
70
+ } else if (ctx.currentSheetId === target.sheetId) {
71
+ ctx.config = target.curConfig;
72
+ rowHeight = target.curData.length;
73
+ ctx.luckysheetfile[(0, _utils.getSheetIndex)(ctx, source.sheetId)].config = source.curConfig;
74
+ }
75
+ if (RowlChange) {
76
+ ctx.visibledatarow = [];
77
+ ctx.rh_height = 0;
78
+ for (var i = 0; i < rowHeight; i += 1) {
79
+ var rowlen = ctx.defaultrowlen;
80
+ if (ctx.config.rowlen != null && ctx.config.rowlen[i] != null) {
81
+ rowlen = ctx.config.rowlen[i];
82
+ }
83
+ if (ctx.config.rowhidden != null && ctx.config.rowhidden[i] != null) {
84
+ rowlen = ctx.config.rowhidden[i];
85
+ ctx.visibledatarow.push(ctx.rh_height);
86
+ continue;
87
+ } else {
88
+ ctx.rh_height += rowlen + 1;
89
+ }
90
+ ctx.visibledatarow.push(ctx.rh_height);
91
+ }
92
+ ctx.rh_height += 80;
93
+ if (ctx.currentSheetId === source.sheetId) {} else if (ctx.currentSheetId === target.sheetId) {}
94
+ }
95
+ if (ctx.currentSheetId === source.sheetId) {
96
+ ctx.luckysheetfile[(0, _utils.getSheetIndex)(ctx, target.sheetId)].data = target.curData;
97
+ } else if (ctx.currentSheetId === target.sheetId) {
98
+ ctx.luckysheetfile[(0, _utils.getSheetIndex)(ctx, source.sheetId)].data = source.curData;
99
+ }
100
+ if (ctx.currentSheetId === target.sheetId) {
101
+ ctx.luckysheet_select_save = [{
102
+ row: target.range.row,
103
+ column: target.range.column
104
+ }];
105
+ } else {
106
+ ctx.luckysheet_select_save = [{
107
+ row: source.range.row,
108
+ column: source.range.column
109
+ }];
110
+ }
111
+ if (ctx.luckysheet_select_save.length > 0) {}
112
+ ctx.luckysheetfile[(0, _utils.getSheetIndex)(ctx, source.sheetId)].luckysheet_conditionformat_save = source.curCdformat;
113
+ ctx.luckysheetfile[(0, _utils.getSheetIndex)(ctx, target.sheetId)].luckysheet_conditionformat_save = target.curCdformat;
114
+ ctx.luckysheetfile[(0, _utils.getSheetIndex)(ctx, source.sheetId)].dataVerification = source.curDataVerification;
115
+ ctx.luckysheetfile[(0, _utils.getSheetIndex)(ctx, target.sheetId)].dataVerification = target.curDataVerification;
116
+ ctx.formulaCache.execFunctionExist.reverse();
117
+ ctx.formulaCache.execFunctionGlobalData = null;
118
+ (0, _sheet.storeSheetParamALL)(ctx);
119
+ }
120
+ function pasteHandler(ctx, data, borderInfo) {
121
+ var _a;
122
+ var _b, _c, _d, _e, _f, _g;
123
+ var allowEdit = (0, _utils.isAllowEdit)(ctx);
124
+ if (!allowEdit || ctx.isFlvReadOnly) return;
125
+ if (((_c = (_b = ctx.luckysheet_select_save) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0) !== 1) {
126
+ return;
127
+ }
128
+ if (_typeof(data) === "object") {
129
+ if (data.length === 0) {
130
+ return;
131
+ }
132
+ var cfg = ctx.config || {};
133
+ if (cfg.merge == null) {
134
+ cfg.merge = {};
135
+ }
136
+ if (JSON.stringify(borderInfo).length > 2 && cfg.borderInfo == null) {
137
+ cfg.borderInfo = [];
138
+ }
139
+ var copyh = data.length;
140
+ var copyc = data[0].length;
141
+ var minh = ctx.luckysheet_select_save[0].row[0];
142
+ var maxh = minh + copyh - 1;
143
+ var minc = ctx.luckysheet_select_save[0].column[0];
144
+ var maxc = minc + copyc - 1;
145
+ var has_PartMC = false;
146
+ if (cfg.merge != null) {
147
+ has_PartMC = (0, _validation.hasPartMC)(ctx, cfg, minh, maxh, minc, maxc);
148
+ }
149
+ if (has_PartMC) {
150
+ return;
151
+ }
152
+ var d = (0, _context.getFlowdata)(ctx);
153
+ if (!d) return;
154
+ var rowMaxLength = d.length;
155
+ var cellMaxLength = d[0].length;
156
+ var addr = maxh - rowMaxLength + 1;
157
+ var addc = maxc - cellMaxLength + 1;
158
+ if (addr > 0 || addc > 0) {
159
+ (0, _sheet.expandRowsAndColumns)(d, addr, addc);
160
+ }
161
+ if (!d) return;
162
+ if (cfg.rowlen == null) {
163
+ cfg.rowlen = {};
164
+ }
165
+ var RowlChange = false;
166
+ var offsetMC = {};
167
+ for (var h = minh; h <= maxh; h += 1) {
168
+ var x = d[h];
169
+ var currentRowLen = ctx.defaultrowlen;
170
+ if (cfg.rowlen[h] != null) {
171
+ currentRowLen = cfg.rowlen[h];
172
+ }
173
+ for (var c = minc; c <= maxc; c += 1) {
174
+ if ((_d = x === null || x === void 0 ? void 0 : x[c]) === null || _d === void 0 ? void 0 : _d.mc) {
175
+ if ("rs" in x[c].mc) {
176
+ delete cfg.merge["".concat(x[c].mc.r, "_").concat(x[c].mc.c)];
177
+ }
178
+ delete x[c].mc;
179
+ }
180
+ var value = null;
181
+ if (data[h - minh] != null && data[h - minh][c - minc] != null) {
182
+ value = data[h - minh][c - minc];
183
+ }
184
+ x[c] = value;
185
+ if (value != null && ((_e = x === null || x === void 0 ? void 0 : x[c]) === null || _e === void 0 ? void 0 : _e.mc)) {
186
+ if (x[c].mc.rs != null) {
187
+ x[c].mc.r = h;
188
+ x[c].mc.c = c;
189
+ cfg.merge["".concat(x[c].mc.r, "_").concat(x[c].mc.c)] = x[c].mc;
190
+ offsetMC["".concat(value.mc.r, "_").concat(value.mc.c)] = [x[c].mc.r, x[c].mc.c];
191
+ } else {
192
+ x[c] = {
193
+ mc: {
194
+ r: offsetMC["".concat(value.mc.r, "_").concat(value.mc.c)][0],
195
+ c: offsetMC["".concat(value.mc.r, "_").concat(value.mc.c)][1]
196
+ }
197
+ };
198
+ }
199
+ }
200
+ if (borderInfo["".concat(h - minh, "_").concat(c - minc)]) {
201
+ var bd_obj = {
202
+ rangeType: "cell",
203
+ value: {
204
+ row_index: h,
205
+ col_index: c,
206
+ l: borderInfo["".concat(h - minh, "_").concat(c - minc)].l,
207
+ r: borderInfo["".concat(h - minh, "_").concat(c - minc)].r,
208
+ t: borderInfo["".concat(h - minh, "_").concat(c - minc)].t,
209
+ b: borderInfo["".concat(h - minh, "_").concat(c - minc)].b
210
+ }
211
+ };
212
+ (_f = cfg.borderInfo) === null || _f === void 0 ? void 0 : _f.push(bd_obj);
213
+ }
214
+ }
215
+ d[h] = x;
216
+ if (currentRowLen !== ctx.defaultrowlen) {
217
+ cfg.rowlen[h] = currentRowLen;
218
+ }
219
+ }
220
+ ctx.luckysheet_select_save = [{
221
+ row: [minh, maxh],
222
+ column: [minc, maxc]
223
+ }];
224
+ if (addr > 0 || addc > 0 || RowlChange) {
225
+ ctx.luckysheetfile[(0, _utils.getSheetIndex)(ctx, ctx.currentSheetId)].config = cfg;
226
+ } else {
227
+ ctx.luckysheetfile[(0, _utils.getSheetIndex)(ctx, ctx.currentSheetId)].config = cfg;
228
+ }
229
+ (0, _refresh.jfrefreshgrid)(ctx, null, undefined);
230
+ } else {
231
+ data = data.replace(/\r/g, "");
232
+ var dataChe = [];
233
+ var che = data.split("\n");
234
+ var colchelen = che[0].split("\t").length;
235
+ for (var i = 0; i < che.length; i += 1) {
236
+ if (che[i].split("\t").length < colchelen) {
237
+ continue;
238
+ }
239
+ dataChe.push(che[i].split("\t"));
240
+ }
241
+ var d = (0, _context.getFlowdata)(ctx);
242
+ if (!d) return;
243
+ var last = (_g = ctx.luckysheet_select_save) === null || _g === void 0 ? void 0 : _g[ctx.luckysheet_select_save.length - 1];
244
+ if (!last) return;
245
+ var curR = last.row == null ? 0 : last.row[0];
246
+ var curC = last.column == null ? 0 : last.column[0];
247
+ var rlen = dataChe.length;
248
+ var clen = dataChe[0].length;
249
+ var has_PartMC = false;
250
+ if (ctx.config.merge != null) {
251
+ has_PartMC = (0, _validation.hasPartMC)(ctx, ctx.config, curR, curR + rlen - 1, curC, curC + clen - 1);
252
+ }
253
+ if (has_PartMC) {
254
+ return;
255
+ }
256
+ var addr = curR + rlen - d.length;
257
+ var addc = curC + clen - d[0].length;
258
+ if (addr > 0 || addc > 0) {
259
+ (0, _sheet.expandRowsAndColumns)(d, addr, addc);
260
+ }
261
+ if (!d) return;
262
+ for (var r = 0; r < rlen; r += 1) {
263
+ var x = d[r + curR];
264
+ for (var c = 0; c < clen; c += 1) {
265
+ var originCell = x[c + curC];
266
+ var value = dataChe[r][c];
267
+ if ((0, _validation.isRealNum)(value)) {
268
+ if (originCell && originCell.ct && originCell.ct.fa === "@") {
269
+ value = String(value);
270
+ } else if (!/^0x?[a-fA-F0-9]+$/.test(value)) {
271
+ value = parseFloat(value);
272
+ }
273
+ }
274
+ if (originCell) {
275
+ originCell.v = value;
276
+ if (originCell.ct != null && originCell.ct.fa != null) {
277
+ originCell.m = (0, _format.update)(originCell.ct.fa, value);
278
+ } else {
279
+ originCell.m = value;
280
+ }
281
+ if (originCell.f != null && originCell.f.length > 0) {
282
+ originCell.f = "";
283
+ }
284
+ } else {
285
+ var cell = {};
286
+ var mask = (0, _format.genarate)(value);
287
+ _a = mask, cell.m = _a[0], cell.ct = _a[1], cell.v = _a[2];
288
+ if (/^0x?[a-fA-F0-9]+$/.test(value)) {
289
+ cell.m = value;
290
+ cell.ct = {
291
+ fa: "@",
292
+ t: "s"
293
+ };
294
+ cell.v = value;
295
+ }
296
+ x[c + curC] = cell;
297
+ }
298
+ }
299
+ d[r + curR] = x;
300
+ }
301
+ last.row = [curR, curR + rlen - 1];
302
+ last.column = [curC, curC + clen - 1];
303
+ (0, _refresh.jfrefreshgrid)(ctx, null, undefined);
304
+ }
305
+ }
306
+ function setCellHyperlink(ctx, id, r, c, link) {
307
+ var index = (0, _utils.getSheetIndex)(ctx, id);
308
+ if (!ctx.luckysheetfile[index].hyperlink) {
309
+ ctx.luckysheetfile[index].hyperlink = {};
310
+ }
311
+ ctx.luckysheetfile[index].hyperlink["".concat(r, "_").concat(c)] = link;
312
+ }
313
+ function pasteHandlerOfCutPaste(ctx, copyRange) {
314
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
315
+ var allowEdit = (0, _utils.isAllowEdit)(ctx);
316
+ if (!allowEdit) return;
317
+ if (!copyRange) return;
318
+ var cfg = ctx.config || {};
319
+ if (cfg.merge == null) {
320
+ cfg.merge = {};
321
+ }
322
+ var copyHasMC = copyRange.HasMC;
323
+ var copyRowlChange = copyRange.RowlChange;
324
+ var copySheetId = copyRange.dataSheetId;
325
+ var c_r1 = copyRange.copyRange[0].row[0];
326
+ var c_r2 = copyRange.copyRange[0].row[1];
327
+ var c_c1 = copyRange.copyRange[0].column[0];
328
+ var c_c2 = copyRange.copyRange[0].column[1];
329
+ var copyData = _lodash.default.cloneDeep((0, _cell.getdatabyselection)(ctx, {
330
+ row: [c_r1, c_r2],
331
+ column: [c_c1, c_c2]
332
+ }, copySheetId));
333
+ var copyh = copyData.length;
334
+ var copyc = copyData[0].length;
335
+ var last = (_a = ctx.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[ctx.luckysheet_select_save.length - 1];
336
+ if (!last || last.row_focus == null || last.column_focus == null) return;
337
+ var minh = last.row_focus;
338
+ var maxh = minh + copyh - 1;
339
+ var minc = last.column_focus;
340
+ var maxc = minc + copyc - 1;
341
+ var has_PartMC = false;
342
+ if (cfg.merge != null) {
343
+ has_PartMC = (0, _validation.hasPartMC)(ctx, cfg, minh, maxh, minc, maxc);
344
+ }
345
+ if (has_PartMC) {
346
+ return;
347
+ }
348
+ var d = (0, _context.getFlowdata)(ctx);
349
+ if (!d) return;
350
+ var rowMaxLength = d.length;
351
+ var cellMaxLength = d[0].length;
352
+ var addr = copyh + minh - rowMaxLength;
353
+ var addc = copyc + minc - cellMaxLength;
354
+ if (addr > 0 || addc > 0) {
355
+ (0, _sheet.expandRowsAndColumns)(d, addr, addc);
356
+ }
357
+ var borderInfoCompute = (0, _border.getBorderInfoCompute)(ctx, copySheetId);
358
+ var c_dataVerification = _lodash.default.cloneDeep(ctx.luckysheetfile[(0, _utils.getSheetIndex)(ctx, copySheetId)].dataVerification) || {};
359
+ var dataVerification = _lodash.default.cloneDeep(ctx.luckysheetfile[(0, _utils.getSheetIndex)(ctx, ctx.currentSheetId)].dataVerification) || {};
360
+ if (((_b = ctx.luckysheet_select_save) === null || _b === void 0 ? void 0 : _b.length) === 1 && ((_c = ctx.luckysheet_copy_save) === null || _c === void 0 ? void 0 : _c.copyRange.length) === 1) {
361
+ _lodash.default.forEach((_d = ctx.luckysheet_copy_save) === null || _d === void 0 ? void 0 : _d.copyRange, function (range) {
362
+ var _a, _b, _c;
363
+ var srcIndex = (0, _utils.getSheetIndex)(ctx, (_a = ctx.luckysheet_copy_save) === null || _a === void 0 ? void 0 : _a.dataSheetId);
364
+ for (var r = 0; r <= range.row[1] - range.row[0]; r += 1) {
365
+ for (var c = 0; c <= range.column[1] - range.column[0]; c += 1) {
366
+ var srcRow = r + range.row[0];
367
+ var srcCol = c + range.column[0];
368
+ var srcLink = (_b = ctx.luckysheetfile[srcIndex].hyperlink) === null || _b === void 0 ? void 0 : _b["".concat(srcRow, "_").concat(srcCol)];
369
+ if (!srcLink) continue;
370
+ var targetR = r + ctx.luckysheet_select_save[0].row[0];
371
+ var targetC = c + ctx.luckysheet_select_save[0].column[0];
372
+ setCellHyperlink(ctx, (_c = ctx.luckysheet_copy_save) === null || _c === void 0 ? void 0 : _c.dataSheetId, targetR, targetC, srcLink);
373
+ }
374
+ }
375
+ });
376
+ }
377
+ if (ctx.currentSheetId === copySheetId) {
378
+ for (var i = c_r1; i <= c_r2; i += 1) {
379
+ for (var j = c_c1; j <= c_c2; j += 1) {
380
+ var cell = d[i][j];
381
+ if (cell && _lodash.default.isPlainObject(cell) && "mc" in cell) {
382
+ if (((_e = cell.mc) === null || _e === void 0 ? void 0 : _e.rs) != null) {
383
+ delete cfg.merge["".concat(cell.mc.r, "_").concat(cell.mc.c)];
384
+ }
385
+ delete cell.mc;
386
+ }
387
+ d[i][j] = null;
388
+ delete dataVerification["".concat(i, "_").concat(j)];
389
+ (_f = ctx.luckysheetfile[(0, _utils.getSheetIndex)(ctx, ctx.currentSheetId)].hyperlink) === null || _f === void 0 ? true : delete _f["".concat(i, "_").concat(j)];
390
+ }
391
+ }
392
+ if (cfg.borderInfo && cfg.borderInfo.length > 0) {
393
+ var source_borderInfo = [];
394
+ for (var i = 0; i < cfg.borderInfo.length; i += 1) {
395
+ var bd_rangeType = cfg.borderInfo[i].rangeType;
396
+ if (bd_rangeType === "range") {
397
+ var bd_range = cfg.borderInfo[i].range;
398
+ var bd_emptyRange = [];
399
+ for (var j = 0; j < bd_range.length; j += 1) {
400
+ bd_emptyRange = bd_emptyRange.concat((0, _modules.CFSplitRange)(bd_range[j], {
401
+ row: [c_r1, c_r2],
402
+ column: [c_c1, c_c2]
403
+ }, {
404
+ row: [minh, maxh],
405
+ column: [minc, maxc]
406
+ }, "restPart"));
407
+ }
408
+ cfg.borderInfo[i].range = bd_emptyRange;
409
+ source_borderInfo.push(cfg.borderInfo[i]);
410
+ } else if (bd_rangeType === "cell") {
411
+ var bd_r = cfg.borderInfo[i].value.row_index;
412
+ var bd_c = cfg.borderInfo[i].value.col_index;
413
+ if (!(bd_r >= c_r1 && bd_r <= c_r2 && bd_c >= c_c1 && bd_c <= c_c2)) {
414
+ source_borderInfo.push(cfg.borderInfo[i]);
415
+ }
416
+ }
417
+ }
418
+ cfg.borderInfo = source_borderInfo;
419
+ }
420
+ }
421
+ var offsetMC = {};
422
+ for (var h = minh; h <= maxh; h += 1) {
423
+ var x = d[h];
424
+ for (var c = minc; c <= maxc; c += 1) {
425
+ if (borderInfoCompute["".concat(c_r1 + h - minh, "_").concat(c_c1 + c - minc)] && !borderInfoCompute["".concat(c_r1 + h - minh, "_").concat(c_c1 + c - minc)].s) {
426
+ var bd_obj = {
427
+ rangeType: "cell",
428
+ value: {
429
+ row_index: h,
430
+ col_index: c,
431
+ l: borderInfoCompute["".concat(c_r1 + h - minh, "_").concat(c_c1 + c - minc)].l,
432
+ r: borderInfoCompute["".concat(c_r1 + h - minh, "_").concat(c_c1 + c - minc)].r,
433
+ t: borderInfoCompute["".concat(c_r1 + h - minh, "_").concat(c_c1 + c - minc)].t,
434
+ b: borderInfoCompute["".concat(c_r1 + h - minh, "_").concat(c_c1 + c - minc)].b
435
+ }
436
+ };
437
+ if (cfg.borderInfo == null) {
438
+ cfg.borderInfo = [];
439
+ }
440
+ cfg.borderInfo.push(bd_obj);
441
+ } else if (borderInfoCompute["".concat(h, "_").concat(c)]) {
442
+ var bd_obj = {
443
+ rangeType: "cell",
444
+ value: {
445
+ row_index: h,
446
+ col_index: c,
447
+ l: null,
448
+ r: null,
449
+ t: null,
450
+ b: null
451
+ }
452
+ };
453
+ if (cfg.borderInfo == null) {
454
+ cfg.borderInfo = [];
455
+ }
456
+ cfg.borderInfo.push(bd_obj);
457
+ } else if (borderInfoCompute["".concat(c_r1 + h - minh, "_").concat(c_c1 + c - minc)]) {
458
+ var bd_obj = {
459
+ rangeType: "range",
460
+ borderType: "border-slash",
461
+ color: borderInfoCompute["".concat(c_r1 + h - minh, "_").concat(c_c1 + c - minc)].s.color,
462
+ style: borderInfoCompute["".concat(c_r1 + h - minh, "_").concat(c_c1 + c - minc)].s.style,
463
+ range: (0, _selection.normalizeSelection)(ctx, [{
464
+ row: [h, h],
465
+ column: [c, c]
466
+ }])
467
+ };
468
+ if (cfg.borderInfo == null) {
469
+ cfg.borderInfo = [];
470
+ }
471
+ cfg.borderInfo.push(bd_obj);
472
+ }
473
+ if (c_dataVerification["".concat(c_r1 + h - minh, "_").concat(c_c1 + c - minc)]) {
474
+ dataVerification["".concat(h, "_").concat(c)] = c_dataVerification["".concat(c_r1 + h - minh, "_").concat(c_c1 + c - minc)];
475
+ }
476
+ if ((_g = x[c]) === null || _g === void 0 ? void 0 : _g.mc) {
477
+ if (((_j = (_h = x[c]) === null || _h === void 0 ? void 0 : _h.mc) === null || _j === void 0 ? void 0 : _j.rs) != null) {
478
+ delete cfg.merge["".concat(x[c].mc.r, "_").concat(x[c].mc.c)];
479
+ }
480
+ delete x[c].mc;
481
+ }
482
+ var value = null;
483
+ if (copyData[h - minh] != null && copyData[h - minh][c - minc] != null) {
484
+ value = copyData[h - minh][c - minc];
485
+ }
486
+ x[c] = _lodash.default.cloneDeep(value);
487
+ if (value != null && copyHasMC && ((_k = x[c]) === null || _k === void 0 ? void 0 : _k.mc)) {
488
+ if (x[c].mc.rs != null) {
489
+ x[c].mc.r = h;
490
+ x[c].mc.c = c;
491
+ cfg.merge["".concat(x[c].mc.r, "_").concat(x[c].mc.c)] = x[c].mc;
492
+ offsetMC["".concat(value.mc.r, "_").concat(value.mc.c)] = [x[c].mc.r, x[c].mc.c];
493
+ } else {
494
+ x[c] = {
495
+ mc: {
496
+ r: offsetMC["".concat(value.mc.r, "_").concat(value.mc.c)][0],
497
+ c: offsetMC["".concat(value.mc.r, "_").concat(value.mc.c)][1]
498
+ }
499
+ };
500
+ }
501
+ }
502
+ }
503
+ d[h] = x;
504
+ }
505
+ last.row = [minh, maxh];
506
+ last.column = [minc, maxc];
507
+ if (copyRowlChange) {}
508
+ var source;
509
+ var target;
510
+ if (ctx.currentSheetId !== copySheetId) {
511
+ var sourceData = _lodash.default.cloneDeep(ctx.luckysheetfile[(0, _utils.getSheetIndex)(ctx, copySheetId)].data);
512
+ var sourceConfig = _lodash.default.cloneDeep(ctx.luckysheetfile[(0, _utils.getSheetIndex)(ctx, copySheetId)].config);
513
+ var sourceCurData = _lodash.default.cloneDeep(sourceData);
514
+ var sourceCurConfig = _lodash.default.cloneDeep(sourceConfig) || {};
515
+ if (sourceCurConfig.merge == null) {
516
+ sourceCurConfig.merge = {};
517
+ }
518
+ for (var source_r = c_r1; source_r <= c_r2; source_r += 1) {
519
+ for (var source_c = c_c1; source_c <= c_c2; source_c += 1) {
520
+ var cell = sourceCurData[source_r][source_c];
521
+ if (cell === null || cell === void 0 ? void 0 : cell.mc) {
522
+ if ("rs" in cell.mc) {
523
+ delete sourceCurConfig.merge["".concat(cell.mc.r, "_").concat(cell.mc.c)];
524
+ }
525
+ delete cell.mc;
526
+ }
527
+ sourceCurData[source_r][source_c] = null;
528
+ }
529
+ }
530
+ if (copyRowlChange) {}
531
+ if (sourceCurConfig.borderInfo && sourceCurConfig.borderInfo.length > 0) {
532
+ var source_borderInfo = [];
533
+ for (var i = 0; i < sourceCurConfig.borderInfo.length; i += 1) {
534
+ var bd_rangeType = sourceCurConfig.borderInfo[i].rangeType;
535
+ if (bd_rangeType === "range") {
536
+ var bd_range = sourceCurConfig.borderInfo[i].range;
537
+ var bd_emptyRange = [];
538
+ for (var j = 0; j < bd_range.length; j += 1) {
539
+ bd_emptyRange = bd_emptyRange.concat((0, _modules.CFSplitRange)(bd_range[j], {
540
+ row: [c_r1, c_r2],
541
+ column: [c_c1, c_c2]
542
+ }, {
543
+ row: [minh, maxh],
544
+ column: [minc, maxc]
545
+ }, "restPart"));
546
+ }
547
+ sourceCurConfig.borderInfo[i].range = bd_emptyRange;
548
+ source_borderInfo.push(sourceCurConfig.borderInfo[i]);
549
+ } else if (bd_rangeType === "cell") {
550
+ var bd_r = sourceCurConfig.borderInfo[i].value.row_index;
551
+ var bd_c = sourceCurConfig.borderInfo[i].value.col_index;
552
+ if (!(bd_r >= c_r1 && bd_r <= c_r2 && bd_c >= c_c1 && bd_c <= c_c2)) {
553
+ source_borderInfo.push(sourceCurConfig.borderInfo[i]);
554
+ }
555
+ }
556
+ }
557
+ sourceCurConfig.borderInfo = source_borderInfo;
558
+ }
559
+ var source_cdformat = _lodash.default.cloneDeep(ctx.luckysheetfile[(0, _utils.getSheetIndex)(ctx, copySheetId)].luckysheet_conditionformat_save);
560
+ var source_curCdformat = _lodash.default.cloneDeep(source_cdformat);
561
+ var ruleArr = [];
562
+ if (source_curCdformat != null && source_curCdformat.length > 0) {
563
+ for (var i = 0; i < source_curCdformat.length; i += 1) {
564
+ var source_curCdformat_cellrange = source_curCdformat[i].cellrange;
565
+ var emptyRange = [];
566
+ var emptyRange2 = [];
567
+ for (var j = 0; j < source_curCdformat_cellrange.length; j += 1) {
568
+ var range = (0, _modules.CFSplitRange)(source_curCdformat_cellrange[j], {
569
+ row: [c_r1, c_r2],
570
+ column: [c_c1, c_c2]
571
+ }, {
572
+ row: [minh, maxh],
573
+ column: [minc, maxc]
574
+ }, "restPart");
575
+ emptyRange = emptyRange.concat(range);
576
+ var range2 = (0, _modules.CFSplitRange)(source_curCdformat_cellrange[j], {
577
+ row: [c_r1, c_r2],
578
+ column: [c_c1, c_c2]
579
+ }, {
580
+ row: [minh, maxh],
581
+ column: [minc, maxc]
582
+ }, "operatePart");
583
+ if (range2.length > 0) {
584
+ emptyRange2 = emptyRange2.concat(range2);
585
+ }
586
+ }
587
+ source_curCdformat[i].cellrange = emptyRange;
588
+ if (emptyRange2.length > 0) {
589
+ var ruleObj = (_l = source_curCdformat[i]) !== null && _l !== void 0 ? _l : {};
590
+ ruleObj.cellrange = emptyRange2;
591
+ ruleArr.push(ruleObj);
592
+ }
593
+ }
594
+ }
595
+ var target_cdformat = _lodash.default.cloneDeep(ctx.luckysheetfile[(0, _utils.getSheetIndex)(ctx, ctx.currentSheetId)].luckysheet_conditionformat_save);
596
+ var target_curCdformat = _lodash.default.cloneDeep(target_cdformat);
597
+ if (ruleArr.length > 0) {
598
+ target_curCdformat = target_curCdformat === null || target_curCdformat === void 0 ? void 0 : target_curCdformat.concat(ruleArr);
599
+ }
600
+ for (var i = c_r1; i <= c_r2; i += 1) {
601
+ for (var j = c_c1; j <= c_c2; j += 1) {
602
+ delete c_dataVerification["".concat(i, "_").concat(j)];
603
+ }
604
+ }
605
+ source = {
606
+ sheetId: copySheetId,
607
+ data: sourceData,
608
+ curData: sourceCurData,
609
+ config: sourceConfig,
610
+ curConfig: sourceCurConfig,
611
+ cdformat: source_cdformat,
612
+ curCdformat: source_curCdformat,
613
+ dataVerification: _lodash.default.cloneDeep(ctx.luckysheetfile[(0, _utils.getSheetIndex)(ctx, copySheetId)].dataVerification),
614
+ curDataVerification: c_dataVerification,
615
+ range: {
616
+ row: [c_r1, c_r2],
617
+ column: [c_c1, c_c2]
618
+ }
619
+ };
620
+ target = {
621
+ sheetId: ctx.currentSheetId,
622
+ data: (0, _context.getFlowdata)(ctx),
623
+ curData: d,
624
+ config: _lodash.default.cloneDeep(ctx.config),
625
+ curConfig: cfg,
626
+ cdformat: target_cdformat,
627
+ curCdformat: target_curCdformat,
628
+ dataVerification: _lodash.default.cloneDeep(ctx.luckysheetfile[(0, _utils.getSheetIndex)(ctx, ctx.currentSheetId)].dataVerification),
629
+ curDataVerification: dataVerification,
630
+ range: {
631
+ row: [minh, maxh],
632
+ column: [minc, maxc]
633
+ }
634
+ };
635
+ } else {
636
+ var cdformat = _lodash.default.cloneDeep(ctx.luckysheetfile[(0, _utils.getSheetIndex)(ctx, ctx.currentSheetId)].luckysheet_conditionformat_save);
637
+ var curCdformat = _lodash.default.cloneDeep(cdformat);
638
+ if (curCdformat != null && curCdformat.length > 0) {
639
+ for (var i = 0; i < curCdformat.length; i += 1) {
640
+ var cellrange = curCdformat[i].cellrange;
641
+ var emptyRange = [];
642
+ for (var j = 0; j < cellrange.length; j += 1) {
643
+ var range = (0, _modules.CFSplitRange)(cellrange[j], {
644
+ row: [c_r1, c_r2],
645
+ column: [c_c1, c_c2]
646
+ }, {
647
+ row: [minh, maxh],
648
+ column: [minc, maxc]
649
+ }, "allPart");
650
+ emptyRange = emptyRange.concat(range);
651
+ }
652
+ curCdformat[i].cellrange = emptyRange;
653
+ }
654
+ }
655
+ source = {
656
+ sheetId: ctx.currentSheetId,
657
+ data: (0, _context.getFlowdata)(ctx),
658
+ curData: d,
659
+ config: _lodash.default.cloneDeep(ctx.config),
660
+ curConfig: cfg,
661
+ cdformat: cdformat,
662
+ curCdformat: curCdformat,
663
+ dataVerification: _lodash.default.cloneDeep(ctx.luckysheetfile[(0, _utils.getSheetIndex)(ctx, ctx.currentSheetId)].dataVerification),
664
+ curDataVerification: dataVerification,
665
+ range: {
666
+ row: [c_r1, c_r2],
667
+ column: [c_c1, c_c2]
668
+ }
669
+ };
670
+ target = {
671
+ sheetId: ctx.currentSheetId,
672
+ data: (0, _context.getFlowdata)(ctx),
673
+ curData: d,
674
+ config: _lodash.default.cloneDeep(ctx.config),
675
+ curConfig: cfg,
676
+ cdformat: cdformat,
677
+ curCdformat: curCdformat,
678
+ dataVerification: _lodash.default.cloneDeep(ctx.luckysheetfile[(0, _utils.getSheetIndex)(ctx, ctx.currentSheetId)].dataVerification),
679
+ curDataVerification: dataVerification,
680
+ range: {
681
+ row: [minh, maxh],
682
+ column: [minc, maxc]
683
+ }
684
+ };
685
+ }
686
+ if (addr > 0 || addc > 0) {
687
+ postPasteCut(ctx, source, target, true);
688
+ } else {
689
+ postPasteCut(ctx, source, target, copyRowlChange);
690
+ }
691
+ }
692
+ function pasteHandlerOfCopyPaste(ctx, copyRange) {
693
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
694
+ var allowEdit = (0, _utils.isAllowEdit)(ctx);
695
+ if (!allowEdit) return;
696
+ if (!copyRange) return;
697
+ var cfg = ctx.config;
698
+ if (_lodash.default.isNil(cfg.merge)) {
699
+ cfg.merge = {};
700
+ }
701
+ var copyHasMC = copyRange.HasMC;
702
+ var copyRowlChange = copyRange.RowlChange;
703
+ var copySheetIndex = copyRange.dataSheetId;
704
+ var c_r1 = copyRange.copyRange[0].row[0];
705
+ var c_r2 = copyRange.copyRange[0].row[1];
706
+ var c_c1 = copyRange.copyRange[0].column[0];
707
+ var c_c2 = copyRange.copyRange[0].column[1];
708
+ var arr = [];
709
+ var isSameRow = false;
710
+ var _loop_1 = function _loop_1(i) {
711
+ var arrData = (0, _cell.getdatabyselection)(ctx, {
712
+ row: copyRange.copyRange[i].row,
713
+ column: copyRange.copyRange[i].column
714
+ }, copySheetIndex);
715
+ if (copyRange.copyRange.length > 1) {
716
+ if (c_r1 === copyRange.copyRange[1].row[0] && c_r2 === copyRange.copyRange[1].row[1]) {
717
+ arrData = arrData[0].map(function (col, a) {
718
+ return arrData.map(function (row) {
719
+ return row[a];
720
+ });
721
+ });
722
+ arr = arr.concat(arrData);
723
+ isSameRow = true;
724
+ } else if (c_c1 === copyRange.copyRange[1].column[0] && c_c2 === copyRange.copyRange[1].column[1]) {
725
+ arr = arr.concat(arrData);
726
+ }
727
+ } else {
728
+ arr = arrData;
729
+ }
730
+ };
731
+ for (var i = 0; i < copyRange.copyRange.length; i += 1) {
732
+ _loop_1(i);
733
+ }
734
+ if (isSameRow) {
735
+ arr = arr[0].map(function (col, b) {
736
+ return arr.map(function (row) {
737
+ return row[b];
738
+ });
739
+ });
740
+ }
741
+ var copyData = _lodash.default.cloneDeep(arr);
742
+ if (copyRange.copyRange.length > 1) {
743
+ for (var i = 0; i < copyData.length; i += 1) {
744
+ for (var j = 0; j < copyData[i].length; j += 1) {
745
+ if (copyData[i][j] != null && copyData[i][j].f != null) {
746
+ delete copyData[i][j].f;
747
+ delete copyData[i][j].spl;
748
+ }
749
+ }
750
+ }
751
+ }
752
+ var copyh = copyData.length;
753
+ var copyc = copyData[0].length;
754
+ var last = (_a = ctx.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[ctx.luckysheet_select_save.length - 1];
755
+ if (!last) return;
756
+ var minh = last.row[0];
757
+ var maxh = last.row[1];
758
+ var minc = last.column[0];
759
+ var maxc = last.column[1];
760
+ var mh = (maxh - minh + 1) % copyh;
761
+ var mc = (maxc - minc + 1) % copyc;
762
+ if (mh !== 0 || mc !== 0) {
763
+ maxh = minh + copyh - 1;
764
+ maxc = minc + copyc - 1;
765
+ }
766
+ var has_PartMC = false;
767
+ if (!_lodash.default.isNil(cfg.merge)) {
768
+ has_PartMC = (0, _validation.hasPartMC)(ctx, cfg, minh, maxh, minc, maxc);
769
+ }
770
+ if (has_PartMC) {
771
+ return;
772
+ }
773
+ var timesH = (maxh - minh + 1) / copyh;
774
+ var timesC = (maxc - minc + 1) / copyc;
775
+ var d = (0, _context.getFlowdata)(ctx);
776
+ if (!d) return;
777
+ var rowMaxLength = d.length;
778
+ var cellMaxLength = d[0].length;
779
+ var addr = copyh + minh - rowMaxLength;
780
+ var addc = copyc + minc - cellMaxLength;
781
+ if (addr > 0 || addc > 0) {
782
+ (0, _sheet.expandRowsAndColumns)(d, addr, addc);
783
+ }
784
+ var borderInfoCompute = (0, _border.getBorderInfoCompute)(ctx, copySheetIndex);
785
+ var c_dataVerification = _lodash.default.cloneDeep(ctx.luckysheetfile[(0, _utils.getSheetIndex)(ctx, copySheetIndex)].dataVerification) || {};
786
+ var dataVerification = null;
787
+ var mth = 0;
788
+ var mtc = 0;
789
+ var maxcellCahe = 0;
790
+ var maxrowCache = 0;
791
+ var file = ctx.luckysheetfile[(0, _utils.getSheetIndex)(ctx, ctx.currentSheetId)];
792
+ var hiddenRows = new Set(Object.keys(((_b = file.config) === null || _b === void 0 ? void 0 : _b.rowhidden) || {}));
793
+ var hiddenCols = new Set(Object.keys(((_c = file.config) === null || _c === void 0 ? void 0 : _c.colhidden) || {}));
794
+ for (var th = 1; th <= timesH; th += 1) {
795
+ for (var tc = 1; tc <= timesC; tc += 1) {
796
+ mth = minh + (th - 1) * copyh;
797
+ mtc = minc + (tc - 1) * copyc;
798
+ maxrowCache = minh + th * copyh;
799
+ maxcellCahe = minc + tc * copyc;
800
+ var offsetRow = mth - c_r1;
801
+ var offsetCol = mtc - c_c1;
802
+ var offsetMC = {};
803
+ for (var h = mth; h < maxrowCache; h += 1) {
804
+ if (hiddenRows === null || hiddenRows === void 0 ? void 0 : hiddenRows.has(h.toString())) continue;
805
+ var x = d[h];
806
+ for (var c = mtc; c < maxcellCahe; c += 1) {
807
+ if (hiddenCols === null || hiddenCols === void 0 ? void 0 : hiddenCols.has(c.toString())) continue;
808
+ if (borderInfoCompute["".concat(c_r1 + h - mth, "_").concat(c_c1 + c - mtc)] && !borderInfoCompute["".concat(c_r1 + h - mth, "_").concat(c_c1 + c - mtc)].s) {
809
+ var bd_obj = {
810
+ rangeType: "cell",
811
+ value: {
812
+ row_index: h,
813
+ col_index: c,
814
+ l: borderInfoCompute["".concat(c_r1 + h - mth, "_").concat(c_c1 + c - mtc)].l,
815
+ r: borderInfoCompute["".concat(c_r1 + h - mth, "_").concat(c_c1 + c - mtc)].r,
816
+ t: borderInfoCompute["".concat(c_r1 + h - mth, "_").concat(c_c1 + c - mtc)].t,
817
+ b: borderInfoCompute["".concat(c_r1 + h - mth, "_").concat(c_c1 + c - mtc)].b
818
+ }
819
+ };
820
+ if (_lodash.default.isNil(cfg.borderInfo)) {
821
+ cfg.borderInfo = [];
822
+ }
823
+ cfg.borderInfo.push(bd_obj);
824
+ } else if (borderInfoCompute["".concat(h, "_").concat(c)]) {
825
+ var bd_obj = {
826
+ rangeType: "cell",
827
+ value: {
828
+ row_index: h,
829
+ col_index: c,
830
+ l: null,
831
+ r: null,
832
+ t: null,
833
+ b: null
834
+ }
835
+ };
836
+ if (_lodash.default.isNil(cfg.borderInfo)) {
837
+ cfg.borderInfo = [];
838
+ }
839
+ cfg.borderInfo.push(bd_obj);
840
+ } else if (borderInfoCompute["".concat(c_r1 + h - mth, "_").concat(c_c1 + c - mtc)]) {
841
+ var bd_obj = {
842
+ rangeType: "range",
843
+ borderType: "border-slash",
844
+ color: borderInfoCompute["".concat(c_r1 + h - minh, "_").concat(c_c1 + c - minc)].s.color,
845
+ style: borderInfoCompute["".concat(c_r1 + h - minh, "_").concat(c_c1 + c - minc)].s.style,
846
+ range: (0, _selection.normalizeSelection)(ctx, [{
847
+ row: [h, h],
848
+ column: [c, c]
849
+ }])
850
+ };
851
+ if (cfg.borderInfo == null) {
852
+ cfg.borderInfo = [];
853
+ }
854
+ cfg.borderInfo.push(bd_obj);
855
+ }
856
+ if (c_dataVerification["".concat(c_r1 + h - mth, "_").concat(c_c1 + c - mtc)]) {
857
+ if (_lodash.default.isNil(dataVerification)) {
858
+ dataVerification = _lodash.default.cloneDeep(((_d = ctx.luckysheetfile[(0, _utils.getSheetIndex)(ctx, ctx.currentSheetId)]) === null || _d === void 0 ? void 0 : _d.dataVerification) || {});
859
+ }
860
+ dataVerification["".concat(h, "_").concat(c)] = c_dataVerification["".concat(c_r1 + h - mth, "_").concat(c_c1 + c - mtc)];
861
+ }
862
+ if (((_e = x[c]) === null || _e === void 0 ? void 0 : _e.mc) != null) {
863
+ if ("rs" in x[c].mc) {
864
+ delete cfg.merge["".concat(x[c].mc.r, "_").concat(x[c].mc.c)];
865
+ }
866
+ delete x[c].mc;
867
+ }
868
+ var value = null;
869
+ if ((_f = copyData[h - mth]) === null || _f === void 0 ? void 0 : _f[c - mtc]) {
870
+ value = _lodash.default.cloneDeep(copyData[h - mth][c - mtc]);
871
+ if ((value === null || value === void 0 ? void 0 : value.v) && (value === null || value === void 0 ? void 0 : value.f) && (value === null || value === void 0 ? void 0 : value.isDataBlockFormula) && arr.length === 1) {
872
+ value.m = "Loading...";
873
+ }
874
+ }
875
+ if (!_lodash.default.isNil(value) && !_lodash.default.isNil(value.f)) {
876
+ var func = value.f;
877
+ if (offsetRow > 0) {
878
+ func = "=".concat((0, _formula.functionCopy)(ctx, func, "down", offsetRow));
879
+ }
880
+ if (offsetRow < 0) {
881
+ func = "=".concat((0, _formula.functionCopy)(ctx, func, "up", Math.abs(offsetRow)));
882
+ }
883
+ if (offsetCol > 0) {
884
+ func = "=".concat((0, _formula.functionCopy)(ctx, func, "right", offsetCol));
885
+ }
886
+ if (offsetCol < 0) {
887
+ func = "=".concat((0, _formula.functionCopy)(ctx, func, "left", Math.abs(offsetCol)));
888
+ }
889
+ var funcV = (0, _formula.execfunction)(ctx, func, h, c, undefined, undefined, true);
890
+ var afterUpdateCell = ctx.hooks.afterUpdateCell;
891
+ if (afterUpdateCell && arr.length === 1) {
892
+ afterUpdateCell(h, c, null, __assign(__assign({}, value), {
893
+ v: funcV[1],
894
+ m: "[object Promise]"
895
+ }));
896
+ }
897
+ if (!_lodash.default.isNil(value.spl)) {}
898
+ }
899
+ x[c] = _lodash.default.cloneDeep(value);
900
+ if (value != null && copyHasMC && ((_g = x === null || x === void 0 ? void 0 : x[c]) === null || _g === void 0 ? void 0 : _g.mc)) {
901
+ if (((_j = (_h = x === null || x === void 0 ? void 0 : x[c]) === null || _h === void 0 ? void 0 : _h.mc) === null || _j === void 0 ? void 0 : _j.rs) != null) {
902
+ x[c].mc.r = h;
903
+ x[c].mc.c = c;
904
+ cfg.merge["".concat(h, "_").concat(c)] = x[c].mc;
905
+ offsetMC["".concat(value.mc.r, "_").concat(value.mc.c)] = [x[c].mc.r, x[c].mc.c];
906
+ } else {
907
+ x[c] = {
908
+ mc: {
909
+ r: offsetMC["".concat(value.mc.r, "_").concat(value.mc.c)][0],
910
+ c: offsetMC["".concat(value.mc.r, "_").concat(value.mc.c)][1]
911
+ }
912
+ };
913
+ }
914
+ }
915
+ }
916
+ d[h] = x;
917
+ }
918
+ }
919
+ }
920
+ var cdformat = null;
921
+ if (copyRange.copyRange.length === 1) {
922
+ var c_file = ctx.luckysheetfile[(0, _utils.getSheetIndex)(ctx, copySheetIndex)];
923
+ var a_file = ctx.luckysheetfile[(0, _utils.getSheetIndex)(ctx, ctx.currentSheetId)];
924
+ var ruleArr_cf = _lodash.default.cloneDeep(c_file.luckysheet_conditionformat_save);
925
+ if (!_lodash.default.isNil(ruleArr_cf) && ruleArr_cf.length > 0) {
926
+ cdformat = (_k = _lodash.default.cloneDeep(a_file.luckysheet_conditionformat_save)) !== null && _k !== void 0 ? _k : [];
927
+ for (var i = 0; i < ruleArr_cf.length; i += 1) {
928
+ var cf_range = ruleArr_cf[i].cellrange;
929
+ var emptyRange = [];
930
+ for (var th = 1; th <= timesH; th += 1) {
931
+ for (var tc = 1; tc <= timesC; tc += 1) {
932
+ mth = minh + (th - 1) * copyh;
933
+ mtc = minc + (tc - 1) * copyc;
934
+ maxrowCache = minh + th * copyh;
935
+ maxcellCahe = minc + tc * copyc;
936
+ for (var j = 0; j < cf_range.length; j += 1) {
937
+ var range = (0, _modules.CFSplitRange)(cf_range[j], {
938
+ row: [c_r1, c_r2],
939
+ column: [c_c1, c_c2]
940
+ }, {
941
+ row: [mth, maxrowCache - 1],
942
+ column: [mtc, maxcellCahe - 1]
943
+ }, "operatePart");
944
+ if (range.length > 0) {
945
+ emptyRange = emptyRange.concat(range);
946
+ }
947
+ }
948
+ }
949
+ }
950
+ if (emptyRange.length > 0) {
951
+ ruleArr_cf[i].cellrange = emptyRange;
952
+ cdformat.push(ruleArr_cf[i]);
953
+ }
954
+ }
955
+ }
956
+ }
957
+ last.row = [minh, maxh];
958
+ last.column = [minc, maxc];
959
+ file.config = cfg;
960
+ file.luckysheet_conditionformat_save = cdformat;
961
+ file.dataVerification = __assign(__assign({}, file.dataVerification), dataVerification);
962
+ if (((_l = ctx.luckysheet_select_save) === null || _l === void 0 ? void 0 : _l.length) === 1 && ((_m = ctx.luckysheet_copy_save) === null || _m === void 0 ? void 0 : _m.copyRange.length) === 1) {
963
+ _lodash.default.forEach((_o = ctx.luckysheet_copy_save) === null || _o === void 0 ? void 0 : _o.copyRange, function (range) {
964
+ var _a, _b, _c;
965
+ var srcIndex = (0, _utils.getSheetIndex)(ctx, (_a = ctx.luckysheet_copy_save) === null || _a === void 0 ? void 0 : _a.dataSheetId);
966
+ for (var r = 0; r <= range.row[1] - range.row[0]; r += 1) {
967
+ for (var c = 0; c <= range.column[1] - range.column[0]; c += 1) {
968
+ var srcRow = r + range.row[0];
969
+ var srcCol = c + range.column[0];
970
+ var srcLink = (_b = ctx.luckysheetfile[srcIndex].hyperlink) === null || _b === void 0 ? void 0 : _b["".concat(srcRow, "_").concat(srcCol)];
971
+ if (!srcLink) continue;
972
+ var targetR = r + ctx.luckysheet_select_save[0].row[0];
973
+ var targetC = c + ctx.luckysheet_select_save[0].column[0];
974
+ setCellHyperlink(ctx, (_c = ctx.luckysheet_copy_save) === null || _c === void 0 ? void 0 : _c.dataSheetId, targetR, targetC, srcLink);
975
+ }
976
+ }
977
+ });
978
+ }
979
+ if (copyRowlChange || addr > 0 || addc > 0) {
980
+ (0, _refresh.jfrefreshgrid)(ctx, d, ctx.luckysheet_select_save);
981
+ } else {
982
+ (0, _refresh.jfrefreshgrid)(ctx, d, ctx.luckysheet_select_save);
983
+ }
984
+ }
985
+ function handleFormulaStringPaste(ctx, formulaStr) {
986
+ var r = ctx.luckysheet_select_save[0].row[0];
987
+ var c = ctx.luckysheet_select_save[0].column[0];
988
+ var funcV = (0, _formula.execfunction)(ctx, formulaStr, r, c, undefined, undefined, true);
989
+ var val = funcV[1];
990
+ var isDataBlockRespose = typeof val !== "string" && typeof val !== "number";
991
+ var d = (0, _context.getFlowdata)(ctx);
992
+ if (!d) return;
993
+ if (!d[r][c]) d[r][c] = {};
994
+ d[r][c].m = isDataBlockRespose ? "Loading..." : val.toString();
995
+ d[r][c].v = val;
996
+ d[r][c].f = formulaStr;
997
+ var cellTemp = {
998
+ m: "",
999
+ v: "",
1000
+ f: ""
1001
+ };
1002
+ cellTemp.m = isDataBlockRespose ? "Loading..." : val.toString();
1003
+ cellTemp.v = val;
1004
+ cellTemp.f = formulaStr;
1005
+ var afterUpdateCell = ctx.hooks.afterUpdateCell;
1006
+ if (afterUpdateCell && isDataBlockRespose) {
1007
+ afterUpdateCell(r, c, null, cellTemp);
1008
+ }
1009
+ }
1010
+ function parseAsLinkIfUrl(txtdata, ctx) {
1011
+ var _a, _b, _c, _d, _e, _f, _g;
1012
+ var urlRegex = /^(https?:\/\/[^\s]+)/;
1013
+ if (urlRegex.test(txtdata)) {
1014
+ var last = (_a = ctx.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[ctx.luckysheet_select_save.length - 1];
1015
+ if (last) {
1016
+ var rowIndex = (_d = (_b = last.row_focus) !== null && _b !== void 0 ? _b : (_c = last.row) === null || _c === void 0 ? void 0 : _c[0]) !== null && _d !== void 0 ? _d : 0;
1017
+ var colIndex = (_g = (_e = last.column_focus) !== null && _e !== void 0 ? _e : (_f = last.column) === null || _f === void 0 ? void 0 : _f[0]) !== null && _g !== void 0 ? _g : 0;
1018
+ (0, _modules.saveHyperlink)(ctx, rowIndex, colIndex, txtdata, "webpage", txtdata);
1019
+ }
1020
+ }
1021
+ }
1022
+ function handlePaste(ctx, e) {
1023
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
1024
+ var allowEdit = (0, _utils.isAllowEdit)(ctx);
1025
+ if (!allowEdit) return;
1026
+ if (_selection.selectionCache.isPasteAction) {
1027
+ ctx.luckysheetCellUpdate = [];
1028
+ _selection.selectionCache.isPasteAction = false;
1029
+ var clipboardData = e.clipboardData;
1030
+ if (!clipboardData) {
1031
+ clipboardData = window.clipboardData;
1032
+ }
1033
+ if (!clipboardData) return;
1034
+ var text = clipboardData.getData("text/plain");
1035
+ if (text) {
1036
+ parseAsLinkIfUrl(text, ctx);
1037
+ }
1038
+ var txtdata = clipboardData.getData("text/html") || clipboardData.getData("text/plain");
1039
+ var isEqual = true;
1040
+ if (txtdata.indexOf("fortune-copy-action-table") > -1 && ((_a = ctx.luckysheet_copy_save) === null || _a === void 0 ? void 0 : _a.copyRange) != null && ctx.luckysheet_copy_save.copyRange.length > 0) {
1041
+ var cpDataArr = [];
1042
+ var reg = /<tr.*?>(.*?)<\/tr>/g;
1043
+ var reg2 = /<td.*?>(.*?)<\/td>/g;
1044
+ var regArr = txtdata.match(reg) || [];
1045
+ for (var i = 0; i < regArr.length; i += 1) {
1046
+ var cpRowArr = [];
1047
+ var reg2Arr = regArr[i].match(reg2);
1048
+ if (!_lodash.default.isNil(reg2Arr)) {
1049
+ for (var j = 0; j < reg2Arr.length; j += 1) {
1050
+ var cpValue = reg2Arr[j].replace(/<td.*?>/g, "").replace(/<\/td>/g, "");
1051
+ cpRowArr.push(cpValue);
1052
+ }
1053
+ }
1054
+ cpDataArr.push(cpRowArr);
1055
+ }
1056
+ var copy_r1 = ctx.luckysheet_copy_save.copyRange[0].row[0];
1057
+ var copy_r2 = ctx.luckysheet_copy_save.copyRange[0].row[1];
1058
+ var copy_c1 = ctx.luckysheet_copy_save.copyRange[0].column[0];
1059
+ var copy_c2 = ctx.luckysheet_copy_save.copyRange[0].column[1];
1060
+ var copy_index = ctx.luckysheet_copy_save.dataSheetId;
1061
+ var d = void 0;
1062
+ if (copy_index === ctx.currentSheetId) {
1063
+ d = (0, _context.getFlowdata)(ctx);
1064
+ } else {
1065
+ var index = (0, _utils.getSheetIndex)(ctx, copy_index);
1066
+ if (_lodash.default.isNil(index)) return;
1067
+ d = ctx.luckysheetfile[index].data;
1068
+ }
1069
+ if (!d) return;
1070
+ for (var r = copy_r1; r <= copy_r2; r += 1) {
1071
+ if (r - copy_r1 > cpDataArr.length - 1) {
1072
+ break;
1073
+ }
1074
+ for (var c = copy_c1; c <= copy_c2; c += 1) {
1075
+ var cell = d[r][c];
1076
+ var isInlineStr = false;
1077
+ if (!_lodash.default.isNil(cell) && !_lodash.default.isNil(cell.mc) && _lodash.default.isNil(cell.mc.rs)) {
1078
+ continue;
1079
+ }
1080
+ var v = void 0;
1081
+ if (!_lodash.default.isNil(cell)) {
1082
+ if (((_d = (_c = (_b = cell.ct) === null || _b === void 0 ? void 0 : _b.fa) === null || _c === void 0 ? void 0 : _c.indexOf("w")) !== null && _d !== void 0 ? _d : -1) > -1) {
1083
+ v = (_f = (_e = d[r]) === null || _e === void 0 ? void 0 : _e[c]) === null || _f === void 0 ? void 0 : _f.v;
1084
+ } else {
1085
+ v = (_h = (_g = d[r]) === null || _g === void 0 ? void 0 : _g[c]) === null || _h === void 0 ? void 0 : _h.m;
1086
+ }
1087
+ } else {
1088
+ v = "";
1089
+ }
1090
+ if (_lodash.default.isNil(v) && ((_l = (_k = (_j = d[r]) === null || _j === void 0 ? void 0 : _j[c]) === null || _k === void 0 ? void 0 : _k.ct) === null || _l === void 0 ? void 0 : _l.t) === "inlineStr") {
1091
+ v = d[r][c].ct.s.map(function (val) {
1092
+ return val.v;
1093
+ }).join("");
1094
+ isInlineStr = true;
1095
+ }
1096
+ if (_lodash.default.isNil(v)) {
1097
+ v = "";
1098
+ }
1099
+ if (isInlineStr) {} else {
1100
+ if (_lodash.default.trim(cpDataArr[r - copy_r1][c - copy_c1]) !== _lodash.default.trim(v)) {
1101
+ isEqual = false;
1102
+ break;
1103
+ }
1104
+ }
1105
+ }
1106
+ }
1107
+ }
1108
+ var locale_fontjson_1 = (0, _locale.locale)(ctx).fontjson;
1109
+ if (((_o = (_m = ctx.hooks).beforePaste) === null || _o === void 0 ? void 0 : _o.call(_m, ctx.luckysheet_select_save, txtdata)) === false) {
1110
+ return;
1111
+ }
1112
+ if (txtdata.indexOf("fortune-copy-action-table") > -1 && ((_p = ctx.luckysheet_copy_save) === null || _p === void 0 ? void 0 : _p.copyRange) != null && ctx.luckysheet_copy_save.copyRange.length > 0 && isEqual) {
1113
+ if (ctx.luckysheet_paste_iscut) {
1114
+ ctx.luckysheet_paste_iscut = false;
1115
+ pasteHandlerOfCutPaste(ctx, ctx.luckysheet_copy_save);
1116
+ ctx.luckysheet_selection_range = [];
1117
+ } else {
1118
+ pasteHandlerOfCopyPaste(ctx, ctx.luckysheet_copy_save);
1119
+ }
1120
+ } else if (txtdata.indexOf("fortune-copy-action-image") > -1) {} else {
1121
+ if (txtdata.indexOf("table") > -1) {
1122
+ var ele = document.createElement("div");
1123
+ ele.innerHTML = txtdata;
1124
+ var trList = ele.querySelectorAll("table tr");
1125
+ if (trList.length === 0) {
1126
+ ele.remove();
1127
+ return;
1128
+ }
1129
+ var data_1 = new Array(trList.length);
1130
+ var colLen_1 = 0;
1131
+ _lodash.default.forEach(trList[0].querySelectorAll("td"), function (td) {
1132
+ var colspan = td.colSpan;
1133
+ if (Number.isNaN(colspan)) {
1134
+ colspan = 1;
1135
+ }
1136
+ colLen_1 += colspan;
1137
+ });
1138
+ for (var i = 0; i < data_1.length; i += 1) {
1139
+ data_1[i] = new Array(colLen_1);
1140
+ }
1141
+ var r_1 = 0;
1142
+ var borderInfo_1 = {};
1143
+ var styleInner = ((_q = ele.querySelectorAll("style")[0]) === null || _q === void 0 ? void 0 : _q.innerHTML) || "";
1144
+ var patternReg = /{([^}]*)}/g;
1145
+ var patternStyle = styleInner.match(patternReg);
1146
+ var nameReg = /^[^\t].*/gm;
1147
+ var patternName = _lodash.default.initial(styleInner.match(nameReg));
1148
+ var allStyleList_1 = patternName.length === (patternStyle === null || patternStyle === void 0 ? void 0 : patternStyle.length) && _typeof(patternName) === _typeof(patternStyle) ? _lodash.default.fromPairs(_lodash.default.zip(patternName, patternStyle)) : {};
1149
+ var index_1 = (0, _utils.getSheetIndex)(ctx, ctx.currentSheetId);
1150
+ if (!_lodash.default.isNil(index_1)) {
1151
+ if (_lodash.default.isNil(ctx.luckysheetfile[index_1].config)) {
1152
+ ctx.luckysheetfile[index_1].config = {};
1153
+ }
1154
+ if (_lodash.default.isNil(ctx.luckysheetfile[index_1].config.rowlen)) {
1155
+ ctx.luckysheetfile[index_1].config.rowlen = {};
1156
+ }
1157
+ var rowHeightList_1 = ctx.luckysheetfile[index_1].config.rowlen;
1158
+ _lodash.default.forEach(trList, function (tr) {
1159
+ var c = 0;
1160
+ var targetR = ctx.luckysheet_select_save[0].row[0] + r_1;
1161
+ var targetRowHeight = !_lodash.default.isNil(tr.getAttribute("height")) ? parseInt(tr.getAttribute("height"), 10) : null;
1162
+ if (_lodash.default.has(ctx.luckysheetfile[index_1].config.rowlen, targetR) && ctx.luckysheetfile[index_1].config.rowlen[targetR] !== targetRowHeight || !_lodash.default.has(ctx.luckysheetfile[index_1].config.rowlen, targetR) && ctx.luckysheetfile[index_1].defaultRowHeight !== targetRowHeight) {
1163
+ rowHeightList_1[targetR] = targetRowHeight;
1164
+ }
1165
+ _lodash.default.forEach(tr.querySelectorAll("td"), function (td) {
1166
+ var className = td.className;
1167
+ var cell = {};
1168
+ var txt = td.innerText || td.innerHTML;
1169
+ if (_lodash.default.trim(txt).length === 0) {
1170
+ cell.v = undefined;
1171
+ cell.m = "";
1172
+ } else {
1173
+ var mask = (0, _format.genarate)(txt);
1174
+ cell.m = mask[0], cell.ct = mask[1], cell.v = mask[2];
1175
+ if (/^0x?[a-fA-F0-9]+$/.test(txt)) {
1176
+ cell.ct = {
1177
+ fa: "@",
1178
+ t: "s"
1179
+ };
1180
+ cell.m = txt;
1181
+ cell.v = txt;
1182
+ }
1183
+ }
1184
+ var styleString = typeof allStyleList_1[".".concat(className)] === "string" ? allStyleList_1[".".concat(className)].substring(1, allStyleList_1[".".concat(className)].length - 1).split("\n\t") : [];
1185
+ var styles = {};
1186
+ _lodash.default.forEach(styleString, function (s) {
1187
+ var styleList = s.split(":");
1188
+ styles[styleList[0]] = styleList === null || styleList === void 0 ? void 0 : styleList[1].replace(";", "");
1189
+ });
1190
+ if (!_lodash.default.isNil(styles.border)) td.style.border = styles.border;
1191
+ var bg = td.style.backgroundColor || styles.background;
1192
+ if (bg === "rgba(0, 0, 0, 0)" || _lodash.default.isEmpty(bg)) {
1193
+ bg = undefined;
1194
+ }
1195
+ cell.bg = bg;
1196
+ var fontWight = td.style.fontWeight;
1197
+ cell.bl = (fontWight.toString() === "400" || fontWight === "normal" || _lodash.default.isEmpty(fontWight)) && !_lodash.default.includes(styles["font-style"], "bold") && (!styles["font-weight"] || styles["font-weight"] === "400") ? 0 : 1;
1198
+ cell.it = (td.style.fontStyle === "normal" || _lodash.default.isEmpty(td.style.fontStyle)) && !_lodash.default.includes(styles["font-style"], "italic") ? 0 : 1;
1199
+ cell.un = !_lodash.default.includes(styles["text-decoration"], "underline") ? undefined : 1;
1200
+ cell.cl = !_lodash.default.includes(td.innerHTML, "<s>") ? undefined : 1;
1201
+ var ff = td.style.fontFamily || styles["font-family"] || "";
1202
+ var ffs = ff.split(",");
1203
+ for (var i = 0; i < ffs.length; i += 1) {
1204
+ var fa = _lodash.default.trim(ffs[i].toLowerCase());
1205
+ fa = locale_fontjson_1[fa];
1206
+ if (_lodash.default.isNil(fa)) {
1207
+ cell.ff = 0;
1208
+ } else {
1209
+ cell.ff = fa;
1210
+ break;
1211
+ }
1212
+ }
1213
+ var fs = Math.round(styles["font-size"] ? parseInt(styles["font-size"].replace("pt", ""), 10) : parseInt(td.style.fontSize || "13", 10) * 72 / 96);
1214
+ cell.fs = fs;
1215
+ cell.fc = td.style.color || styles.color;
1216
+ var ht = td.style.textAlign || styles["text-align"] || "left";
1217
+ if (ht === "center") {
1218
+ cell.ht = 0;
1219
+ } else if (ht === "right") {
1220
+ cell.ht = 2;
1221
+ } else {
1222
+ cell.ht = 1;
1223
+ }
1224
+ var regex = /vertical-align:\s*(.*?);/;
1225
+ var vt = td.style.verticalAlign || styles["vertical-align"] || !_lodash.default.isNil(allStyleList_1.td) && allStyleList_1.td.match(regex).length > 0 && allStyleList_1.td.match(regex)[1] || "top";
1226
+ if (vt === "middle") {
1227
+ cell.vt = 0;
1228
+ } else if (vt === "top" || vt === "text-top") {
1229
+ cell.vt = 1;
1230
+ } else {
1231
+ cell.vt = 2;
1232
+ }
1233
+ if ("mso-rotate" in styles) {
1234
+ var rt = styles["mso-rotate"];
1235
+ cell.rt = parseFloat(rt);
1236
+ }
1237
+ while (c < colLen_1 && !_lodash.default.isNil(data_1[r_1][c])) {
1238
+ c += 1;
1239
+ }
1240
+ if (c === colLen_1) {
1241
+ return true;
1242
+ }
1243
+ if (_lodash.default.isNil(data_1[r_1][c])) {
1244
+ data_1[r_1][c] = cell;
1245
+ var rowspan = parseInt(td.getAttribute("rowspan"), 10);
1246
+ var colspan = parseInt(td.getAttribute("colspan"), 10);
1247
+ if (Number.isNaN(rowspan)) {
1248
+ rowspan = 1;
1249
+ }
1250
+ if (Number.isNaN(colspan)) {
1251
+ colspan = 1;
1252
+ }
1253
+ var r_ab = ctx.luckysheet_select_save[0].row[0] + r_1;
1254
+ var c_ab = ctx.luckysheet_select_save[0].column[0] + c;
1255
+ for (var rp = 0; rp < rowspan; rp += 1) {
1256
+ for (var cp = 0; cp < colspan; cp += 1) {
1257
+ if (rp === 0) {
1258
+ var bt = td.style.borderTop;
1259
+ if (!_lodash.default.isEmpty(bt) && bt.substring(0, 3).toLowerCase() !== "0px") {
1260
+ var width = td.style.borderTopWidth;
1261
+ var type = td.style.borderTopStyle;
1262
+ var color = td.style.borderTopColor;
1263
+ var borderconfig = (0, _cell.getQKBorder)(width, type, color);
1264
+ if (!borderInfo_1["".concat(r_1 + rp, "_").concat(c + cp)]) {
1265
+ borderInfo_1["".concat(r_1 + rp, "_").concat(c + cp)] = {};
1266
+ }
1267
+ borderInfo_1["".concat(r_1 + rp, "_").concat(c + cp)].t = {
1268
+ style: borderconfig[0],
1269
+ color: borderconfig[1]
1270
+ };
1271
+ }
1272
+ }
1273
+ if (rp === rowspan - 1) {
1274
+ var bb = td.style.borderBottom;
1275
+ if (!_lodash.default.isEmpty(bb) && bb.substring(0, 3).toLowerCase() !== "0px") {
1276
+ var width = td.style.borderBottomWidth;
1277
+ var type = td.style.borderBottomStyle;
1278
+ var color = td.style.borderBottomColor;
1279
+ var borderconfig = (0, _cell.getQKBorder)(width, type, color);
1280
+ if (!borderInfo_1["".concat(r_1 + rp, "_").concat(c + cp)]) {
1281
+ borderInfo_1["".concat(r_1 + rp, "_").concat(c + cp)] = {};
1282
+ }
1283
+ borderInfo_1["".concat(r_1 + rp, "_").concat(c + cp)].b = {
1284
+ style: borderconfig[0],
1285
+ color: borderconfig[1]
1286
+ };
1287
+ }
1288
+ }
1289
+ if (cp === 0) {
1290
+ var bl = td.style.borderLeft;
1291
+ if (!_lodash.default.isEmpty(bl) && bl.substring(0, 3).toLowerCase() !== "0px") {
1292
+ var width = td.style.borderLeftWidth;
1293
+ var type = td.style.borderLeftStyle;
1294
+ var color = td.style.borderLeftColor;
1295
+ var borderconfig = (0, _cell.getQKBorder)(width, type, color);
1296
+ if (!borderInfo_1["".concat(r_1 + rp, "_").concat(c + cp)]) {
1297
+ borderInfo_1["".concat(r_1 + rp, "_").concat(c + cp)] = {};
1298
+ }
1299
+ borderInfo_1["".concat(r_1 + rp, "_").concat(c + cp)].l = {
1300
+ style: borderconfig[0],
1301
+ color: borderconfig[1]
1302
+ };
1303
+ }
1304
+ }
1305
+ if (cp === colspan - 1) {
1306
+ var br = td.style.borderLeft;
1307
+ if (!_lodash.default.isEmpty(br) && br.substring(0, 3).toLowerCase() !== "0px") {
1308
+ var width = td.style.borderRightWidth;
1309
+ var type = td.style.borderRightStyle;
1310
+ var color = td.style.borderRightColor;
1311
+ var borderconfig = (0, _cell.getQKBorder)(width, type, color);
1312
+ if (!borderInfo_1["".concat(r_1 + rp, "_").concat(c + cp)]) {
1313
+ borderInfo_1["".concat(r_1 + rp, "_").concat(c + cp)] = {};
1314
+ }
1315
+ borderInfo_1["".concat(r_1 + rp, "_").concat(c + cp)].r = {
1316
+ style: borderconfig[0],
1317
+ color: borderconfig[1]
1318
+ };
1319
+ }
1320
+ }
1321
+ if (rp === 0 && cp === 0) {
1322
+ continue;
1323
+ }
1324
+ data_1[r_1 + rp][c + cp] = {
1325
+ mc: {
1326
+ r: r_ab,
1327
+ c: c_ab
1328
+ }
1329
+ };
1330
+ }
1331
+ }
1332
+ if (rowspan > 1 || colspan > 1) {
1333
+ var first = {
1334
+ rs: rowspan,
1335
+ cs: colspan,
1336
+ r: r_ab,
1337
+ c: c_ab
1338
+ };
1339
+ data_1[r_1][c].mc = first;
1340
+ }
1341
+ }
1342
+ c += 1;
1343
+ if (c === colLen_1) {
1344
+ return true;
1345
+ }
1346
+ return true;
1347
+ });
1348
+ r_1 += 1;
1349
+ });
1350
+ (0, _api.setRowHeight)(ctx, rowHeightList_1);
1351
+ }
1352
+ ctx.luckysheet_selection_range = [];
1353
+ pasteHandler(ctx, data_1, borderInfo_1);
1354
+ ele.remove();
1355
+ } else if (clipboardData.files.length === 1 && clipboardData.files[0].type.indexOf("image") > -1) {} else {
1356
+ txtdata = clipboardData.getData("text/plain");
1357
+ var isExcelFormula = txtdata.startsWith("=");
1358
+ if (isExcelFormula) {
1359
+ handleFormulaStringPaste(ctx, txtdata);
1360
+ } else {
1361
+ pasteHandler(ctx, txtdata);
1362
+ var _txtdata = clipboardData.getData("text/html") || clipboardData.getData("text/plain");
1363
+ var embedUrl = (0, _modules.sanitizeDuneUrl)(_txtdata);
1364
+ if (embedUrl) {
1365
+ var last = (_r = ctx.luckysheet_select_save) === null || _r === void 0 ? void 0 : _r[ctx.luckysheet_select_save.length - 1];
1366
+ if (last) {
1367
+ var rowIndex = (_u = (_s = last.row_focus) !== null && _s !== void 0 ? _s : (_t = last.row) === null || _t === void 0 ? void 0 : _t[0]) !== null && _u !== void 0 ? _u : 0;
1368
+ var colIndex = (_x = (_v = last.column_focus) !== null && _v !== void 0 ? _v : (_w = last.column) === null || _w === void 0 ? void 0 : _w[0]) !== null && _x !== void 0 ? _x : 0;
1369
+ var left = colIndex === 0 ? 0 : ctx.visibledatacolumn[colIndex - 1];
1370
+ var top_1 = rowIndex === 0 ? 0 : ctx.visibledatarow[rowIndex + 5];
1371
+ ctx.showDunePreview = {
1372
+ url: txtdata,
1373
+ position: {
1374
+ left: left,
1375
+ top: top_1
1376
+ }
1377
+ };
1378
+ }
1379
+ }
1380
+ }
1381
+ }
1382
+ }
1383
+ } else if (ctx.luckysheetCellUpdate.length > 0) {
1384
+ e.preventDefault();
1385
+ var clipboardData = e.clipboardData;
1386
+ if (!clipboardData) {
1387
+ clipboardData = window.clipboardData;
1388
+ }
1389
+ var text = clipboardData === null || clipboardData === void 0 ? void 0 : clipboardData.getData("text/plain");
1390
+ if (text) {
1391
+ document.execCommand("insertText", false, text);
1392
+ parseAsLinkIfUrl(text, ctx);
1393
+ }
1394
+ }
1395
+ }
1396
+ function handlePasteByClick(ctx, clipboardData, triggerType) {
1397
+ var _a, _b, _c;
1398
+ var allowEdit = (0, _utils.isAllowEdit)(ctx);
1399
+ if (!allowEdit) return;
1400
+ if (clipboardData) {
1401
+ var htmlWithPreservedNewlines = "<pre style=\"white-space: pre-wrap;\">".concat(clipboardData, "</pre>");
1402
+ _clipboard.default.writeHtml(htmlWithPreservedNewlines);
1403
+ }
1404
+ var textarea = document.querySelector("#fortune-copy-content");
1405
+ var data = (textarea === null || textarea === void 0 ? void 0 : textarea.innerHTML) || (textarea === null || textarea === void 0 ? void 0 : textarea.textContent);
1406
+ if (!data) return;
1407
+ if (((_b = (_a = ctx.hooks).beforePaste) === null || _b === void 0 ? void 0 : _b.call(_a, ctx.luckysheet_select_save, data)) === false) {
1408
+ return;
1409
+ }
1410
+ if (data.indexOf("fortune-copy-action-table") > -1 && ((_c = ctx.luckysheet_copy_save) === null || _c === void 0 ? void 0 : _c.copyRange) != null && ctx.luckysheet_copy_save.copyRange.length > 0) {
1411
+ if (ctx.luckysheet_paste_iscut) {
1412
+ ctx.luckysheet_paste_iscut = false;
1413
+ pasteHandlerOfCutPaste(ctx, ctx.luckysheet_copy_save);
1414
+ } else {
1415
+ pasteHandlerOfCopyPaste(ctx, ctx.luckysheet_copy_save);
1416
+ }
1417
+ } else if (data.indexOf("fortune-copy-action-image") > -1) {} else if (triggerType !== "btn") {
1418
+ var isExcelFormula = clipboardData.startsWith("=");
1419
+ if (isExcelFormula) {
1420
+ handleFormulaStringPaste(ctx, clipboardData);
1421
+ } else {
1422
+ pasteHandler(ctx, clipboardData);
1423
+ }
1424
+ } else {}
1425
+ }