@fileverse-dev/fortune-core 1.0.26 → 2.0.0

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