@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,1085 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.cancelFunctionrangeSelected = cancelFunctionrangeSelected;
7
- exports.cancelNormalSelected = cancelNormalSelected;
8
- exports.getCellValue = getCellValue;
9
- exports.getDataBySelectionNoCopy = getDataBySelectionNoCopy;
10
- exports.getFlattenedRange = getFlattenedRange;
11
- exports.getFontStyleByCell = getFontStyleByCell;
12
- exports.getInlineStringHTML = getInlineStringHTML;
13
- exports.getOrigincell = getOrigincell;
14
- exports.getQKBorder = getQKBorder;
15
- exports.getRange = getRange;
16
- exports.getRangeByTxt = getRangeByTxt;
17
- exports.getRangetxt = getRangetxt;
18
- exports.getRealCellValue = getRealCellValue;
19
- exports.getStyleByCell = getStyleByCell;
20
- exports.getcellFormula = getcellFormula;
21
- exports.getdatabyselection = getdatabyselection;
22
- exports.isAllSelectedCellsInStatus = isAllSelectedCellsInStatus;
23
- exports.luckysheetUpdateCell = luckysheetUpdateCell;
24
- exports.mergeBorder = mergeBorder;
25
- exports.mergeMoveMain = mergeMoveMain;
26
- exports.normalizedAttr = normalizedAttr;
27
- exports.normalizedCellAttr = normalizedCellAttr;
28
- exports.setCellValue = setCellValue;
29
- exports.updateCell = updateCell;
30
- var _lodash = _interopRequireDefault(require("lodash"));
31
- var _context = require("../context");
32
- var _utils = require("../utils");
33
- var _ConditionFormat = require("./ConditionFormat");
34
- var _dataVerification = require("./dataVerification");
35
- var _format = require("./format");
36
- var _api = require("../api");
37
- var _formula = require("./formula");
38
- var _inlineString = require("./inline-string");
39
- var _validation = require("./validation");
40
- var _text = require("./text");
41
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
42
- function normalizedCellAttr(cell, attr, defaultFontSize) {
43
- if (defaultFontSize === void 0) {
44
- defaultFontSize = 10;
45
- }
46
- var tf = {
47
- bl: 1,
48
- it: 1,
49
- ff: 1,
50
- cl: 1,
51
- un: 1
52
- };
53
- var value = cell === null || cell === void 0 ? void 0 : cell[attr];
54
- if (attr in tf || attr === "fs" && (0, _inlineString.isInlineStringCell)(cell)) {
55
- value || (value = "0");
56
- } else if (["fc", "bg", "bc"].includes(attr)) {
57
- if (["fc", "bc"].includes(attr)) {
58
- value || (value = "#000000");
59
- }
60
- if ((value === null || value === void 0 ? void 0 : value.indexOf("rgba")) > -1) {
61
- value = (0, _utils.rgbToHex)(value);
62
- }
63
- } else if (attr.substring(0, 2) === "bs") {
64
- value || (value = "none");
65
- } else if (attr === "ht" || attr === "vt") {
66
- var defaultValue = attr === "ht" ? "1" : "0";
67
- value = !_lodash.default.isNil(value) ? value.toString() : defaultValue;
68
- if (["0", "1", "2"].indexOf(value.toString()) === -1) {
69
- value = defaultValue;
70
- }
71
- } else if (attr === "fs") {
72
- value || (value = defaultFontSize.toString());
73
- } else if (attr === "tb" || attr === "tr") {
74
- value || (value = "0");
75
- }
76
- return value;
77
- }
78
- function normalizedAttr(data, r, c, attr) {
79
- if (!data || !data[r]) {
80
- console.warn("cell (%d, %d) is null", r, c);
81
- return null;
82
- }
83
- var cell = data[r][c];
84
- if (!cell) return undefined;
85
- return normalizedCellAttr(cell, attr);
86
- }
87
- function getCellValue(r, c, data, attr) {
88
- if (!attr) {
89
- attr = "v";
90
- }
91
- var d_value;
92
- if (!_lodash.default.isNil(r) && !_lodash.default.isNil(c)) {
93
- d_value = data[r][c];
94
- } else if (!_lodash.default.isNil(r)) {
95
- d_value = data[r];
96
- } else if (!_lodash.default.isNil(c)) {
97
- var newData = data[0].map(function (col, i) {
98
- return data.map(function (row) {
99
- return row[i];
100
- });
101
- });
102
- d_value = newData[c];
103
- } else {
104
- return data;
105
- }
106
- var retv = d_value;
107
- if (_lodash.default.isPlainObject(d_value)) {
108
- var d = d_value;
109
- retv = d[attr];
110
- if (attr === "f" && !_lodash.default.isNil(retv)) {
111
- retv = (0, _formula.functionHTMLGenerate)(retv);
112
- } else if (attr === "f") {
113
- retv = d.v;
114
- } else if (d && d.ct && d.ct.t === "d") {
115
- retv = d.m;
116
- }
117
- }
118
- if (retv === undefined) {
119
- retv = null;
120
- }
121
- return retv;
122
- }
123
- function setCellValue(ctx, r, c, d, v) {
124
- var _a, _b, _c, _d, _e, _f;
125
- if (_lodash.default.isNil(d)) {
126
- d = (0, _context.getFlowdata)(ctx);
127
- }
128
- if (!d) return;
129
- var cell = d[r][c];
130
- var vupdate;
131
- if (_lodash.default.isPlainObject(v)) {
132
- if (_lodash.default.isNil(cell)) {
133
- cell = v;
134
- } else {
135
- if (!_lodash.default.isNil(v.f)) {
136
- cell.f = v.f;
137
- } else if ("f" in cell) {
138
- delete cell.f;
139
- }
140
- if (!_lodash.default.isNil(v.ct)) {
141
- cell.ct = v.ct;
142
- }
143
- }
144
- if (_lodash.default.isPlainObject(v.v)) {
145
- vupdate = v.v.v;
146
- } else {
147
- vupdate = v.v;
148
- }
149
- } else {
150
- vupdate = v;
151
- }
152
- if ((0, _validation.isRealNull)(vupdate)) {
153
- if (_lodash.default.isPlainObject(cell)) {
154
- delete cell.m;
155
- delete cell.v;
156
- } else {
157
- cell = null;
158
- }
159
- d[r][c] = cell;
160
- return;
161
- }
162
- if ((0, _validation.isRealNull)(cell) || (_lodash.default.isString(cell) || _lodash.default.isNumber(cell)) && cell === v) {
163
- cell = {};
164
- }
165
- if (!cell) return;
166
- var vupdateStr = vupdate.toString();
167
- if (vupdateStr.substr(0, 1) === "'") {
168
- cell.m = vupdateStr.substr(1);
169
- cell.ct = {
170
- fa: "@",
171
- t: "s"
172
- };
173
- cell.v = vupdateStr.substr(1);
174
- cell.qp = 1;
175
- } else if (cell.qp === 1) {
176
- cell.m = vupdateStr;
177
- cell.ct = {
178
- fa: "@",
179
- t: "s"
180
- };
181
- cell.v = vupdateStr;
182
- } else if (vupdateStr.toUpperCase() === "TRUE" && (_lodash.default.isNil((_a = cell.ct) === null || _a === void 0 ? void 0 : _a.fa) || ((_b = cell.ct) === null || _b === void 0 ? void 0 : _b.fa) !== "@")) {
183
- cell.m = "TRUE";
184
- cell.ct = {
185
- fa: "General",
186
- t: "b"
187
- };
188
- cell.v = true;
189
- } else if (vupdateStr.toUpperCase() === "FALSE" && (_lodash.default.isNil((_c = cell.ct) === null || _c === void 0 ? void 0 : _c.fa) || ((_d = cell.ct) === null || _d === void 0 ? void 0 : _d.fa) !== "@")) {
190
- cell.m = "FALSE";
191
- cell.ct = {
192
- fa: "General",
193
- t: "b"
194
- };
195
- cell.v = false;
196
- } else if (vupdateStr.substr(-1) === "%" && (0, _validation.isRealNum)(vupdateStr.substring(0, vupdateStr.length - 1)) && (_lodash.default.isNil((_e = cell.ct) === null || _e === void 0 ? void 0 : _e.fa) || ((_f = cell.ct) === null || _f === void 0 ? void 0 : _f.fa) !== "@")) {
197
- cell.ct = {
198
- fa: "0%",
199
- t: "n"
200
- };
201
- cell.v = vupdateStr.substring(0, vupdateStr.length - 1) / 100;
202
- cell.m = vupdate;
203
- } else if ((0, _validation.valueIsError)(vupdate)) {
204
- cell.m = vupdateStr;
205
- if (!_lodash.default.isNil(cell.ct)) {
206
- cell.ct.t = "e";
207
- } else {
208
- cell.ct = {
209
- fa: "General",
210
- t: "e"
211
- };
212
- }
213
- cell.v = vupdate;
214
- } else {
215
- if (!_lodash.default.isNil(cell.f) && (0, _validation.isRealNum)(vupdate) && !/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[12])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i.test(vupdate)) {
216
- cell.v = parseFloat(vupdate);
217
- if (_lodash.default.isNil(cell.ct)) {
218
- cell.ct = {
219
- fa: "General",
220
- t: "n"
221
- };
222
- }
223
- if (cell.v === Infinity || cell.v === -Infinity) {
224
- cell.m = cell.v.toString();
225
- } else {
226
- if (cell.v.toString().indexOf("e") > -1) {
227
- var len = void 0;
228
- if (cell.v.toString().split(".").length === 1) {
229
- len = 0;
230
- } else {
231
- len = cell.v.toString().split(".")[1].split("e")[0].length;
232
- }
233
- if (len > 5) {
234
- len = 5;
235
- }
236
- cell.m = cell.v.toExponential(len).toString();
237
- } else {
238
- var v_p = Math.round(cell.v * 1000000000) / 1000000000;
239
- if (_lodash.default.isNil(cell.ct)) {
240
- var mask = (0, _format.genarate)(v_p);
241
- if (mask != null) {
242
- cell.m = mask[0].toString();
243
- }
244
- } else {
245
- var mask = (0, _format.update)(cell.ct.fa, v_p);
246
- cell.m = mask.toString();
247
- }
248
- }
249
- }
250
- } else if (!_lodash.default.isNil(cell.ct) && cell.ct.fa === "@") {
251
- cell.m = vupdateStr;
252
- cell.v = vupdate;
253
- } else if (cell.ct != null && cell.ct.t === "d" && _lodash.default.isString(vupdate)) {
254
- var mask = (0, _format.genarate)(vupdate);
255
- if (mask[1].t !== "d" || mask[1].fa === cell.ct.fa) {
256
- cell.m = mask[0], cell.ct = mask[1], cell.v = mask[2];
257
- } else {
258
- cell.v = mask[2];
259
- cell.m = (0, _format.update)(cell.ct.fa, cell.v);
260
- }
261
- } else if (!_lodash.default.isNil(cell.ct) && !_lodash.default.isNil(cell.ct.fa) && cell.ct.fa !== "General") {
262
- if ((0, _validation.isRealNum)(vupdate)) {
263
- vupdate = parseFloat(vupdate);
264
- }
265
- var mask = (0, _format.update)(cell.ct.fa, vupdate);
266
- if (mask === vupdate) {
267
- mask = (0, _format.genarate)(vupdate);
268
- cell.m = mask[0].toString();
269
- cell.ct = mask[1], cell.v = mask[2];
270
- } else {
271
- cell.m = mask.toString();
272
- cell.v = vupdate;
273
- }
274
- } else {
275
- if ((0, _validation.isRealNum)(vupdate) && !/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[12])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i.test(vupdate)) {
276
- if (typeof vupdate === "string") {
277
- var flag = vupdate.split("").every(function (ele) {
278
- return ele === "0" || ele === ".";
279
- });
280
- if (flag) {
281
- vupdate = parseFloat(vupdate);
282
- }
283
- }
284
- cell.v = vupdate;
285
- cell.ct = {
286
- fa: "General",
287
- t: "n"
288
- };
289
- if (cell.v === Infinity || cell.v === -Infinity) {
290
- cell.m = cell.v.toString();
291
- } else if (cell.v != null) {
292
- var mask = (0, _format.genarate)(cell.v);
293
- if (mask) {
294
- cell.m = mask[0].toString();
295
- }
296
- }
297
- } else {
298
- var mask = (0, _format.genarate)(vupdate);
299
- if (mask) {
300
- cell.m = mask[0].toString();
301
- cell.ct = mask[1], cell.v = mask[2];
302
- }
303
- }
304
- }
305
- }
306
- d[r][c] = cell;
307
- }
308
- function getRealCellValue(r, c, data, attr) {
309
- var value = getCellValue(r, c, data, "m");
310
- if (_lodash.default.isNil(value)) {
311
- value = getCellValue(r, c, data, attr);
312
- if (_lodash.default.isNil(value)) {
313
- var ct = getCellValue(r, c, data, "ct");
314
- if ((0, _inlineString.isInlineStringCT)(ct)) {
315
- value = ct.s;
316
- }
317
- }
318
- }
319
- return value;
320
- }
321
- function mergeBorder(ctx, d, row_index, col_index) {
322
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
323
- if (!d || !d[row_index]) {
324
- console.warn("Merge info is null", row_index, col_index);
325
- return null;
326
- }
327
- var value = d[row_index][col_index];
328
- if (!value) return null;
329
- if (value === null || value === void 0 ? void 0 : value.mc) {
330
- var margeMaindata = value.mc;
331
- if (!margeMaindata) {
332
- console.warn("Merge info is null", row_index, col_index);
333
- return null;
334
- }
335
- col_index = margeMaindata.c;
336
- row_index = margeMaindata.r;
337
- if (_lodash.default.isNil((_a = d === null || d === void 0 ? void 0 : d[row_index]) === null || _a === void 0 ? void 0 : _a[col_index])) {
338
- console.warn("Main merge Cell info is null", row_index, col_index);
339
- return null;
340
- }
341
- var col_rs = (_d = (_c = (_b = d[row_index]) === null || _b === void 0 ? void 0 : _b[col_index]) === null || _c === void 0 ? void 0 : _c.mc) === null || _d === void 0 ? void 0 : _d.cs;
342
- var row_rs = (_g = (_f = (_e = d[row_index]) === null || _e === void 0 ? void 0 : _e[col_index]) === null || _f === void 0 ? void 0 : _f.mc) === null || _g === void 0 ? void 0 : _g.rs;
343
- var mergeMain = (_j = (_h = d[row_index]) === null || _h === void 0 ? void 0 : _h[col_index]) === null || _j === void 0 ? void 0 : _j.mc;
344
- if (!mergeMain || _lodash.default.isNil(mergeMain === null || mergeMain === void 0 ? void 0 : mergeMain.rs) || _lodash.default.isNil(mergeMain === null || mergeMain === void 0 ? void 0 : mergeMain.cs) || _lodash.default.isNil(col_rs) || _lodash.default.isNil(row_rs)) {
345
- console.warn("Main merge info is null", mergeMain);
346
- return null;
347
- }
348
- var start_r = void 0;
349
- var end_r = void 0;
350
- var row = void 0;
351
- var row_pre = void 0;
352
- for (var r = row_index; r < mergeMain.rs + row_index; r += 1) {
353
- if (r === 0) {
354
- start_r = -1;
355
- } else {
356
- start_r = ctx.visibledatarow[r - 1] - 1;
357
- }
358
- end_r = ctx.visibledatarow[r];
359
- if (row_pre === undefined) {
360
- row_pre = start_r;
361
- row = end_r;
362
- } else if (row !== undefined) {
363
- row += end_r - start_r - 1;
364
- }
365
- }
366
- var start_c = void 0;
367
- var end_c = void 0;
368
- var col = void 0;
369
- var col_pre = void 0;
370
- for (var c = col_index; c < mergeMain.cs + col_index; c += 1) {
371
- if (c === 0) {
372
- start_c = 0;
373
- } else {
374
- start_c = ctx.visibledatacolumn[c - 1];
375
- }
376
- end_c = ctx.visibledatacolumn[c];
377
- if (col_pre === undefined) {
378
- col_pre = start_c;
379
- col = end_c;
380
- } else if (col !== undefined) {
381
- col += end_c - start_c;
382
- }
383
- }
384
- if (_lodash.default.isNil(row_pre) || _lodash.default.isNil(col_pre) || _lodash.default.isNil(row) || _lodash.default.isNil(col)) {
385
- console.warn("Main merge info row_pre or col_pre or row or col is null", mergeMain);
386
- return null;
387
- }
388
- return {
389
- row: [row_pre, row, row_index, row_index + row_rs - 1],
390
- column: [col_pre, col, col_index, col_index + col_rs - 1]
391
- };
392
- }
393
- return null;
394
- }
395
- function mergeMove(ctx, mc, columnseleted, rowseleted, s, top, height, left, width) {
396
- var row_st = mc.r;
397
- var row_ed = mc.r + mc.rs - 1;
398
- var col_st = mc.c;
399
- var col_ed = mc.c + mc.cs - 1;
400
- var ismatch = false;
401
- columnseleted[0] = Math.min(columnseleted[0], columnseleted[1]);
402
- rowseleted[0] = Math.min(rowseleted[0], rowseleted[1]);
403
- if (columnseleted[0] <= col_st && columnseleted[1] >= col_ed && rowseleted[0] <= row_st && rowseleted[1] >= row_ed || !(columnseleted[1] < col_st || columnseleted[0] > col_ed) && !(rowseleted[1] < row_st || rowseleted[0] > row_ed)) {
404
- var flowdata = (0, _context.getFlowdata)(ctx);
405
- if (!flowdata) return null;
406
- var margeset = mergeBorder(ctx, flowdata, mc.r, mc.c);
407
- if (margeset) {
408
- var row = margeset.row[1];
409
- var row_pre = margeset.row[0];
410
- var col = margeset.column[1];
411
- var col_pre = margeset.column[0];
412
- if (!(columnseleted[1] < col_st || columnseleted[0] > col_ed)) {
413
- if (rowseleted[0] <= row_ed && rowseleted[0] >= row_st) {
414
- height += top - row_pre;
415
- top = row_pre;
416
- rowseleted[0] = row_st;
417
- }
418
- if (rowseleted[1] >= row_st && rowseleted[1] <= row_ed) {
419
- if (s.row_focus >= row_st && s.row_focus <= row_ed) {
420
- height = row - top;
421
- } else {
422
- height = row - top;
423
- }
424
- rowseleted[1] = row_ed;
425
- }
426
- }
427
- if (!(rowseleted[1] < row_st || rowseleted[0] > row_ed)) {
428
- if (columnseleted[0] <= col_ed && columnseleted[0] >= col_st) {
429
- width += left - col_pre;
430
- left = col_pre;
431
- columnseleted[0] = col_st;
432
- }
433
- if (columnseleted[1] >= col_st && columnseleted[1] <= col_ed) {
434
- if (s.column_focus >= col_st && s.column_focus <= col_ed) {
435
- width = col - left;
436
- } else {
437
- width = col - left;
438
- }
439
- columnseleted[1] = col_ed;
440
- }
441
- }
442
- ismatch = true;
443
- }
444
- }
445
- if (ismatch) {
446
- return [columnseleted, rowseleted, top, height, left, width];
447
- }
448
- return null;
449
- }
450
- function mergeMoveMain(ctx, columnseleted, rowseleted, s, top, height, left, width) {
451
- var mergesetting = ctx.config.merge;
452
- if (!mergesetting) {
453
- return null;
454
- }
455
- var mcset = Object.keys(mergesetting);
456
- rowseleted[1] = Math.max(rowseleted[0], rowseleted[1]);
457
- columnseleted[1] = Math.max(columnseleted[0], columnseleted[1]);
458
- var offloop = true;
459
- var mergeMoveData = {};
460
- while (offloop) {
461
- offloop = false;
462
- for (var i = 0; i < mcset.length; i += 1) {
463
- var key = mcset[i];
464
- var mc = mergesetting[key];
465
- if (key in mergeMoveData) {
466
- continue;
467
- }
468
- var changeparam = mergeMove(ctx, mc, columnseleted, rowseleted, s, top, height, left, width);
469
- if (changeparam != null) {
470
- mergeMoveData[key] = mc;
471
- columnseleted = changeparam[0], rowseleted = changeparam[1], top = changeparam[2], height = changeparam[3], left = changeparam[4], width = changeparam[5];
472
- offloop = true;
473
- } else {
474
- delete mergeMoveData[key];
475
- }
476
- }
477
- }
478
- return [columnseleted, rowseleted, top, height, left, width];
479
- }
480
- function cancelFunctionrangeSelected(ctx) {
481
- if (ctx.formulaCache.selectingRangeIndex === -1) {
482
- ctx.formulaRangeSelect = undefined;
483
- }
484
- }
485
- function cancelNormalSelected(ctx) {
486
- cancelFunctionrangeSelected(ctx);
487
- ctx.luckysheetCellUpdate = [];
488
- ctx.formulaRangeHighlight = [];
489
- ctx.functionHint = null;
490
- ctx.formulaCache.rangestart = false;
491
- ctx.formulaCache.rangedrag_column_start = false;
492
- ctx.formulaCache.rangedrag_row_start = false;
493
- }
494
- function updateCell(ctx, r, c, $input, value, canvas) {
495
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
496
- var inputText = $input === null || $input === void 0 ? void 0 : $input.innerText;
497
- var inputHtml = $input === null || $input === void 0 ? void 0 : $input.innerHTML;
498
- var flowdata = (0, _context.getFlowdata)(ctx);
499
- if (!flowdata) return;
500
- var index = (0, _utils.getSheetIndex)(ctx, ctx.currentSheetId);
501
- var dataVerification = ctx.luckysheetfile[index].dataVerification;
502
- if (!_lodash.default.isNil(dataVerification)) {
503
- var dvItem = dataVerification["".concat(r, "_").concat(c)];
504
- if (!_lodash.default.isNil(dvItem) && dvItem.prohibitInput && !(0, _dataVerification.validateCellData)(ctx, dvItem, inputText)) {
505
- var failureText = (0, _dataVerification.getFailureText)(ctx, dvItem);
506
- cancelNormalSelected(ctx);
507
- ctx.warnDialog = failureText;
508
- return;
509
- }
510
- }
511
- var curv = flowdata[r][c];
512
- var oldValue = _lodash.default.cloneDeep(curv);
513
- var isPrevInline = (0, _inlineString.isInlineStringCell)(curv);
514
- var isCurInline = (inputText === null || inputText === void 0 ? void 0 : inputText.slice(0, 1)) !== "=" && (inputHtml === null || inputHtml === void 0 ? void 0 : inputHtml.substring(0, 5)) === "<span";
515
- var isCopyVal = false;
516
- if (!isCurInline && inputText && inputText.length > 0) {
517
- var splitArr = inputText.replace(/\r\n/g, "_x000D_").replace(/&#13;&#10;/g, "_x000D_").replace(/\r/g, "_x000D_").replace(/\n/g, "_x000D_").split("_x000D_");
518
- if (splitArr.length > 1 && inputHtml !== "<br>") {
519
- isCopyVal = true;
520
- isCurInline = true;
521
- inputText = splitArr.join("\r\n");
522
- }
523
- }
524
- if ((curv === null || curv === void 0 ? void 0 : curv.ct) && !value && !isCurInline && isPrevInline) {
525
- delete curv.ct.s;
526
- curv.ct.t = "g";
527
- curv.ct.fa = "General";
528
- curv.tb = "1";
529
- value = "";
530
- } else if (isCurInline) {
531
- if (!_lodash.default.isPlainObject(curv)) {
532
- curv = {};
533
- }
534
- curv || (curv = {});
535
- var fontSize = curv.fs || 10;
536
- if (!curv.ct) {
537
- curv.ct = {};
538
- curv.ct.fa = "General";
539
- curv.tb = "1";
540
- }
541
- curv.ct.t = "inlineStr";
542
- curv.ct.s = (0, _inlineString.convertSpanToShareString)($input.querySelectorAll("span"), curv);
543
- delete curv.fs;
544
- delete curv.f;
545
- delete curv.v;
546
- delete curv.m;
547
- curv.fs = fontSize;
548
- if (isCopyVal) {
549
- curv.ct.s = [{
550
- v: inputText,
551
- fs: fontSize
552
- }];
553
- }
554
- }
555
- value = value || ($input === null || $input === void 0 ? void 0 : $input.innerText);
556
- if (((_b = (_a = ctx.hooks).beforeUpdateCell) === null || _b === void 0 ? void 0 : _b.call(_a, r, c, value)) === false) {
557
- cancelNormalSelected(ctx);
558
- return;
559
- }
560
- if (!isCurInline) {
561
- if ((0, _validation.isRealNull)(value) && !isPrevInline) {
562
- if (!curv || (0, _validation.isRealNull)(curv.v) && !curv.spl && !curv.f) {
563
- cancelNormalSelected(ctx);
564
- return;
565
- }
566
- } else if (curv && curv.qp !== 1) {
567
- if (_lodash.default.isPlainObject(curv) && (value === curv.f || value === curv.v || value === curv.m)) {
568
- cancelNormalSelected(ctx);
569
- return;
570
- }
571
- if (value === curv) {
572
- cancelNormalSelected(ctx);
573
- return;
574
- }
575
- }
576
- if (_lodash.default.isString(value) && value.slice(0, 1) === "=" && value.length > 1) {} else if (_lodash.default.isPlainObject(curv) && curv && curv.ct && curv.ct.fa && curv.ct.fa !== "@" && !(0, _validation.isRealNull)(value)) {
577
- delete curv.m;
578
- if (curv.f) {
579
- delete curv.f;
580
- delete curv.spl;
581
- }
582
- }
583
- }
584
- var isRunExecFunction = true;
585
- var d = flowdata;
586
- var dynamicArrayItem = null;
587
- if (_lodash.default.isPlainObject(curv)) {
588
- if (!isCurInline) {
589
- if (_lodash.default.isString(value) && value.slice(0, 1) === "=" && value.length > 1) {
590
- var v = (0, _formula.execfunction)(ctx, value, r, c, undefined, undefined, true);
591
- isRunExecFunction = false;
592
- curv = _lodash.default.cloneDeep(((_c = d === null || d === void 0 ? void 0 : d[r]) === null || _c === void 0 ? void 0 : _c[c]) || {});
593
- curv.v = v[1], curv.f = v[2];
594
- if (v.length === 4 && v[3].type === "sparklines") {
595
- delete curv.m;
596
- delete curv.v;
597
- var curCalv = v[3].data;
598
- if (_lodash.default.isArray(curCalv) && !_lodash.default.isPlainObject(curCalv[0])) {
599
- curv.v = curCalv[0];
600
- } else {
601
- curv.spl = v[3].data;
602
- }
603
- } else if (v.length === 4 && v[3].type === "dynamicArrayItem") {
604
- dynamicArrayItem = v[3].data;
605
- }
606
- } else if (_lodash.default.isPlainObject(value)) {
607
- var valueFunction = value.f;
608
- if (_lodash.default.isString(valueFunction) && valueFunction.slice(0, 1) === "=" && valueFunction.length > 1) {
609
- var v = (0, _formula.execfunction)(ctx, valueFunction, r, c, undefined, undefined, true);
610
- isRunExecFunction = false;
611
- curv = _lodash.default.cloneDeep(((_d = d === null || d === void 0 ? void 0 : d[r]) === null || _d === void 0 ? void 0 : _d[c]) || {});
612
- curv.v = v[1], curv.f = v[2];
613
- if (v.length === 4 && v[3].type === "sparklines") {
614
- delete curv.m;
615
- delete curv.v;
616
- var curCalv = v[3].data;
617
- if (_lodash.default.isArray(curCalv) && !_lodash.default.isPlainObject(curCalv[0])) {
618
- curv.v = curCalv[0];
619
- } else {
620
- curv.spl = v[3].data;
621
- }
622
- } else if (v.length === 4 && v[3].type === "dynamicArrayItem") {
623
- dynamicArrayItem = v[3].data;
624
- }
625
- } else {
626
- Object.keys(value).forEach(function (attr) {
627
- curv[attr] = value[attr];
628
- });
629
- }
630
- } else {
631
- (0, _formula.delFunctionGroup)(ctx, r, c);
632
- (0, _formula.execFunctionGroup)(ctx, r, c, value);
633
- isRunExecFunction = false;
634
- curv = _lodash.default.cloneDeep(((_e = d === null || d === void 0 ? void 0 : d[r]) === null || _e === void 0 ? void 0 : _e[c]) || {});
635
- curv.v = value;
636
- delete curv.f;
637
- delete curv.spl;
638
- if (curv.qp === 1 && "".concat(value).substring(0, 1) !== "'") {
639
- curv.qp = 0;
640
- if (curv.ct) {
641
- curv.ct.fa = "General";
642
- curv.ct.t = "n";
643
- }
644
- }
645
- }
646
- }
647
- value = curv;
648
- } else {
649
- if (_lodash.default.isString(value) && value.slice(0, 1) === "=" && value.length > 1) {
650
- var v = (0, _formula.execfunction)(ctx, value, r, c, undefined, undefined, true);
651
- isRunExecFunction = false;
652
- value = {
653
- v: v[1],
654
- f: v[2]
655
- };
656
- if (v.length === 4 && v[3].type === "sparklines") {
657
- var curCalv = v[3].data;
658
- if (_lodash.default.isArray(curCalv) && !_lodash.default.isPlainObject(curCalv[0])) {
659
- value.v = curCalv[0];
660
- } else {
661
- value.spl = v[3].data;
662
- }
663
- } else if (v.length === 4 && v[3].type === "dynamicArrayItem") {
664
- dynamicArrayItem = v[3].data;
665
- }
666
- } else if (_lodash.default.isPlainObject(value)) {
667
- var valueFunction = value.f;
668
- if (_lodash.default.isString(valueFunction) && valueFunction.slice(0, 1) === "=" && valueFunction.length > 1) {
669
- var v = (0, _formula.execfunction)(ctx, valueFunction, r, c, undefined, undefined, true);
670
- isRunExecFunction = false;
671
- value.v = v[1], value.f = v[2];
672
- if (v.length === 4 && v[3].type === "sparklines") {
673
- var curCalv = v[3].data;
674
- if (_lodash.default.isArray(curCalv) && !_lodash.default.isPlainObject(curCalv[0])) {
675
- value.v = curCalv[0];
676
- } else {
677
- value.spl = v[3].data;
678
- }
679
- } else if (v.length === 4 && v[3].type === "dynamicArrayItem") {
680
- dynamicArrayItem = v[3].data;
681
- }
682
- } else {
683
- var v = curv;
684
- if (_lodash.default.isNil(value.v)) {
685
- value.v = v;
686
- }
687
- }
688
- } else {
689
- (0, _formula.delFunctionGroup)(ctx, r, c);
690
- (0, _formula.execFunctionGroup)(ctx, r, c, value);
691
- isRunExecFunction = false;
692
- }
693
- }
694
- setCellValue(ctx, r, c, d, value);
695
- cancelNormalSelected(ctx);
696
- if ((curv === null || curv === void 0 ? void 0 : curv.tb) === "2" && curv.v || (0, _inlineString.isInlineStringCell)(d[r][c])) {
697
- var defaultrowlen = ctx.defaultrowlen;
698
- var cfg = ctx.luckysheetfile[(0, _utils.getSheetIndex)(ctx, ctx.currentSheetId)].config || {};
699
- if (!(((_f = cfg.columnlen) === null || _f === void 0 ? void 0 : _f[c]) && ((_g = cfg.rowlen) === null || _g === void 0 ? void 0 : _g[r]))) {
700
- var cellWidth = ((_h = cfg.columnlen) === null || _h === void 0 ? void 0 : _h[c]) || ctx.defaultcollen;
701
- var textInfo = canvas ? (0, _text.getCellTextInfo)(d[r][c], canvas, ctx, {
702
- r: r,
703
- c: c,
704
- cellWidth: cellWidth
705
- }) : null;
706
- var currentRowLen = defaultrowlen;
707
- if (textInfo) {
708
- currentRowLen = textInfo.textHeightAll + 2;
709
- }
710
- var previousRowHeight = (0, _api.getRowHeight)(ctx, [r])[r];
711
- if (currentRowLen > defaultrowlen && !((_j = cfg.customHeight) === null || _j === void 0 ? void 0 : _j[r]) && previousRowHeight < currentRowLen) {
712
- if (_lodash.default.isNil(cfg.rowlen)) cfg.rowlen = {};
713
- cfg.rowlen[r] = currentRowLen;
714
- }
715
- }
716
- }
717
- if (ctx.hooks.afterUpdateCell) {
718
- var newValue_1 = _lodash.default.cloneDeep(flowdata[r][c]);
719
- var afterUpdateCell_1 = ctx.hooks.afterUpdateCell;
720
- setTimeout(function () {
721
- afterUpdateCell_1 === null || afterUpdateCell_1 === void 0 ? void 0 : afterUpdateCell_1(r, c, oldValue, newValue_1);
722
- });
723
- }
724
- ctx.formulaCache.execFunctionGlobalData = null;
725
- }
726
- function getOrigincell(ctx, r, c, i) {
727
- var data = (0, _context.getFlowdata)(ctx, i);
728
- if (_lodash.default.isNil(r) || _lodash.default.isNil(c)) {
729
- return null;
730
- }
731
- if (!data || !data[r] || !data[r][c]) {
732
- return null;
733
- }
734
- return data[r][c];
735
- }
736
- function getcellFormula(ctx, r, c, i, data) {
737
- var cell;
738
- if (_lodash.default.isNil(data)) {
739
- cell = getOrigincell(ctx, r, c, i);
740
- } else {
741
- cell = data[r][c];
742
- }
743
- if (_lodash.default.isNil(cell)) {
744
- return null;
745
- }
746
- return cell.f;
747
- }
748
- function getRange(ctx) {
749
- var rangeArr = _lodash.default.cloneDeep(ctx.luckysheet_select_save);
750
- var result = [];
751
- if (!rangeArr) return result;
752
- for (var i = 0; i < rangeArr.length; i += 1) {
753
- var rangeItem = rangeArr[i];
754
- var temp = {
755
- row: rangeItem.row,
756
- column: rangeItem.column
757
- };
758
- result.push(temp);
759
- }
760
- return result;
761
- }
762
- function getFlattenedRange(ctx, range) {
763
- range = range || getRange(ctx);
764
- var result = [];
765
- range.forEach(function (ele) {
766
- var rs = ele.row;
767
- var cs = ele.column;
768
- for (var r = rs[0]; r <= rs[1]; r += 1) {
769
- for (var c = cs[0]; c <= cs[1]; c += 1) {
770
- result.push({
771
- r: r,
772
- c: c
773
- });
774
- }
775
- }
776
- });
777
- return result;
778
- }
779
- function getRangetxt(ctx, sheetId, range, currentId) {
780
- var sheettxt = "";
781
- if (currentId == null) {
782
- currentId = ctx.currentSheetId;
783
- }
784
- if (sheetId !== currentId) {
785
- var index = (0, _utils.getSheetIndex)(ctx, sheetId);
786
- if (index == null) return "";
787
- sheettxt = ctx.luckysheetfile[index].name.replace(/'/g, "''");
788
- if (/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/.test(sheettxt)) {
789
- sheettxt += "!";
790
- } else {
791
- sheettxt = "'".concat(sheettxt, "'!");
792
- }
793
- }
794
- var row0 = range.row[0];
795
- var row1 = range.row[1];
796
- var column0 = range.column[0];
797
- var column1 = range.column[1];
798
- if (row0 == null && row1 == null) {
799
- return "".concat(sheettxt + (0, _utils.indexToColumnChar)(column0), ":").concat((0, _utils.indexToColumnChar)(column1));
800
- }
801
- if (column0 == null && column1 == null) {
802
- return "".concat(sheettxt + (row0 + 1), ":").concat(row1 + 1);
803
- }
804
- if (column0 === column1 && row0 === row1) {
805
- return sheettxt + (0, _utils.indexToColumnChar)(column0) + (row0 + 1);
806
- }
807
- return "".concat(sheettxt + (0, _utils.indexToColumnChar)(column0) + (row0 + 1), ":").concat((0, _utils.indexToColumnChar)(column1)).concat(row1 + 1);
808
- }
809
- function getRangeByTxt(ctx, txt) {
810
- var range = [];
811
- if (txt.indexOf(",") !== -1) {
812
- var arr = txt.split(",");
813
- for (var i = 0; i < arr.length; i += 1) {
814
- if ((0, _formula.iscelldata)(arr[i])) {
815
- range.push((0, _formula.getcellrange)(ctx, arr[i]));
816
- } else {
817
- range = [];
818
- break;
819
- }
820
- }
821
- } else {
822
- if ((0, _formula.iscelldata)(txt)) {
823
- range.push((0, _formula.getcellrange)(ctx, txt));
824
- }
825
- }
826
- return range;
827
- }
828
- function isAllSelectedCellsInStatus(ctx, attr, status) {
829
- var _a, _b, _c, _d;
830
- if (!_lodash.default.isEmpty(ctx.luckysheetCellUpdate)) {
831
- var w = window.getSelection();
832
- if (!w) return false;
833
- if (w.rangeCount === 0) return false;
834
- var range = w.getRangeAt(0);
835
- if (range.collapsed === true) {
836
- return false;
837
- }
838
- var endContainer = range.endContainer;
839
- var startContainer = range.startContainer;
840
- var cssField_1 = _lodash.default.camelCase(_inlineString.attrToCssName[attr]);
841
- if (startContainer === endContainer) {
842
- return !_lodash.default.isEmpty((_a = startContainer.parentElement) === null || _a === void 0 ? void 0 : _a.style[cssField_1]);
843
- }
844
- if (((_b = startContainer.parentElement) === null || _b === void 0 ? void 0 : _b.tagName) === "SPAN" && ((_c = endContainer.parentElement) === null || _c === void 0 ? void 0 : _c.tagName) === "SPAN") {
845
- var startSpan = startContainer.parentNode;
846
- var endSpan = endContainer.parentNode;
847
- var allSpans = (_d = startSpan === null || startSpan === void 0 ? void 0 : startSpan.parentNode) === null || _d === void 0 ? void 0 : _d.querySelectorAll("span");
848
- if (allSpans) {
849
- var startSpanIndex = _lodash.default.indexOf(allSpans, startSpan);
850
- var endSpanIndex = _lodash.default.indexOf(allSpans, endSpan);
851
- var rangeSpans = [];
852
- for (var i = startSpanIndex; i <= endSpanIndex; i += 1) {
853
- rangeSpans.push(allSpans[i]);
854
- }
855
- return _lodash.default.every(rangeSpans, function (s) {
856
- return !_lodash.default.isEmpty(s.style[cssField_1]);
857
- });
858
- }
859
- }
860
- }
861
- var cells = getFlattenedRange(ctx);
862
- var flowdata = (0, _context.getFlowdata)(ctx);
863
- return cells.every(function (_a) {
864
- var _b;
865
- var r = _a.r,
866
- c = _a.c;
867
- var cell = (_b = flowdata === null || flowdata === void 0 ? void 0 : flowdata[r]) === null || _b === void 0 ? void 0 : _b[c];
868
- if (_lodash.default.isNil(cell)) {
869
- return false;
870
- }
871
- return cell[attr] === status;
872
- });
873
- }
874
- function getFontStyleByCell(cell, checksAF, checksCF, isCheck) {
875
- if (isCheck === void 0) {
876
- isCheck = true;
877
- }
878
- var style = {};
879
- if (!cell) {
880
- return style;
881
- }
882
- _lodash.default.forEach(cell, function (v, key) {
883
- var _a, _b, _c, _d;
884
- var value = cell[key];
885
- if (isCheck) {
886
- value = normalizedCellAttr(cell, key);
887
- }
888
- var valueNum = Number(value);
889
- if (key === "bl" && valueNum !== 0) {
890
- style.fontWeight = "bold";
891
- }
892
- if (key === "it" && valueNum !== 0) {
893
- style.fontStyle = "italic";
894
- }
895
- if (key === "fs" && valueNum !== 10) {
896
- style.fontSize = "".concat(valueNum, "pt");
897
- }
898
- if (key === "fc" && value !== "#000000" || ((_a = checksAF === null || checksAF === void 0 ? void 0 : checksAF.length) !== null && _a !== void 0 ? _a : 0) > 0 || (checksCF === null || checksCF === void 0 ? void 0 : checksCF.textColor)) {
899
- if (checksCF === null || checksCF === void 0 ? void 0 : checksCF.textColor) {
900
- style.color = checksCF.textColor;
901
- } else if (((_b = checksAF === null || checksAF === void 0 ? void 0 : checksAF.length) !== null && _b !== void 0 ? _b : 0) > 0) {
902
- style.color = checksAF[0];
903
- } else {
904
- style.color = value;
905
- }
906
- }
907
- if (key === "cl" && valueNum !== 0) {
908
- style.textDecoration = "line-through";
909
- }
910
- if (key === "un" && (valueNum === 1 || valueNum === 3)) {
911
- var color = (_c = cell._color) !== null && _c !== void 0 ? _c : cell.fc;
912
- var fs = (_d = cell._fontSize) !== null && _d !== void 0 ? _d : cell.fs;
913
- style.borderBottom = "".concat(Math.floor(fs / 9), "px solid ").concat(color);
914
- }
915
- });
916
- return style;
917
- }
918
- function getStyleByCell(ctx, d, r, c) {
919
- var _a;
920
- var style = {};
921
- var checksAF = [];
922
- var cf_compute = (0, _ConditionFormat.getComputeMap)(ctx);
923
- var checksCF = (0, _ConditionFormat.checkCF)(r, c, cf_compute);
924
- var cell = (_a = d === null || d === void 0 ? void 0 : d[r]) === null || _a === void 0 ? void 0 : _a[c];
925
- if (!cell) return {};
926
- var isInline = (0, _inlineString.isInlineStringCell)(cell);
927
- if ("bg" in cell) {
928
- var value = normalizedCellAttr(cell, "bg");
929
- if (checksCF === null || checksCF === void 0 ? void 0 : checksCF.cellColor) {
930
- if (checksCF === null || checksCF === void 0 ? void 0 : checksCF.cellColor) {
931
- style.background = "".concat(checksCF.cellColor);
932
- } else if (checksAF.length > 1) {
933
- style.background = "".concat(checksAF[1]);
934
- } else {
935
- style.background = "".concat(value);
936
- }
937
- }
938
- }
939
- if ("ht" in cell) {
940
- var value = normalizedCellAttr(cell, "ht");
941
- if (Number(value) === 0) {
942
- style.textAlign = "center";
943
- } else if (Number(value) === 2) {
944
- style.textAlign = "right";
945
- }
946
- }
947
- if ("vt" in cell) {
948
- var value = normalizedCellAttr(cell, "vt");
949
- if (Number(value) === 0) {
950
- style.alignItems = "center";
951
- } else if (Number(value) === 2) {
952
- style.alignItems = "flex-end";
953
- }
954
- }
955
- if (!isInline) {
956
- style = _lodash.default.assign(style, getFontStyleByCell(cell, checksAF, checksCF));
957
- }
958
- return style;
959
- }
960
- function getInlineStringHTML(r, c, data) {
961
- var ct = getCellValue(r, c, data, "ct");
962
- if ((0, _inlineString.isInlineStringCT)(ct)) {
963
- var strings = ct.s;
964
- var value = "";
965
- for (var i = 0; i < strings.length; i += 1) {
966
- var strObj = strings[i];
967
- if (strObj.v) {
968
- var style = getFontStyleByCell(strObj);
969
- var styleStr = _lodash.default.map(style, function (v, key) {
970
- return "".concat(_lodash.default.kebabCase(key), ":").concat(_lodash.default.isNumber(v) ? "".concat(v, "px") : v, ";");
971
- }).join("");
972
- value += "<span class=\"luckysheet-input-span\" index='".concat(i, "' style='").concat(styleStr, "'>").concat(strObj.v, "</span>");
973
- }
974
- }
975
- return value;
976
- }
977
- return "";
978
- }
979
- function getQKBorder(width, type, color) {
980
- var bordertype = "";
981
- if (width.toString().indexOf("pt") > -1) {
982
- var nWidth = parseFloat(width);
983
- if (nWidth < 1) {} else if (nWidth < 1.5) {
984
- bordertype = "Medium";
985
- } else {
986
- bordertype = "Thick";
987
- }
988
- } else {
989
- var nWidth = parseFloat(width);
990
- if (nWidth < 2) {} else if (nWidth < 3) {
991
- bordertype = "Medium";
992
- } else {
993
- bordertype = "Thick";
994
- }
995
- }
996
- var style = 0;
997
- type = type.toLowerCase();
998
- if (type === "double") {
999
- style = 2;
1000
- } else if (type === "dotted") {
1001
- if (bordertype === "Medium" || bordertype === "Thick") {
1002
- style = 3;
1003
- } else {
1004
- style = 10;
1005
- }
1006
- } else if (type === "dashed") {
1007
- if (bordertype === "Medium" || bordertype === "Thick") {
1008
- style = 4;
1009
- } else {
1010
- style = 9;
1011
- }
1012
- } else if (type === "solid") {
1013
- if (bordertype === "Medium") {
1014
- style = 8;
1015
- } else if (bordertype === "Thick") {
1016
- style = 13;
1017
- } else {
1018
- style = 1;
1019
- }
1020
- }
1021
- return [style, color];
1022
- }
1023
- function getdatabyselection(ctx, range, sheetId) {
1024
- if (range == null && ctx.luckysheet_select_save) {
1025
- range = ctx.luckysheet_select_save[0];
1026
- }
1027
- if (!range) return [];
1028
- if (range.row == null || range.row.length === 0) {
1029
- return [];
1030
- }
1031
- var d;
1032
- var cfg;
1033
- if (sheetId != null && sheetId !== ctx.currentSheetId) {
1034
- d = ctx.luckysheetfile[(0, _utils.getSheetIndex)(ctx, sheetId)].data;
1035
- cfg = ctx.luckysheetfile[(0, _utils.getSheetIndex)(ctx, sheetId)].config;
1036
- } else {
1037
- d = (0, _context.getFlowdata)(ctx);
1038
- cfg = ctx.config;
1039
- }
1040
- var data = [];
1041
- for (var r = range.row[0]; r <= range.row[1]; r += 1) {
1042
- if ((d === null || d === void 0 ? void 0 : d[r]) == null) {
1043
- continue;
1044
- }
1045
- if ((cfg === null || cfg === void 0 ? void 0 : cfg.rowhidden) != null && cfg.rowhidden[r] != null) {
1046
- continue;
1047
- }
1048
- var row = [];
1049
- for (var c = range.column[0]; c <= range.column[1]; c += 1) {
1050
- if ((cfg === null || cfg === void 0 ? void 0 : cfg.colhidden) != null && cfg.colhidden[c] != null) {
1051
- continue;
1052
- }
1053
- row.push(d[r][c]);
1054
- }
1055
- data.push(row);
1056
- }
1057
- return data;
1058
- }
1059
- function luckysheetUpdateCell(ctx, row_index, col_index) {
1060
- ctx.luckysheetCellUpdate = [row_index, col_index];
1061
- }
1062
- function getDataBySelectionNoCopy(ctx, range) {
1063
- if (!range || !range.row || range.row.length === 0) return [];
1064
- var data = [];
1065
- var flowData = (0, _context.getFlowdata)(ctx);
1066
- if (!flowData) return [];
1067
- for (var r = range.row[0]; r <= range.row[1]; r += 1) {
1068
- var row = [];
1069
- if (ctx.config.rowhidden != null && ctx.config.rowhidden[r] != null) {
1070
- continue;
1071
- }
1072
- for (var c = range.column[0]; c <= range.column[1]; c += 1) {
1073
- var value = null;
1074
- if (ctx.config.colhidden != null && ctx.config.colhidden[c] != null) {
1075
- continue;
1076
- }
1077
- if (flowData[r] != null && flowData[r][c] != null) {
1078
- value = flowData[r][c];
1079
- }
1080
- row.push(value);
1081
- }
1082
- data.push(row);
1083
- }
1084
- return data;
1085
- }