@fileverse-dev/fortune-react 1.1.0 → 1.1.1

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 (444) hide show
  1. package/es/assets/paint-roller.png +0 -0
  2. package/es/components/ChangeColor/index.css +76 -0
  3. package/{dist/packages/react/src → es}/components/ChangeColor/index.d.ts +7 -7
  4. package/es/components/ChangeColor/index.js +41 -0
  5. package/{dist/packages/react/src → es}/components/ConditionFormat/ConditionRules.d.ts +6 -6
  6. package/es/components/ConditionFormat/ConditionRules.js +323 -0
  7. package/es/components/ConditionFormat/index.css +210 -0
  8. package/{dist/packages/react/src → es}/components/ConditionFormat/index.d.ts +7 -7
  9. package/es/components/ConditionFormat/index.js +252 -0
  10. package/{dist/packages/react/src → es}/components/ContextMenu/Divider.d.ts +3 -3
  11. package/es/components/ContextMenu/Divider.js +7 -0
  12. package/{dist/packages/react/src → es}/components/ContextMenu/FilterMenu.d.ts +3 -3
  13. package/es/components/ContextMenu/FilterMenu.js +612 -0
  14. package/{dist/packages/react/src → es}/components/ContextMenu/Menu.d.ts +8 -8
  15. package/es/components/ContextMenu/Menu.js +25 -0
  16. package/{dist/packages/react/src → es}/components/ContextMenu/SheetTab.d.ts +4 -4
  17. package/es/components/ContextMenu/SheetTab.js +223 -0
  18. package/es/components/ContextMenu/index.css +322 -0
  19. package/{dist/packages/react/src → es}/components/ContextMenu/index.d.ts +5 -5
  20. package/es/components/ContextMenu/index.js +1054 -0
  21. package/es/components/CryptoDenominationSelector/index.css +67 -0
  22. package/es/components/CryptoDenominationSelector/index.d.ts +8 -0
  23. package/es/components/CryptoDenominationSelector/index.js +271 -0
  24. package/es/components/CustomSort/index.css +23 -0
  25. package/{dist/packages/react/src → es}/components/CustomSort/index.d.ts +4 -4
  26. package/es/components/CustomSort/index.js +113 -0
  27. package/{dist/packages/react/src → es}/components/DataVerification/DropdownList.d.ts +4 -4
  28. package/es/components/DataVerification/DropdownList.js +126 -0
  29. package/{dist/packages/react/src → es}/components/DataVerification/RangeDialog.d.ts +4 -4
  30. package/es/components/DataVerification/RangeDialog.js +105 -0
  31. package/{dist/packages/react/src → es}/components/DataVerification/getDisplayedRangeTxt.d.ts +2 -2
  32. package/es/components/DataVerification/getDisplayedRangeTxt.js +9 -0
  33. package/es/components/DataVerification/index.css +202 -0
  34. package/{dist/packages/react/src → es}/components/DataVerification/index.d.ts +4 -4
  35. package/es/components/DataVerification/index.js +398 -0
  36. package/es/components/Dialog/index.css +64 -0
  37. package/{dist/packages/react/src → es}/components/Dialog/index.d.ts +15 -15
  38. package/es/components/Dialog/index.js +72 -0
  39. package/{dist/packages/react/src → es}/components/DuneChartsInputModal/DuneChartsInputModal.d.ts +11 -11
  40. package/es/components/DuneChartsInputModal/DuneChartsInputModal.js +95 -0
  41. package/es/components/DuneChartsInputModal/duneChartsInputModal.css +98 -0
  42. package/{dist/packages/react/src → es}/components/DunePreview/DunePreview.d.ts +13 -13
  43. package/es/components/DunePreview/DunePreview.js +46 -0
  44. package/es/components/DunePreview/index.css +57 -0
  45. package/{dist/packages/react/src → es}/components/FilterOption/index.d.ts +5 -5
  46. package/es/components/FilterOption/index.js +121 -0
  47. package/es/components/FormatSearch/index.css +19 -0
  48. package/{dist/packages/react/src → es}/components/FormatSearch/index.d.ts +6 -6
  49. package/es/components/FormatSearch/index.js +133 -0
  50. package/es/components/FormulaSearch/index.css +65 -0
  51. package/{dist/packages/react/src → es}/components/FormulaSearch/index.d.ts +5 -5
  52. package/es/components/FormulaSearch/index.js +198 -0
  53. package/{dist/packages/react/src → es}/components/FxEditor/NameBox.d.ts +3 -3
  54. package/es/components/FxEditor/NameBox.js +29 -0
  55. package/es/components/FxEditor/index.css +72 -0
  56. package/{dist/packages/react/src → es}/components/FxEditor/index.d.ts +4 -4
  57. package/es/components/FxEditor/index.js +167 -0
  58. package/es/components/IFrameBoxs/iFrameBoxs.css +16 -0
  59. package/{dist/packages/react/src → es}/components/IFrameBoxs/iFrameBoxs.d.ts +4 -4
  60. package/es/components/IFrameBoxs/iFrameBoxs.js +142 -0
  61. package/{dist/packages/react/src → es}/components/ImgBoxs/index.d.ts +3 -3
  62. package/es/components/ImgBoxs/index.js +219 -0
  63. package/es/components/LinkEidtCard/index.css +255 -0
  64. package/{dist/packages/react/src → es}/components/LinkEidtCard/index.d.ts +5 -5
  65. package/es/components/LinkEidtCard/index.js +238 -0
  66. package/es/components/LocationCondition/index.css +74 -0
  67. package/{dist/packages/react/src → es}/components/LocationCondition/index.d.ts +3 -3
  68. package/es/components/LocationCondition/index.js +195 -0
  69. package/{dist/packages/react/src → es}/components/MessageBox/index.d.ts +9 -9
  70. package/es/components/MessageBox/index.js +16 -0
  71. package/{dist/packages/react/src → es}/components/NotationBoxes/index.d.ts +3 -3
  72. package/es/components/NotationBoxes/index.js +105 -0
  73. package/{dist/packages/react/src → es}/components/ResetColumnWidth/index.d.ts +2 -2
  74. package/es/components/ResetColumnWidth/index.js +130 -0
  75. package/{dist/packages/react/src → es}/components/SVGDefines.d.ts +5 -5
  76. package/es/components/SVGDefines.js +1961 -0
  77. package/{dist/packages/react/src → es}/components/SVGIcon.d.ts +9 -9
  78. package/es/components/SVGIcon.js +18 -0
  79. package/es/components/SearchReplace/index.css +191 -0
  80. package/{dist/packages/react/src → es}/components/SearchReplace/index.d.ts +6 -6
  81. package/es/components/SearchReplace/index.js +285 -0
  82. package/es/components/Sheet/index.css +27 -0
  83. package/{dist/packages/react/src → es}/components/Sheet/index.d.ts +8 -8
  84. package/es/components/Sheet/index.js +176 -0
  85. package/{dist/packages/react/src → es}/components/SheetList/SheetHiddenButton.d.ts +8 -8
  86. package/es/components/SheetList/SheetHiddenButton.js +35 -0
  87. package/{dist/packages/react/src → es}/components/SheetList/SheetListItem.d.ts +9 -9
  88. package/es/components/SheetList/SheetListItem.js +72 -0
  89. package/es/components/SheetList/index.css +48 -0
  90. package/{dist/packages/react/src → es}/components/SheetList/index.d.ts +4 -4
  91. package/es/components/SheetList/index.js +30 -0
  92. package/{dist/packages/react/src → es}/components/SheetOverlay/ColumnHeader.d.ts +3 -3
  93. package/es/components/SheetOverlay/ColumnHeader.js +217 -0
  94. package/{dist/packages/react/src → es}/components/SheetOverlay/ContentEditable.d.ts +11 -11
  95. package/es/components/SheetOverlay/ContentEditable.js +74 -0
  96. package/es/components/SheetOverlay/FormulaHint/index.css +180 -0
  97. package/{dist/packages/react/src → es}/components/SheetOverlay/FormulaHint/index.d.ts +4 -4
  98. package/es/components/SheetOverlay/FormulaHint/index.js +348 -0
  99. package/{dist/packages/react/src → es}/components/SheetOverlay/FormulaSearch/constant.d.ts +63 -63
  100. package/es/components/SheetOverlay/FormulaSearch/constant.js +328 -0
  101. package/es/components/SheetOverlay/FormulaSearch/index.css +44 -0
  102. package/{dist/packages/react/src → es}/components/SheetOverlay/FormulaSearch/index.d.ts +4 -4
  103. package/es/components/SheetOverlay/FormulaSearch/index.js +261 -0
  104. package/{dist/packages/react/src → es}/components/SheetOverlay/InputBox.d.ts +3 -3
  105. package/es/components/SheetOverlay/InputBox.js +395 -0
  106. package/{dist/packages/react/src → es}/components/SheetOverlay/RowHeader.d.ts +3 -3
  107. package/es/components/SheetOverlay/RowHeader.js +187 -0
  108. package/es/components/SheetOverlay/ScrollBar/index.css +40 -0
  109. package/{dist/packages/react/src → es}/components/SheetOverlay/ScrollBar/index.d.ts +7 -7
  110. package/es/components/SheetOverlay/ScrollBar/index.js +47 -0
  111. package/es/components/SheetOverlay/index.css +952 -0
  112. package/{dist/packages/react/src → es}/components/SheetOverlay/index.d.ts +4 -4
  113. package/es/components/SheetOverlay/index.js +580 -0
  114. package/{dist/packages/react/src → es}/components/SheetTab/SheetItem.d.ts +8 -8
  115. package/es/components/SheetTab/SheetItem.js +230 -0
  116. package/es/components/SheetTab/index.css +278 -0
  117. package/{dist/packages/react/src → es}/components/SheetTab/index.d.ts +4 -4
  118. package/es/components/SheetTab/index.js +191 -0
  119. package/es/components/SplitColumn/index.css +121 -0
  120. package/{dist/packages/react/src → es}/components/SplitColumn/index.d.ts +3 -3
  121. package/es/components/SplitColumn/index.js +167 -0
  122. package/{dist/packages/react/src → es}/components/Toolbar/Button.d.ts +12 -12
  123. package/es/components/Toolbar/Button.js +32 -0
  124. package/{dist/packages/react/src → es}/components/Toolbar/ColorPicker.d.ts +6 -6
  125. package/es/components/Toolbar/ColorPicker.js +27 -0
  126. package/{dist/packages/react/src → es}/components/Toolbar/Combo.d.ts +13 -12
  127. package/es/components/Toolbar/Combo.js +123 -0
  128. package/{dist/packages/react/src → es}/components/Toolbar/CustomBorder.d.ts +7 -7
  129. package/es/components/Toolbar/CustomBorder.js +211 -0
  130. package/{dist/packages/react/src → es}/components/Toolbar/CustomButton.d.ts +11 -11
  131. package/es/components/Toolbar/CustomButton.js +29 -0
  132. package/{dist/packages/react/src → es}/components/Toolbar/CustomColor.d.ts +8 -8
  133. package/es/components/Toolbar/CustomColor.js +25 -0
  134. package/{dist/packages/react/src → es}/components/Toolbar/CustomIcon.d.ts +9 -9
  135. package/es/components/Toolbar/CustomIcon.js +38 -0
  136. package/{dist/packages/react/src → es}/components/Toolbar/Divider.d.ts +4 -4
  137. package/es/components/Toolbar/Divider.js +12 -0
  138. package/{dist/packages/react/src → es}/components/Toolbar/MoreItemsContainer.d.ts +6 -6
  139. package/es/components/Toolbar/MoreItemsContainer.js +17 -0
  140. package/{dist/packages/react/src → es}/components/Toolbar/Select.d.ts +14 -14
  141. package/es/components/Toolbar/Select.js +34 -0
  142. package/es/components/Toolbar/index.css +411 -0
  143. package/es/components/Toolbar/index.d.ts +16 -0
  144. package/es/components/Toolbar/index.js +1722 -0
  145. package/{dist/packages/react/src → es}/components/Workbook/api.d.ts +1186 -1177
  146. package/es/components/Workbook/api.js +405 -0
  147. package/es/components/Workbook/index.css +48 -0
  148. package/{dist/packages/react/src → es}/components/Workbook/index.d.ts +1194 -1185
  149. package/es/components/Workbook/index.js +749 -0
  150. package/es/components/ZoomControl/index.css +54 -0
  151. package/{dist/packages/react/src → es}/components/ZoomControl/index.d.ts +4 -4
  152. package/es/components/ZoomControl/index.js +111 -0
  153. package/es/components/index.d.ts +5 -0
  154. package/es/components/index.js +3 -0
  155. package/es/constants.d.ts +27 -0
  156. package/es/constants.js +45 -0
  157. package/{dist/packages/react/src → es}/context/index.d.ts +25 -25
  158. package/es/context/index.js +34 -0
  159. package/{dist/packages/react/src → es}/context/modal.d.ts +10 -10
  160. package/es/context/modal.js +43 -0
  161. package/{dist/packages/react/src → es}/hooks/useAlert.d.ts +4 -4
  162. package/es/hooks/useAlert.js +28 -0
  163. package/{dist/packages/react/src → es}/hooks/useDialog.d.ts +5 -5
  164. package/es/hooks/useDialog.js +28 -0
  165. package/{dist/packages/react/src → es}/hooks/useOutsideClick.d.ts +2 -2
  166. package/es/hooks/useOutsideClick.js +15 -0
  167. package/{dist/packages/react/src → es}/hooks/usePrevious.d.ts +2 -2
  168. package/es/hooks/usePrevious.js +9 -0
  169. package/es/index.css +27 -0
  170. package/{dist/packages/react/src → es}/index.d.ts +1 -1
  171. package/es/index.js +1 -0
  172. package/es/utils/convertCellsToCrypto.d.ts +8 -0
  173. package/es/utils/convertCellsToCrypto.js +307 -0
  174. package/es/utils/cryptoApi.d.ts +3 -0
  175. package/es/utils/cryptoApi.js +190 -0
  176. package/{dist/packages/react/src → es}/utils/datepickerStyles.d.ts +2 -2
  177. package/es/utils/datepickerStyles.js +8 -0
  178. package/es/utils/updateCellsDecimalFormat.d.ts +6 -0
  179. package/es/utils/updateCellsDecimalFormat.js +80 -0
  180. package/lib/assets/paint-roller.png +0 -0
  181. package/lib/components/ChangeColor/index.css +76 -0
  182. package/lib/components/ChangeColor/index.d.ts +7 -0
  183. package/lib/components/ChangeColor/index.js +50 -0
  184. package/lib/components/ConditionFormat/ConditionRules.d.ts +6 -0
  185. package/lib/components/ConditionFormat/ConditionRules.js +332 -0
  186. package/lib/components/ConditionFormat/index.css +210 -0
  187. package/lib/components/ConditionFormat/index.d.ts +7 -0
  188. package/lib/components/ConditionFormat/index.js +261 -0
  189. package/lib/components/ContextMenu/Divider.d.ts +3 -0
  190. package/lib/components/ContextMenu/Divider.js +14 -0
  191. package/lib/components/ContextMenu/FilterMenu.d.ts +3 -0
  192. package/lib/components/ContextMenu/FilterMenu.js +621 -0
  193. package/lib/components/ContextMenu/Menu.d.ts +8 -0
  194. package/lib/components/ContextMenu/Menu.js +33 -0
  195. package/lib/components/ContextMenu/SheetTab.d.ts +4 -0
  196. package/lib/components/ContextMenu/SheetTab.js +232 -0
  197. package/lib/components/ContextMenu/index.css +322 -0
  198. package/lib/components/ContextMenu/index.d.ts +5 -0
  199. package/lib/components/ContextMenu/index.js +1063 -0
  200. package/lib/components/CryptoDenominationSelector/index.css +67 -0
  201. package/lib/components/CryptoDenominationSelector/index.d.ts +8 -0
  202. package/lib/components/CryptoDenominationSelector/index.js +280 -0
  203. package/lib/components/CustomSort/index.css +23 -0
  204. package/lib/components/CustomSort/index.d.ts +4 -0
  205. package/lib/components/CustomSort/index.js +122 -0
  206. package/lib/components/DataVerification/DropdownList.d.ts +4 -0
  207. package/lib/components/DataVerification/DropdownList.js +135 -0
  208. package/lib/components/DataVerification/RangeDialog.d.ts +4 -0
  209. package/lib/components/DataVerification/RangeDialog.js +114 -0
  210. package/lib/components/DataVerification/getDisplayedRangeTxt.d.ts +2 -0
  211. package/lib/components/DataVerification/getDisplayedRangeTxt.js +15 -0
  212. package/lib/components/DataVerification/index.css +202 -0
  213. package/lib/components/DataVerification/index.d.ts +4 -0
  214. package/lib/components/DataVerification/index.js +407 -0
  215. package/lib/components/Dialog/index.css +64 -0
  216. package/lib/components/Dialog/index.d.ts +15 -0
  217. package/lib/components/Dialog/index.js +81 -0
  218. package/lib/components/DuneChartsInputModal/DuneChartsInputModal.d.ts +11 -0
  219. package/lib/components/DuneChartsInputModal/DuneChartsInputModal.js +104 -0
  220. package/lib/components/DuneChartsInputModal/duneChartsInputModal.css +98 -0
  221. package/lib/components/DunePreview/DunePreview.d.ts +13 -0
  222. package/lib/components/DunePreview/DunePreview.js +53 -0
  223. package/lib/components/DunePreview/index.css +57 -0
  224. package/lib/components/FilterOption/index.d.ts +5 -0
  225. package/lib/components/FilterOption/index.js +130 -0
  226. package/lib/components/FormatSearch/index.css +19 -0
  227. package/lib/components/FormatSearch/index.d.ts +6 -0
  228. package/lib/components/FormatSearch/index.js +142 -0
  229. package/lib/components/FormulaSearch/index.css +65 -0
  230. package/lib/components/FormulaSearch/index.d.ts +5 -0
  231. package/lib/components/FormulaSearch/index.js +207 -0
  232. package/lib/components/FxEditor/NameBox.d.ts +3 -0
  233. package/lib/components/FxEditor/NameBox.js +38 -0
  234. package/lib/components/FxEditor/index.css +72 -0
  235. package/lib/components/FxEditor/index.d.ts +4 -0
  236. package/lib/components/FxEditor/index.js +176 -0
  237. package/lib/components/IFrameBoxs/iFrameBoxs.css +16 -0
  238. package/lib/components/IFrameBoxs/iFrameBoxs.d.ts +4 -0
  239. package/lib/components/IFrameBoxs/iFrameBoxs.js +151 -0
  240. package/lib/components/ImgBoxs/index.d.ts +3 -0
  241. package/lib/components/ImgBoxs/index.js +228 -0
  242. package/lib/components/LinkEidtCard/index.css +255 -0
  243. package/lib/components/LinkEidtCard/index.d.ts +5 -0
  244. package/lib/components/LinkEidtCard/index.js +247 -0
  245. package/lib/components/LocationCondition/index.css +74 -0
  246. package/lib/components/LocationCondition/index.d.ts +3 -0
  247. package/lib/components/LocationCondition/index.js +204 -0
  248. package/lib/components/MessageBox/index.d.ts +9 -0
  249. package/lib/components/MessageBox/index.js +23 -0
  250. package/lib/components/NotationBoxes/index.d.ts +3 -0
  251. package/lib/components/NotationBoxes/index.js +114 -0
  252. package/lib/components/ResetColumnWidth/index.d.ts +2 -0
  253. package/lib/components/ResetColumnWidth/index.js +138 -0
  254. package/lib/components/SVGDefines.d.ts +5 -0
  255. package/lib/components/SVGDefines.js +1968 -0
  256. package/lib/components/SVGIcon.d.ts +9 -0
  257. package/lib/components/SVGIcon.js +25 -0
  258. package/lib/components/SearchReplace/index.css +191 -0
  259. package/lib/components/SearchReplace/index.d.ts +6 -0
  260. package/lib/components/SearchReplace/index.js +294 -0
  261. package/lib/components/Sheet/index.css +27 -0
  262. package/lib/components/Sheet/index.d.ts +8 -0
  263. package/lib/components/Sheet/index.js +185 -0
  264. package/lib/components/SheetList/SheetHiddenButton.d.ts +8 -0
  265. package/lib/components/SheetList/SheetHiddenButton.js +44 -0
  266. package/lib/components/SheetList/SheetListItem.d.ts +9 -0
  267. package/lib/components/SheetList/SheetListItem.js +81 -0
  268. package/lib/components/SheetList/index.css +48 -0
  269. package/lib/components/SheetList/index.d.ts +4 -0
  270. package/lib/components/SheetList/index.js +39 -0
  271. package/lib/components/SheetOverlay/ColumnHeader.d.ts +3 -0
  272. package/lib/components/SheetOverlay/ColumnHeader.js +226 -0
  273. package/lib/components/SheetOverlay/ContentEditable.d.ts +11 -0
  274. package/lib/components/SheetOverlay/ContentEditable.js +83 -0
  275. package/lib/components/SheetOverlay/FormulaHint/index.css +180 -0
  276. package/lib/components/SheetOverlay/FormulaHint/index.d.ts +4 -0
  277. package/lib/components/SheetOverlay/FormulaHint/index.js +357 -0
  278. package/lib/components/SheetOverlay/FormulaSearch/constant.d.ts +63 -0
  279. package/lib/components/SheetOverlay/FormulaSearch/constant.js +334 -0
  280. package/lib/components/SheetOverlay/FormulaSearch/index.css +44 -0
  281. package/lib/components/SheetOverlay/FormulaSearch/index.d.ts +4 -0
  282. package/lib/components/SheetOverlay/FormulaSearch/index.js +270 -0
  283. package/lib/components/SheetOverlay/InputBox.d.ts +3 -0
  284. package/lib/components/SheetOverlay/InputBox.js +404 -0
  285. package/lib/components/SheetOverlay/RowHeader.d.ts +3 -0
  286. package/lib/components/SheetOverlay/RowHeader.js +196 -0
  287. package/lib/components/SheetOverlay/ScrollBar/index.css +40 -0
  288. package/lib/components/SheetOverlay/ScrollBar/index.d.ts +7 -0
  289. package/lib/components/SheetOverlay/ScrollBar/index.js +56 -0
  290. package/lib/components/SheetOverlay/index.css +952 -0
  291. package/lib/components/SheetOverlay/index.d.ts +4 -0
  292. package/lib/components/SheetOverlay/index.js +589 -0
  293. package/lib/components/SheetTab/SheetItem.d.ts +8 -0
  294. package/lib/components/SheetTab/SheetItem.js +239 -0
  295. package/lib/components/SheetTab/index.css +278 -0
  296. package/lib/components/SheetTab/index.d.ts +4 -0
  297. package/lib/components/SheetTab/index.js +200 -0
  298. package/lib/components/SplitColumn/index.css +121 -0
  299. package/lib/components/SplitColumn/index.d.ts +3 -0
  300. package/lib/components/SplitColumn/index.js +176 -0
  301. package/lib/components/Toolbar/Button.d.ts +12 -0
  302. package/lib/components/Toolbar/Button.js +39 -0
  303. package/lib/components/Toolbar/ColorPicker.d.ts +6 -0
  304. package/lib/components/Toolbar/ColorPicker.js +34 -0
  305. package/lib/components/Toolbar/Combo.d.ts +13 -0
  306. package/lib/components/Toolbar/Combo.js +132 -0
  307. package/lib/components/Toolbar/CustomBorder.d.ts +7 -0
  308. package/lib/components/Toolbar/CustomBorder.js +220 -0
  309. package/lib/components/Toolbar/CustomButton.d.ts +11 -0
  310. package/lib/components/Toolbar/CustomButton.js +36 -0
  311. package/lib/components/Toolbar/CustomColor.d.ts +8 -0
  312. package/lib/components/Toolbar/CustomColor.js +32 -0
  313. package/lib/components/Toolbar/CustomIcon.d.ts +9 -0
  314. package/lib/components/Toolbar/CustomIcon.js +46 -0
  315. package/lib/components/Toolbar/Divider.d.ts +4 -0
  316. package/lib/components/Toolbar/Divider.js +19 -0
  317. package/lib/components/Toolbar/MoreItemsContainer.d.ts +6 -0
  318. package/lib/components/Toolbar/MoreItemsContainer.js +25 -0
  319. package/lib/components/Toolbar/Select.d.ts +14 -0
  320. package/lib/components/Toolbar/Select.js +40 -0
  321. package/lib/components/Toolbar/index.css +411 -0
  322. package/lib/components/Toolbar/index.d.ts +16 -0
  323. package/lib/components/Toolbar/index.js +1731 -0
  324. package/lib/components/Workbook/api.d.ts +1186 -0
  325. package/lib/components/Workbook/api.js +412 -0
  326. package/lib/components/Workbook/index.css +48 -0
  327. package/{dist/stories/API.stories.d.ts → lib/components/Workbook/index.d.ts} +1194 -1210
  328. package/lib/components/Workbook/index.js +758 -0
  329. package/lib/components/ZoomControl/index.css +54 -0
  330. package/lib/components/ZoomControl/index.d.ts +4 -0
  331. package/lib/components/ZoomControl/index.js +120 -0
  332. package/lib/components/index.d.ts +5 -0
  333. package/lib/components/index.js +26 -0
  334. package/lib/constants.d.ts +27 -0
  335. package/lib/constants.js +52 -0
  336. package/lib/context/index.d.ts +25 -0
  337. package/lib/context/index.js +41 -0
  338. package/lib/context/modal.d.ts +10 -0
  339. package/lib/context/modal.js +50 -0
  340. package/lib/hooks/useAlert.d.ts +4 -0
  341. package/lib/hooks/useAlert.js +37 -0
  342. package/lib/hooks/useDialog.d.ts +5 -0
  343. package/lib/hooks/useDialog.js +37 -0
  344. package/lib/hooks/useOutsideClick.d.ts +2 -0
  345. package/lib/hooks/useOutsideClick.js +21 -0
  346. package/lib/hooks/usePrevious.d.ts +2 -0
  347. package/lib/hooks/usePrevious.js +15 -0
  348. package/lib/index.css +27 -0
  349. package/lib/index.d.ts +1 -0
  350. package/lib/index.js +16 -0
  351. package/lib/utils/convertCellsToCrypto.d.ts +8 -0
  352. package/lib/utils/convertCellsToCrypto.js +314 -0
  353. package/lib/utils/cryptoApi.d.ts +3 -0
  354. package/lib/utils/cryptoApi.js +198 -0
  355. package/lib/utils/datepickerStyles.d.ts +2 -0
  356. package/lib/utils/datepickerStyles.js +14 -0
  357. package/lib/utils/updateCellsDecimalFormat.d.ts +6 -0
  358. package/lib/utils/updateCellsDecimalFormat.js +86 -0
  359. package/package.json +8 -7
  360. package/dist/index.css +0 -3915
  361. package/dist/index.esm.css +0 -3915
  362. package/dist/index.esm.js +0 -12975
  363. package/dist/index.js +0 -12995
  364. package/dist/index.umd.css +0 -3915
  365. package/dist/index.umd.js +0 -122445
  366. package/dist/index.umd.min.css +0 -1
  367. package/dist/index.umd.min.js +0 -50
  368. package/dist/packages/core/src/api/cell.d.ts +0 -10
  369. package/dist/packages/core/src/api/common.d.ts +0 -66
  370. package/dist/packages/core/src/api/errors.d.ts +0 -2
  371. package/dist/packages/core/src/api/index.d.ts +0 -9
  372. package/dist/packages/core/src/api/merge.d.ts +0 -5
  373. package/dist/packages/core/src/api/range.d.ts +0 -22
  374. package/dist/packages/core/src/api/rowcol.d.ts +0 -14
  375. package/dist/packages/core/src/api/sheet.d.ts +0 -10
  376. package/dist/packages/core/src/api/workbook.d.ts +0 -15
  377. package/dist/packages/core/src/canvas.d.ts +0 -46
  378. package/dist/packages/core/src/context.d.ts +0 -197
  379. package/dist/packages/core/src/events/copy.d.ts +0 -2
  380. package/dist/packages/core/src/events/index.d.ts +0 -4
  381. package/dist/packages/core/src/events/keyboard.d.ts +0 -6
  382. package/dist/packages/core/src/events/mouse.d.ts +0 -22
  383. package/dist/packages/core/src/events/paste.d.ts +0 -3
  384. package/dist/packages/core/src/index.d.ts +0 -10
  385. package/dist/packages/core/src/locale/en.d.ts +0 -992
  386. package/dist/packages/core/src/locale/es.d.ts +0 -1134
  387. package/dist/packages/core/src/locale/hi.d.ts +0 -1030
  388. package/dist/packages/core/src/locale/index.d.ts +0 -1049
  389. package/dist/packages/core/src/locale/zh.d.ts +0 -1048
  390. package/dist/packages/core/src/locale/zh_tw.d.ts +0 -1187
  391. package/dist/packages/core/src/modules/ConditionFormat.d.ts +0 -17
  392. package/dist/packages/core/src/modules/border.d.ts +0 -3
  393. package/dist/packages/core/src/modules/cell.d.ts +0 -32
  394. package/dist/packages/core/src/modules/clipboard.d.ts +0 -3
  395. package/dist/packages/core/src/modules/color.d.ts +0 -1
  396. package/dist/packages/core/src/modules/comment.d.ts +0 -97
  397. package/dist/packages/core/src/modules/conditionalFormat.d.ts +0 -2
  398. package/dist/packages/core/src/modules/cursor.d.ts +0 -3
  399. package/dist/packages/core/src/modules/dataVerification.d.ts +0 -11
  400. package/dist/packages/core/src/modules/dropCell.d.ts +0 -10
  401. package/dist/packages/core/src/modules/filter.d.ts +0 -45
  402. package/dist/packages/core/src/modules/format.d.ts +0 -6
  403. package/dist/packages/core/src/modules/formula.d.ts +0 -54
  404. package/dist/packages/core/src/modules/freeze.d.ts +0 -5
  405. package/dist/packages/core/src/modules/hyperlink.d.ts +0 -21
  406. package/dist/packages/core/src/modules/iframe.d.ts +0 -12
  407. package/dist/packages/core/src/modules/image.d.ts +0 -31
  408. package/dist/packages/core/src/modules/index.d.ts +0 -36
  409. package/dist/packages/core/src/modules/inline-string.d.ts +0 -36
  410. package/dist/packages/core/src/modules/location.d.ts +0 -6
  411. package/dist/packages/core/src/modules/locationCondition.d.ts +0 -21
  412. package/dist/packages/core/src/modules/merge.d.ts +0 -3
  413. package/dist/packages/core/src/modules/mobile.d.ts +0 -5
  414. package/dist/packages/core/src/modules/moveCells.d.ts +0 -5
  415. package/dist/packages/core/src/modules/protection.d.ts +0 -5
  416. package/dist/packages/core/src/modules/refresh.d.ts +0 -3
  417. package/dist/packages/core/src/modules/rowcol.d.ts +0 -19
  418. package/dist/packages/core/src/modules/screenshot.d.ts +0 -2
  419. package/dist/packages/core/src/modules/searchReplace.d.ts +0 -36
  420. package/dist/packages/core/src/modules/selection.d.ts +0 -46
  421. package/dist/packages/core/src/modules/sheet.d.ts +0 -10
  422. package/dist/packages/core/src/modules/sort.d.ts +0 -7
  423. package/dist/packages/core/src/modules/splitColumn.d.ts +0 -5
  424. package/dist/packages/core/src/modules/text.d.ts +0 -10
  425. package/dist/packages/core/src/modules/toolbar.d.ts +0 -32
  426. package/dist/packages/core/src/modules/validation.d.ts +0 -19
  427. package/dist/packages/core/src/modules/zoom.d.ts +0 -3
  428. package/dist/packages/core/src/settings.d.ts +0 -100
  429. package/dist/packages/core/src/types.d.ts +0 -371
  430. package/dist/packages/core/src/utils/freeze.d.ts +0 -7
  431. package/dist/packages/core/src/utils/index.d.ts +0 -18
  432. package/dist/packages/core/src/utils/patch.d.ts +0 -37
  433. package/dist/packages/react/src/components/Toolbar/index.d.ts +0 -10
  434. package/dist/packages/react/src/components/index.d.ts +0 -4
  435. package/dist/packages/react/src/constants.d.ts +0 -1
  436. package/dist/stories/Collabration.stories.d.ts +0 -2359
  437. package/dist/stories/Features.stories.d.ts +0 -9430
  438. package/dist/stories/data/cell.d.ts +0 -983
  439. package/dist/stories/data/dataVerification.d.ts +0 -131
  440. package/dist/stories/data/empty.d.ts +0 -10
  441. package/dist/stories/data/formula.d.ts +0 -362
  442. package/dist/stories/data/freeze.d.ts +0 -34
  443. package/dist/stories/data/protected.d.ts +0 -40
  444. package/dist/stories/utils.d.ts +0 -1
@@ -0,0 +1,749 @@
1
+ var __rest = this && this.__rest || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
4
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
5
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
6
+ }
7
+ return t;
8
+ };
9
+ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
10
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
11
+ if (ar || !(i in from)) {
12
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
13
+ ar[i] = from[i];
14
+ }
15
+ }
16
+ return to.concat(ar || Array.prototype.slice.call(from));
17
+ };
18
+ import { defaultContext, defaultSettings, initSheetIndex, handleGlobalKeyDown, getSheetIndex, handlePaste, filterPatch, patchToOp, inverseRowColOptions, ensureSheetIndex, insertRowCol, deleteRowCol, locale, calcSelectionInfo, groupValuesRefresh, insertDuneChart, getFlowdata, api } from "@fileverse-dev/fortune-core";
19
+ import React, { useMemo, useState, useCallback, useEffect, useRef, useImperativeHandle } from "react";
20
+ import "./index.css";
21
+ import produce, { applyPatches, enablePatches, produceWithPatches } from "immer";
22
+ import _ from "lodash";
23
+ import { getCryptoPrice } from "../../utils/cryptoApi";
24
+ import Sheet from "../Sheet";
25
+ import WorkbookContext from "../../context";
26
+ import Toolbar from "../Toolbar";
27
+ import FxEditor from "../FxEditor";
28
+ import SheetTab from "../SheetTab";
29
+ import ContextMenu from "../ContextMenu";
30
+ import SVGDefines from "../SVGDefines";
31
+ import SheetTabContextMenu from "../ContextMenu/SheetTab";
32
+ import { generateAPIs } from "./api";
33
+ import { ModalProvider } from "../../context/modal";
34
+ import FilterMenu from "../ContextMenu/FilterMenu";
35
+ import SheetList from "../SheetList";
36
+ import DunePreview from "../DunePreview/DunePreview";
37
+ enablePatches();
38
+ var triggerGroupValuesRefresh = function triggerGroupValuesRefresh(ctx) {
39
+ if (ctx.groupValuesRefreshData.length > 0) {
40
+ groupValuesRefresh(ctx);
41
+ }
42
+ };
43
+ var concatProducer = function concatProducer() {
44
+ var producers = [];
45
+ for (var _i = 0; _i < arguments.length; _i++) {
46
+ producers[_i] = arguments[_i];
47
+ }
48
+ return function (ctx) {
49
+ producers.forEach(function (producer) {
50
+ producer(ctx);
51
+ });
52
+ };
53
+ };
54
+ var Workbook = /*#__PURE__*/React.forwardRef(function (_a, ref) {
55
+ var _b;
56
+ var onChange = _a.onChange,
57
+ onOp = _a.onOp,
58
+ originalData = _a.data,
59
+ isFlvReadOnly = _a.isFlvReadOnly,
60
+ props = __rest(_a, ["onChange", "onOp", "data", "isFlvReadOnly"]);
61
+ var globalCache = useRef({
62
+ undoList: [],
63
+ redoList: []
64
+ });
65
+ var cellInput = useRef(null);
66
+ var fxInput = useRef(null);
67
+ var canvas = useRef(null);
68
+ var scrollbarX = useRef(null);
69
+ var scrollbarY = useRef(null);
70
+ var cellArea = useRef(null);
71
+ var workbookContainer = useRef(null);
72
+ var refs = useMemo(function () {
73
+ return {
74
+ globalCache: globalCache.current,
75
+ cellInput: cellInput,
76
+ fxInput: fxInput,
77
+ canvas: canvas,
78
+ scrollbarX: scrollbarX,
79
+ scrollbarY: scrollbarY,
80
+ cellArea: cellArea,
81
+ workbookContainer: workbookContainer
82
+ };
83
+ }, []);
84
+ var _c = useState(defaultContext(refs)),
85
+ context = _c[0],
86
+ setContext = _c[1];
87
+ var formula = locale(context).formula;
88
+ var _d = useState(null),
89
+ moreToolbarItems = _d[0],
90
+ setMoreToolbarItems = _d[1];
91
+ var _e = useState({
92
+ numberC: 0,
93
+ count: 0,
94
+ sum: 0,
95
+ max: 0,
96
+ min: 0,
97
+ average: ""
98
+ }),
99
+ calInfo = _e[0],
100
+ setCalInfo = _e[1];
101
+ var mergedSettings = useMemo(function () {
102
+ return _.assign(_.cloneDeep(defaultSettings), props);
103
+ }, __spreadArray([], _.values(props), true));
104
+ useEffect(function () {
105
+ var selection = context.luckysheet_select_save;
106
+ var lang = props.lang;
107
+ if (selection) {
108
+ var re = calcSelectionInfo(context, lang);
109
+ setCalInfo(re);
110
+ }
111
+ }, [context.luckysheet_select_save]);
112
+ var initSheetData = useCallback(function (draftCtx, newData, index) {
113
+ var _a, _b;
114
+ var celldata = newData.celldata,
115
+ row = newData.row,
116
+ column = newData.column;
117
+ var lastRow = _.maxBy(celldata, "r");
118
+ var lastCol = _.maxBy(celldata, "c");
119
+ var lastRowNum = ((_a = lastRow === null || lastRow === void 0 ? void 0 : lastRow.r) !== null && _a !== void 0 ? _a : 0) + 1;
120
+ var lastColNum = ((_b = lastCol === null || lastCol === void 0 ? void 0 : lastCol.c) !== null && _b !== void 0 ? _b : 0) + 1;
121
+ if (row != null && column != null && row > 0 && column > 0) {
122
+ lastRowNum = Math.max(lastRowNum, row);
123
+ lastColNum = Math.max(lastColNum, column);
124
+ } else {
125
+ lastRowNum = Math.max(lastRowNum, draftCtx.defaultrowNum);
126
+ lastColNum = Math.max(lastColNum, draftCtx.defaultcolumnNum);
127
+ }
128
+ if (lastRowNum && lastColNum) {
129
+ var expandedData_1 = _.times(lastRowNum, function () {
130
+ return _.times(lastColNum, function () {
131
+ return null;
132
+ });
133
+ });
134
+ celldata === null || celldata === void 0 ? void 0 : celldata.forEach(function (d) {
135
+ expandedData_1[d.r][d.c] = d.v;
136
+ });
137
+ draftCtx.luckysheetfile = produce(draftCtx.luckysheetfile, function (d) {
138
+ d[index].data = expandedData_1;
139
+ delete d[index].celldata;
140
+ return d;
141
+ });
142
+ return expandedData_1;
143
+ }
144
+ return null;
145
+ }, []);
146
+ var emitOp = useCallback(function (ctx, patches, options, undo) {
147
+ if (undo === void 0) {
148
+ undo = false;
149
+ }
150
+ if (onOp) {
151
+ onOp(patchToOp(ctx, patches, options, undo));
152
+ }
153
+ }, [onOp]);
154
+ function reduceUndoList(ctx, ctxBefore) {
155
+ var sheetsId = ctx.luckysheetfile.map(function (sheet) {
156
+ return sheet.id;
157
+ });
158
+ var sheetDeletedByMe = globalCache.current.undoList.filter(function (undo) {
159
+ var _a;
160
+ return (_a = undo.options) === null || _a === void 0 ? void 0 : _a.deleteSheetOp;
161
+ }).map(function (item) {
162
+ var _a, _b;
163
+ return (_b = (_a = item.options) === null || _a === void 0 ? void 0 : _a.deleteSheetOp) === null || _b === void 0 ? void 0 : _b.id;
164
+ });
165
+ globalCache.current.undoList = globalCache.current.undoList.filter(function (undo) {
166
+ var _a, _b, _c, _d;
167
+ return ((_a = undo.options) === null || _a === void 0 ? void 0 : _a.deleteSheetOp) || ((_b = undo.options) === null || _b === void 0 ? void 0 : _b.id) === undefined || _.indexOf(sheetsId, (_c = undo.options) === null || _c === void 0 ? void 0 : _c.id) !== -1 || _.indexOf(sheetDeletedByMe, (_d = undo.options) === null || _d === void 0 ? void 0 : _d.id) !== -1;
168
+ });
169
+ if (ctxBefore.luckysheetfile.length > ctx.luckysheetfile.length) {
170
+ var sheetDeleted = ctxBefore.luckysheetfile.filter(function (oneSheet) {
171
+ return _.indexOf(ctx.luckysheetfile.map(function (item) {
172
+ return item.id;
173
+ }), oneSheet.id) === -1;
174
+ }).map(function (item) {
175
+ return getSheetIndex(ctxBefore, item.id);
176
+ });
177
+ var deletedIndex_1 = sheetDeleted[0];
178
+ globalCache.current.undoList = globalCache.current.undoList.map(function (oneStep) {
179
+ oneStep.patches = oneStep.patches.map(function (onePatch) {
180
+ if (typeof onePatch.path[1] === "number" && onePatch.path[1] > deletedIndex_1) {
181
+ onePatch.path[1] -= 1;
182
+ }
183
+ return onePatch;
184
+ });
185
+ oneStep.inversePatches = oneStep.inversePatches.map(function (onePatch) {
186
+ if (typeof onePatch.path[1] === "number" && onePatch.path[1] > deletedIndex_1) {
187
+ onePatch.path[1] -= 1;
188
+ }
189
+ return onePatch;
190
+ });
191
+ return oneStep;
192
+ });
193
+ }
194
+ }
195
+ function dataToCelldata(data) {
196
+ var _a;
197
+ var cellData = [];
198
+ for (var row = 0; row < (data === null || data === void 0 ? void 0 : data.length); row += 1) {
199
+ for (var col = 0; col < ((_a = data[row]) === null || _a === void 0 ? void 0 : _a.length); col += 1) {
200
+ if (data[row][col] !== null) {
201
+ cellData.push({
202
+ r: row,
203
+ c: col,
204
+ v: data[row][col]
205
+ });
206
+ }
207
+ }
208
+ }
209
+ return cellData;
210
+ }
211
+ var setContextWithProduce = useCallback(function (recipe, options) {
212
+ if (options === void 0) {
213
+ options = {};
214
+ }
215
+ setContext(function (ctx_) {
216
+ var _a, _b, _c;
217
+ var _d = produceWithPatches(ctx_, concatProducer(recipe, triggerGroupValuesRefresh)),
218
+ result = _d[0],
219
+ patches = _d[1],
220
+ inversePatches = _d[2];
221
+ if (patches.length > 0 && !options.noHistory) {
222
+ if (options.logPatch) {
223
+ console.info("patch", patches);
224
+ }
225
+ var filteredPatches = filterPatch(patches);
226
+ var filteredInversePatches = filterPatch(inversePatches);
227
+ if (filteredInversePatches.length > 0) {
228
+ options.id = ctx_.currentSheetId;
229
+ if (options.deleteSheetOp) {
230
+ var target = ctx_.luckysheetfile.filter(function (sheet) {
231
+ var _a;
232
+ return sheet.id === ((_a = options.deleteSheetOp) === null || _a === void 0 ? void 0 : _a.id);
233
+ });
234
+ if (target) {
235
+ var index = getSheetIndex(ctx_, options.deleteSheetOp.id);
236
+ options.deletedSheet = {
237
+ id: options.deleteSheetOp.id,
238
+ index: index,
239
+ value: _.cloneDeep(ctx_.luckysheetfile[index])
240
+ };
241
+ options.deletedSheet.value.celldata = dataToCelldata(options.deletedSheet.value.data);
242
+ delete options.deletedSheet.value.data;
243
+ options.deletedSheet.value.status = 0;
244
+ filteredInversePatches = [{
245
+ op: "add",
246
+ path: ["luckysheetfile", 0],
247
+ value: options.deletedSheet.value
248
+ }];
249
+ }
250
+ } else if (options.addSheetOp) {
251
+ options.addSheet = {};
252
+ options.addSheet.id = result.luckysheetfile[result.luckysheetfile.length - 1].id;
253
+ }
254
+ globalCache.current.undoList.push({
255
+ patches: filteredPatches,
256
+ inversePatches: filteredInversePatches,
257
+ options: options
258
+ });
259
+ globalCache.current.redoList = [];
260
+ emitOp(result, filteredPatches, options);
261
+ }
262
+ } else {
263
+ if (((_b = (_a = patches === null || patches === void 0 ? void 0 : patches[0]) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.length) < ((_c = ctx_ === null || ctx_ === void 0 ? void 0 : ctx_.luckysheetfile) === null || _c === void 0 ? void 0 : _c.length)) {
264
+ reduceUndoList(result, ctx_);
265
+ }
266
+ }
267
+ return result;
268
+ });
269
+ }, [emitOp]);
270
+ var handleUndo = useCallback(function () {
271
+ var history = globalCache.current.undoList.pop();
272
+ if (history) {
273
+ setContext(function (ctx_) {
274
+ var _a, _b, _c, _d, _e;
275
+ if ((_a = history.options) === null || _a === void 0 ? void 0 : _a.deleteSheetOp) {
276
+ history.inversePatches[0].path[1] = ctx_.luckysheetfile.length;
277
+ var order_1 = (_c = (_b = history.options.deletedSheet) === null || _b === void 0 ? void 0 : _b.value) === null || _c === void 0 ? void 0 : _c.order;
278
+ var sheetsRight = ctx_.luckysheetfile.filter(function (sheet) {
279
+ var _a, _b;
280
+ return (sheet === null || sheet === void 0 ? void 0 : sheet.order) >= order_1 && sheet.id !== ((_b = (_a = history === null || history === void 0 ? void 0 : history.options) === null || _a === void 0 ? void 0 : _a.deleteSheetOp) === null || _b === void 0 ? void 0 : _b.id);
281
+ });
282
+ _.forEach(sheetsRight, function (sheet) {
283
+ history.inversePatches.push({
284
+ op: "replace",
285
+ path: ["luckysheetfile", getSheetIndex(ctx_, sheet.id), "order"],
286
+ value: (sheet === null || sheet === void 0 ? void 0 : sheet.order) + 1
287
+ });
288
+ });
289
+ }
290
+ var newContext = applyPatches(ctx_, history.inversePatches);
291
+ globalCache.current.redoList.push(history);
292
+ var inversedOptions = inverseRowColOptions(history.options);
293
+ if (inversedOptions === null || inversedOptions === void 0 ? void 0 : inversedOptions.insertRowColOp) {
294
+ inversedOptions.restoreDeletedCells = true;
295
+ }
296
+ if ((_d = history.options) === null || _d === void 0 ? void 0 : _d.addSheetOp) {
297
+ var index = getSheetIndex(ctx_, history.options.addSheet.id);
298
+ inversedOptions.addSheet = {
299
+ id: history.options.addSheet.id,
300
+ index: index,
301
+ value: _.cloneDeep(ctx_.luckysheetfile[index])
302
+ };
303
+ inversedOptions.addSheet.value.celldata = dataToCelldata((_e = inversedOptions.addSheet.value) === null || _e === void 0 ? void 0 : _e.data);
304
+ delete inversedOptions.addSheet.value.data;
305
+ }
306
+ emitOp(newContext, history.inversePatches, inversedOptions, true);
307
+ return newContext;
308
+ });
309
+ }
310
+ }, [emitOp]);
311
+ var handleRedo = useCallback(function () {
312
+ var history = globalCache.current.redoList.pop();
313
+ if (history) {
314
+ setContext(function (ctx_) {
315
+ var newContext = applyPatches(ctx_, history.patches);
316
+ globalCache.current.undoList.push(history);
317
+ emitOp(newContext, history.patches, history.options);
318
+ return newContext;
319
+ });
320
+ }
321
+ }, [emitOp]);
322
+ useEffect(function () {
323
+ var _a, _b;
324
+ (_b = (_a = mergedSettings.hooks) === null || _a === void 0 ? void 0 : _a.afterActivateSheet) === null || _b === void 0 ? void 0 : _b.call(_a, context.currentSheetId);
325
+ }, [context.currentSheetId]);
326
+ useEffect(function () {
327
+ getCryptoPrice("bitcoin", "usd");
328
+ }, []);
329
+ useEffect(function () {
330
+ var _a, _b;
331
+ setContext(function (ctx) {
332
+ var _a, _b;
333
+ var gridData = getFlowdata(ctx);
334
+ var cellData = api.dataToCelldata(gridData);
335
+ var denominatedUsed = false;
336
+ for (var _i = 0, cellData_1 = cellData; _i < cellData_1.length; _i++) {
337
+ var cell = cellData_1[_i];
338
+ var value = (_b = (_a = cell === null || cell === void 0 ? void 0 : cell.v) === null || _a === void 0 ? void 0 : _a.m) === null || _b === void 0 ? void 0 : _b.toString();
339
+ if ((value === null || value === void 0 ? void 0 : value.includes("BTC")) || (value === null || value === void 0 ? void 0 : value.includes("ETH")) || (value === null || value === void 0 ? void 0 : value.includes("SOL"))) {
340
+ denominatedUsed = true;
341
+ break;
342
+ }
343
+ }
344
+ var denoWarn = document.getElementById("denomination-warning");
345
+ var scrollBar = document.getElementsByClassName("luckysheet-scrollbar-x")[0];
346
+ if (denominatedUsed && denoWarn) {
347
+ denoWarn.style.display = "block";
348
+ denoWarn.style.left = "0px";
349
+ if (scrollBar) {
350
+ scrollBar.setAttribute("style", "bottom: 36px !important; width: calc(100% - 60px);");
351
+ }
352
+ } else if (!denominatedUsed && denoWarn) {
353
+ denoWarn.style.display = "none";
354
+ denoWarn.style.left = "-9999px";
355
+ if (scrollBar) {
356
+ scrollBar.setAttribute("style", "bottom: 10px !important; width: calc(100% - 60px);");
357
+ }
358
+ }
359
+ return ctx;
360
+ });
361
+ if (context.luckysheet_select_save != null) {
362
+ (_b = (_a = mergedSettings.hooks) === null || _a === void 0 ? void 0 : _a.afterSelectionChange) === null || _b === void 0 ? void 0 : _b.call(_a, context.currentSheetId, context.luckysheet_select_save[0]);
363
+ }
364
+ }, [context.currentSheetId, context.luckysheet_select_save, mergedSettings.hooks]);
365
+ var providerValue = useMemo(function () {
366
+ return {
367
+ context: context,
368
+ setContext: setContextWithProduce,
369
+ settings: mergedSettings,
370
+ handleUndo: handleUndo,
371
+ handleRedo: handleRedo,
372
+ refs: refs
373
+ };
374
+ }, [context, handleRedo, handleUndo, mergedSettings, refs, setContextWithProduce]);
375
+ useEffect(function () {
376
+ if (!_.isEmpty(context.luckysheetfile)) {
377
+ onChange === null || onChange === void 0 ? void 0 : onChange(context.luckysheetfile);
378
+ }
379
+ }, [context.luckysheetfile, onChange]);
380
+ useEffect(function () {
381
+ setContextWithProduce(function (draftCtx) {
382
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
383
+ draftCtx.defaultcolumnNum = mergedSettings.column;
384
+ draftCtx.defaultrowNum = mergedSettings.row;
385
+ draftCtx.defaultFontSize = mergedSettings.defaultFontSize;
386
+ if (_.isEmpty(draftCtx.luckysheetfile)) {
387
+ var newData = produce(originalData, function (draftData) {
388
+ ensureSheetIndex(draftData, mergedSettings.generateSheetId);
389
+ });
390
+ draftCtx.luckysheetfile = newData;
391
+ newData.forEach(function (newDatum) {
392
+ var _a;
393
+ var index = getSheetIndex(draftCtx, newDatum.id);
394
+ var sheet = (_a = draftCtx.luckysheetfile) === null || _a === void 0 ? void 0 : _a[index];
395
+ initSheetData(draftCtx, sheet, index);
396
+ });
397
+ }
398
+ if (mergedSettings.devicePixelRatio > 0) {
399
+ draftCtx.devicePixelRatio = mergedSettings.devicePixelRatio;
400
+ }
401
+ draftCtx.lang = mergedSettings.lang;
402
+ draftCtx.allowEdit = mergedSettings.allowEdit;
403
+ draftCtx.isFlvReadOnly = isFlvReadOnly !== null && isFlvReadOnly !== void 0 ? isFlvReadOnly : false;
404
+ draftCtx.hooks = mergedSettings.hooks;
405
+ if (_.isEmpty(draftCtx.currentSheetId)) {
406
+ initSheetIndex(draftCtx);
407
+ }
408
+ var sheetIdx = getSheetIndex(draftCtx, draftCtx.currentSheetId);
409
+ if (sheetIdx == null) {
410
+ if (((_b = (_a = draftCtx.luckysheetfile) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0) {
411
+ sheetIdx = 0;
412
+ draftCtx.currentSheetId = draftCtx.luckysheetfile[0].id;
413
+ }
414
+ }
415
+ if (sheetIdx == null) return;
416
+ var sheet = (_c = draftCtx.luckysheetfile) === null || _c === void 0 ? void 0 : _c[sheetIdx];
417
+ if (!sheet) return;
418
+ var data = sheet.data;
419
+ if (_.isEmpty(data)) {
420
+ var temp = initSheetData(draftCtx, sheet, sheetIdx);
421
+ if (!_.isNull(temp)) {
422
+ data = temp;
423
+ }
424
+ }
425
+ if (_.isEmpty(draftCtx.luckysheet_select_save) && !_.isEmpty(sheet.luckysheet_select_save)) {
426
+ draftCtx.luckysheet_select_save = sheet.luckysheet_select_save;
427
+ }
428
+ if (((_d = draftCtx.luckysheet_select_save) === null || _d === void 0 ? void 0 : _d.length) === 0) {
429
+ if (((_f = (_e = data === null || data === void 0 ? void 0 : data[0]) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.mc) && !_.isNil((_j = (_h = (_g = data === null || data === void 0 ? void 0 : data[0]) === null || _g === void 0 ? void 0 : _g[0]) === null || _h === void 0 ? void 0 : _h.mc) === null || _j === void 0 ? void 0 : _j.rs) && !_.isNil((_m = (_l = (_k = data === null || data === void 0 ? void 0 : data[0]) === null || _k === void 0 ? void 0 : _k[0]) === null || _l === void 0 ? void 0 : _l.mc) === null || _m === void 0 ? void 0 : _m.cs)) {
430
+ draftCtx.luckysheet_select_save = [{
431
+ row: [0, data[0][0].mc.rs - 1],
432
+ column: [0, data[0][0].mc.cs - 1]
433
+ }];
434
+ } else {
435
+ draftCtx.luckysheet_select_save = [{
436
+ row: [0, 0],
437
+ column: [0, 0]
438
+ }];
439
+ }
440
+ }
441
+ draftCtx.config = _.isNil(sheet.config) ? {} : sheet.config;
442
+ draftCtx.insertedImgs = sheet.images;
443
+ draftCtx.insertedIframes = sheet.iframes;
444
+ draftCtx.currency = mergedSettings.currency || "¥";
445
+ draftCtx.zoomRatio = _.isNil(sheet.zoomRatio) ? 1 : sheet.zoomRatio;
446
+ draftCtx.rowHeaderWidth = mergedSettings.rowHeaderWidth * draftCtx.zoomRatio;
447
+ draftCtx.columnHeaderHeight = mergedSettings.columnHeaderHeight * draftCtx.zoomRatio;
448
+ if (!_.isNil(sheet.defaultRowHeight)) {
449
+ draftCtx.defaultrowlen = Number(sheet.defaultRowHeight);
450
+ } else {
451
+ draftCtx.defaultrowlen = mergedSettings.defaultRowHeight;
452
+ }
453
+ if (!_.isNil(sheet.addRows)) {
454
+ draftCtx.addDefaultRows = Number(sheet.addRows);
455
+ } else {
456
+ draftCtx.addDefaultRows = mergedSettings.addRows;
457
+ }
458
+ if (!_.isNil(sheet.defaultColWidth)) {
459
+ draftCtx.defaultcollen = Number(sheet.defaultColWidth);
460
+ } else {
461
+ draftCtx.defaultcollen = mergedSettings.defaultColWidth;
462
+ }
463
+ if (!_.isNil(sheet.showGridLines)) {
464
+ var showGridLines = sheet.showGridLines;
465
+ if (showGridLines === 0 || showGridLines === false) {
466
+ draftCtx.showGridLines = false;
467
+ } else {
468
+ draftCtx.showGridLines = true;
469
+ }
470
+ } else {
471
+ draftCtx.showGridLines = true;
472
+ }
473
+ if (_.isNil(mergedSettings.lang)) {
474
+ var lang = navigator.languages && navigator.languages[0] || navigator.language || navigator.userLanguage;
475
+ draftCtx.lang = lang;
476
+ }
477
+ }, {
478
+ noHistory: true
479
+ });
480
+ }, [context.currentSheetId, context.luckysheetfile.length, originalData, mergedSettings.defaultRowHeight, mergedSettings.defaultColWidth, mergedSettings.column, mergedSettings.row, mergedSettings.defaultFontSize, mergedSettings.devicePixelRatio, mergedSettings.lang, mergedSettings.allowEdit, mergedSettings.hooks, mergedSettings.generateSheetId, setContextWithProduce, initSheetData, mergedSettings.rowHeaderWidth, mergedSettings.columnHeaderHeight, mergedSettings.addRows, mergedSettings.currency]);
481
+ var isMac = navigator.platform.toUpperCase().includes("MAC");
482
+ var waitingForRInsertRow = false;
483
+ var resetInsertRowTimer;
484
+ var waitingForDelRow = false;
485
+ var resetDeleteRowTimer;
486
+ var onKeyDown = useCallback(function (e) {
487
+ var _a, _b;
488
+ var _c = ref.current,
489
+ getSelection = _c.getSelection,
490
+ getSheet = _c.getSheet,
491
+ setSelection = _c.setSelection;
492
+ var isMacShortcutInsertRow = isMac && e.ctrlKey && e.altKey;
493
+ var isWindowsShortcutInsertRow = !isMac && e.altKey;
494
+ if ((isMacShortcutInsertRow || isWindowsShortcutInsertRow) && e.code === "KeyI") {
495
+ waitingForRInsertRow = true;
496
+ clearTimeout(resetInsertRowTimer);
497
+ resetInsertRowTimer = setTimeout(function () {
498
+ waitingForRInsertRow = false;
499
+ }, 3000);
500
+ e.preventDefault();
501
+ return;
502
+ }
503
+ if (waitingForRInsertRow && (e.code === "KeyR" || e.code === "KeyC")) {
504
+ var direction = "rightbottom";
505
+ var position = void 0;
506
+ var insertRowColOp_1;
507
+ if (e.code === "KeyR") {
508
+ position = getSelection()[0].row[1];
509
+ insertRowColOp_1 = {
510
+ type: "row",
511
+ index: position,
512
+ count: 1,
513
+ direction: direction,
514
+ id: context.currentSheetId
515
+ };
516
+ } else {
517
+ position = getSelection()[0].column[1];
518
+ insertRowColOp_1 = {
519
+ type: "column",
520
+ index: position,
521
+ count: 1,
522
+ direction: direction,
523
+ id: context.currentSheetId
524
+ };
525
+ }
526
+ if (!position) return;
527
+ var range_1 = context.luckysheet_select_save;
528
+ setContextWithProduce(function (draftCtx) {
529
+ if (insertRowColOp_1) insertRowCol(draftCtx, insertRowColOp_1);
530
+ draftCtx.luckysheet_select_save = range_1;
531
+ }, {
532
+ insertRowColOp: insertRowColOp_1
533
+ });
534
+ waitingForRInsertRow = false;
535
+ clearTimeout(resetInsertRowTimer);
536
+ e.preventDefault();
537
+ }
538
+ var isDashKey = e.key === "-" || e.code === "Minus";
539
+ var isSecondShortcut = isMac ? e.metaKey && e.altKey && isDashKey : e.ctrlKey && e.altKey && isDashKey;
540
+ if (isSecondShortcut) {
541
+ waitingForDelRow = true;
542
+ clearTimeout(resetDeleteRowTimer);
543
+ resetDeleteRowTimer = setTimeout(function () {
544
+ waitingForDelRow = false;
545
+ console.log("Timeout: No second key (R or C) pressed in time.");
546
+ }, 3000);
547
+ e.preventDefault();
548
+ return;
549
+ }
550
+ if (waitingForDelRow && (e.code === "KeyR" || e.code === "KeyC")) {
551
+ var st_index_1;
552
+ var ed_index_1;
553
+ if (e.code === "KeyR") {
554
+ _a = getSelection()[0].row, st_index_1 = _a[0], ed_index_1 = _a[1];
555
+ var range_2 = context.luckysheet_select_save;
556
+ setContextWithProduce(function (draftCtx) {
557
+ deleteRowCol(draftCtx, {
558
+ type: "row",
559
+ start: st_index_1,
560
+ end: ed_index_1,
561
+ id: context.currentSheetId
562
+ });
563
+ draftCtx.luckysheet_select_save = range_2;
564
+ });
565
+ } else {
566
+ _b = getSelection()[0].column, st_index_1 = _b[0], ed_index_1 = _b[1];
567
+ var range_3 = context.luckysheet_select_save;
568
+ setContextWithProduce(function (draftCtx) {
569
+ deleteRowCol(draftCtx, {
570
+ type: "column",
571
+ start: st_index_1,
572
+ end: ed_index_1,
573
+ id: context.currentSheetId
574
+ });
575
+ draftCtx.luckysheet_select_save = range_3;
576
+ });
577
+ }
578
+ waitingForDelRow = false;
579
+ clearTimeout(resetDeleteRowTimer);
580
+ e.preventDefault();
581
+ return;
582
+ }
583
+ if (e.ctrlKey && e.code === "Space") {
584
+ e.stopPropagation();
585
+ e.preventDefault();
586
+ var selection = getSelection();
587
+ var selectedCol = selection === null || selection === void 0 ? void 0 : selection[0].column;
588
+ var totalRow = getSheet().data.length;
589
+ setSelection([{
590
+ row: [0, totalRow - 1],
591
+ column: selectedCol
592
+ }]);
593
+ }
594
+ if (e.shiftKey && e.code === "Space") {
595
+ e.stopPropagation();
596
+ e.preventDefault();
597
+ var selection = getSelection();
598
+ var selectedRow = selection === null || selection === void 0 ? void 0 : selection[0].row;
599
+ var totalCol = getSheet().data[0].length;
600
+ setSelection([{
601
+ row: selectedRow,
602
+ column: [0, totalCol - 1]
603
+ }]);
604
+ }
605
+ var nativeEvent = e.nativeEvent;
606
+ if ((e.ctrlKey || e.metaKey) && e.code === "KeyZ") {
607
+ if (e.shiftKey) {
608
+ handleRedo();
609
+ } else {
610
+ handleUndo();
611
+ }
612
+ e.stopPropagation();
613
+ return;
614
+ }
615
+ if ((e.ctrlKey || e.metaKey) && e.code === "KeyY") {
616
+ handleRedo();
617
+ e.stopPropagation();
618
+ e.preventDefault();
619
+ return;
620
+ }
621
+ setContextWithProduce(function (draftCtx) {
622
+ handleGlobalKeyDown(draftCtx, cellInput.current, fxInput.current, nativeEvent, globalCache.current, handleUndo, handleRedo, canvas.current.getContext("2d"));
623
+ });
624
+ }, [handleRedo, handleUndo, setContextWithProduce]);
625
+ var onPaste = useCallback(function (e) {
626
+ var _a;
627
+ if (cellInput.current === document.activeElement || ((_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.className) === "fortune-sheet-overlay") {
628
+ var clipboardData = e.clipboardData;
629
+ if (!clipboardData) {
630
+ clipboardData = window.clipboardData;
631
+ }
632
+ var txtdata = clipboardData.getData("text/html") || clipboardData.getData("text/plain");
633
+ var ele = document.createElement("div");
634
+ ele.innerHTML = txtdata;
635
+ var trList = ele.querySelectorAll("table tr");
636
+ var maxRow = trList.length + context.luckysheet_select_save[0].row[0];
637
+ var rowToBeAdded = maxRow - context.luckysheetfile[getSheetIndex(context, context.currentSheetId)].data.length;
638
+ var range_4 = context.luckysheet_select_save;
639
+ if (rowToBeAdded > 0) {
640
+ var insertRowColOp_2 = {
641
+ type: "row",
642
+ index: context.luckysheetfile[getSheetIndex(context, context.currentSheetId)].data.length - 1,
643
+ count: rowToBeAdded,
644
+ direction: "rightbottom",
645
+ id: context.currentSheetId
646
+ };
647
+ setContextWithProduce(function (draftCtx) {
648
+ insertRowCol(draftCtx, insertRowColOp_2);
649
+ draftCtx.luckysheet_select_save = range_4;
650
+ }, {
651
+ insertRowColOp: insertRowColOp_2
652
+ });
653
+ }
654
+ setContextWithProduce(function (draftCtx) {
655
+ try {
656
+ handlePaste(draftCtx, e);
657
+ } catch (err) {
658
+ console.error(err);
659
+ }
660
+ });
661
+ }
662
+ }, [context, setContextWithProduce]);
663
+ var onMoreToolbarItemsClose = useCallback(function () {
664
+ setMoreToolbarItems(null);
665
+ }, []);
666
+ useEffect(function () {
667
+ document.addEventListener("paste", onPaste);
668
+ return function () {
669
+ document.removeEventListener("paste", onPaste);
670
+ };
671
+ }, [onPaste]);
672
+ useImperativeHandle(ref, function () {
673
+ return generateAPIs(context, setContextWithProduce, handleUndo, handleRedo, mergedSettings, cellInput.current, scrollbarX.current, scrollbarY.current, globalCache.current);
674
+ }, [context, setContextWithProduce, handleUndo, handleRedo, mergedSettings, globalCache]);
675
+ var i = getSheetIndex(context, context.currentSheetId);
676
+ if (i == null) {
677
+ return null;
678
+ }
679
+ var sheet = (_b = context.luckysheetfile) === null || _b === void 0 ? void 0 : _b[i];
680
+ if (!sheet) {
681
+ return null;
682
+ }
683
+ return /*#__PURE__*/React.createElement(WorkbookContext.Provider, {
684
+ value: providerValue
685
+ }, /*#__PURE__*/React.createElement(ModalProvider, null, /*#__PURE__*/React.createElement("div", {
686
+ className: "fortune-container",
687
+ ref: workbookContainer,
688
+ onKeyDown: onKeyDown
689
+ }, /*#__PURE__*/React.createElement(SVGDefines, {
690
+ currency: mergedSettings.currency
691
+ }), /*#__PURE__*/React.createElement("div", {
692
+ className: "fortune-workarea"
693
+ }, mergedSettings.showToolbar && (/*#__PURE__*/React.createElement(Toolbar, {
694
+ moreItemsOpen: moreToolbarItems !== null,
695
+ setMoreItems: setMoreToolbarItems,
696
+ onMoreToolbarItemsClose: onMoreToolbarItemsClose,
697
+ moreToolbarItems: moreToolbarItems
698
+ })), mergedSettings.showFormulaBar && /*#__PURE__*/React.createElement(FxEditor, null)), /*#__PURE__*/React.createElement(Sheet, {
699
+ sheet: sheet
700
+ }), mergedSettings.showSheetTabs && /*#__PURE__*/React.createElement(SheetTab, null), /*#__PURE__*/React.createElement(ContextMenu, null), /*#__PURE__*/React.createElement(FilterMenu, null), /*#__PURE__*/React.createElement(SheetTabContextMenu, null), context.showSheetList && /*#__PURE__*/React.createElement(SheetList, null), !_.isEmpty(context.contextMenu) && (/*#__PURE__*/React.createElement("div", {
701
+ onMouseDown: function onMouseDown() {
702
+ setContextWithProduce(function (draftCtx) {
703
+ draftCtx.contextMenu = {};
704
+ draftCtx.filterContextMenu = undefined;
705
+ draftCtx.showSheetList = undefined;
706
+ });
707
+ },
708
+ onMouseMove: function onMouseMove(e) {
709
+ return e.stopPropagation();
710
+ },
711
+ onMouseUp: function onMouseUp(e) {
712
+ return e.stopPropagation();
713
+ },
714
+ onContextMenu: function onContextMenu(e) {
715
+ e.preventDefault();
716
+ e.stopPropagation();
717
+ },
718
+ className: "fortune-popover-backdrop"
719
+ })), /*#__PURE__*/React.createElement("div", {
720
+ className: "fortune-stat-area"
721
+ }, /*#__PURE__*/React.createElement("div", {
722
+ className: "luckysheet-sheet-selection-calInfo"
723
+ }, !!calInfo.count && (/*#__PURE__*/React.createElement("div", {
724
+ style: {
725
+ width: "60px"
726
+ }
727
+ }, formula.count, ": ", calInfo.count)), !!calInfo.numberC && !!calInfo.sum && (/*#__PURE__*/React.createElement("div", null, formula.sum, ": ", calInfo.sum)), !!calInfo.numberC && !!calInfo.average && (/*#__PURE__*/React.createElement("div", null, formula.average, ": ", calInfo.average)), !!calInfo.numberC && !!calInfo.max && (/*#__PURE__*/React.createElement("div", null, formula.max, ": ", calInfo.max)), !!calInfo.numberC && !!calInfo.min && (/*#__PURE__*/React.createElement("div", null, formula.min, ": ", calInfo.min)))), context.showDunePreview && (/*#__PURE__*/React.createElement(DunePreview, {
728
+ url: context.showDunePreview.url,
729
+ position: context.showDunePreview.position,
730
+ onKeepAsLink: function onKeepAsLink() {
731
+ setContextWithProduce(function (draftCtx) {
732
+ draftCtx.showDunePreview = undefined;
733
+ }, {
734
+ noHistory: true
735
+ });
736
+ },
737
+ onEmbed: function onEmbed() {
738
+ var _a;
739
+ setContextWithProduce(function (draftCtx) {
740
+ insertDuneChart(draftCtx, context.showDunePreview.url);
741
+ draftCtx.showDunePreview = undefined;
742
+ }, {
743
+ noHistory: true
744
+ });
745
+ (_a = mergedSettings.onDuneChartEmbed) === null || _a === void 0 ? void 0 : _a.call(mergedSettings);
746
+ }
747
+ })))));
748
+ });
749
+ export default Workbook;