@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,1722 @@
1
+ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) {
3
+ return value instanceof P ? value : new P(function (resolve) {
4
+ resolve(value);
5
+ });
6
+ }
7
+ return new (P || (P = Promise))(function (resolve, reject) {
8
+ function fulfilled(value) {
9
+ try {
10
+ step(generator.next(value));
11
+ } catch (e) {
12
+ reject(e);
13
+ }
14
+ }
15
+ function rejected(value) {
16
+ try {
17
+ step(generator["throw"](value));
18
+ } catch (e) {
19
+ reject(e);
20
+ }
21
+ }
22
+ function step(result) {
23
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
24
+ }
25
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
26
+ });
27
+ };
28
+ var __generator = this && this.__generator || function (thisArg, body) {
29
+ var _ = {
30
+ label: 0,
31
+ sent: function sent() {
32
+ if (t[0] & 1) throw t[1];
33
+ return t[1];
34
+ },
35
+ trys: [],
36
+ ops: []
37
+ },
38
+ f,
39
+ y,
40
+ t,
41
+ g;
42
+ return g = {
43
+ next: verb(0),
44
+ "throw": verb(1),
45
+ "return": verb(2)
46
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
47
+ return this;
48
+ }), g;
49
+ function verb(n) {
50
+ return function (v) {
51
+ return step([n, v]);
52
+ };
53
+ }
54
+ function step(op) {
55
+ if (f) throw new TypeError("Generator is already executing.");
56
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
57
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
58
+ if (y = 0, t) op = [op[0] & 2, t.value];
59
+ switch (op[0]) {
60
+ case 0:
61
+ case 1:
62
+ t = op;
63
+ break;
64
+ case 4:
65
+ _.label++;
66
+ return {
67
+ value: op[1],
68
+ done: false
69
+ };
70
+ case 5:
71
+ _.label++;
72
+ y = op[1];
73
+ op = [0];
74
+ continue;
75
+ case 7:
76
+ op = _.ops.pop();
77
+ _.trys.pop();
78
+ continue;
79
+ default:
80
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
81
+ _ = 0;
82
+ continue;
83
+ }
84
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
85
+ _.label = op[1];
86
+ break;
87
+ }
88
+ if (op[0] === 6 && _.label < t[1]) {
89
+ _.label = t[1];
90
+ t = op;
91
+ break;
92
+ }
93
+ if (t && _.label < t[2]) {
94
+ _.label = t[2];
95
+ _.ops.push(op);
96
+ break;
97
+ }
98
+ if (t[2]) _.ops.pop();
99
+ _.trys.pop();
100
+ continue;
101
+ }
102
+ op = body.call(thisArg, _);
103
+ } catch (e) {
104
+ op = [6, e];
105
+ y = 0;
106
+ } finally {
107
+ f = t = 0;
108
+ }
109
+ if (op[0] & 5) throw op[1];
110
+ return {
111
+ value: op[0] ? op[1] : void 0,
112
+ done: true
113
+ };
114
+ }
115
+ };
116
+ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
117
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
118
+ if (ar || !(i in from)) {
119
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
120
+ ar[i] = from[i];
121
+ }
122
+ }
123
+ return to.concat(ar || Array.prototype.slice.call(from));
124
+ };
125
+ import React, { useContext, useCallback, useRef, useEffect, useState } from "react";
126
+ import { toolbarItemClickHandler, handleTextBackground, handleTextColor, handleTextSize, normalizedCellAttr, getFlowdata, newComment, editComment, deleteComment, showHideComment, showHideAllComments, autoSelectionFormula, handleSum, locale, handleMerge, handleBorder, toolbarItemSelectedFunc, handleFreeze, insertImage, showImgChooser, updateFormat, handleSort, handleHorizontalAlign, handleVerticalAlign, handleScreenShot, createFilter, clearFilter, applyLocation, insertDuneChart } from "@fileverse-dev/fortune-core";
127
+ import _ from "lodash";
128
+ import { IconButton, LucideIcon, Tooltip, Command, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem } from "@fileverse/ui";
129
+ import WorkbookContext from "../../context";
130
+ import "./index.css";
131
+ import Button from "./Button";
132
+ import Divider, { MenuDivider } from "./Divider";
133
+ import Combo from "./Combo";
134
+ import Select, { Option } from "./Select";
135
+ import SVGIcon from "../SVGIcon";
136
+ import { useDialog } from "../../hooks/useDialog";
137
+ import { SplitColumn } from "../SplitColumn";
138
+ import { LocationCondition } from "../LocationCondition";
139
+ import DataVerification from "../DataVerification";
140
+ import ConditionalFormat from "../ConditionFormat";
141
+ import CustomButton from "./CustomButton";
142
+ import { CustomColor } from "./CustomColor";
143
+ import { FormatSearch } from "../FormatSearch";
144
+ import DuneChartsInputModal from "../DuneChartsInputModal/DuneChartsInputModal";
145
+ import MoreItemsContaier from "./MoreItemsContainer";
146
+ import CryptoDenominationSelector from "../CryptoDenominationSelector";
147
+ import { getGroupedCurrencyOptions, CRYPTO_OPTIONS } from "../../constants";
148
+ import { convertCellsToCrypto, getFiatSymbol } from "../../utils/convertCellsToCrypto";
149
+ import { updateCellsDecimalFormat } from "../../utils/updateCellsDecimalFormat";
150
+ export var getLucideIcon = function getLucideIcon(title) {
151
+ switch (title) {
152
+ case "undo":
153
+ return "Undo";
154
+ case "redo":
155
+ return "Redo";
156
+ case "format-painter":
157
+ return "PaintRoller";
158
+ case "bold":
159
+ return "Bold";
160
+ case "italic":
161
+ return "Italic";
162
+ case "strike-through":
163
+ return "Strikethrough";
164
+ case "underline":
165
+ return "Underline";
166
+ case "align-left":
167
+ return "AlignLeft";
168
+ case "align-center":
169
+ return "AlignCenter";
170
+ case "align-right":
171
+ return "AlignRight";
172
+ case "align-top":
173
+ return "ArrowUpFromLine";
174
+ case "align-middle":
175
+ return "AlignVerticalMiddle";
176
+ case "align-bottom":
177
+ return "ArrowDownToLine";
178
+ case "text-overflow":
179
+ return "TextOverflow";
180
+ case "text-wrap":
181
+ return "WrapText";
182
+ case "text-clip":
183
+ return "TextClip";
184
+ case "font-color":
185
+ return "Baseline";
186
+ case "background":
187
+ return "PaintBucket";
188
+ case "border-all":
189
+ return "Border";
190
+ case "merge-all":
191
+ return "MergeHorizontal";
192
+ case "format":
193
+ return "DollarSign";
194
+ case "currency-format":
195
+ return "DollarSign";
196
+ case "currency":
197
+ return "ChevronDown";
198
+ case "percentage-format":
199
+ return "Percent";
200
+ case "number-decrease":
201
+ return "DecimalsArrowLeft";
202
+ case "number-increase":
203
+ return "DecimalsArrowRight";
204
+ case "conditionFormat":
205
+ return "PaintbrushVertical";
206
+ case "filter":
207
+ return "Filter";
208
+ case "link":
209
+ return "Link";
210
+ case "comment":
211
+ return "MessageSquarePlus";
212
+ case "image":
213
+ return "Image";
214
+ case "formula-sum":
215
+ return "Sigma";
216
+ case "dataVerification":
217
+ return "ShieldCheck";
218
+ case "search":
219
+ return "Search";
220
+ case "dune":
221
+ return "DuneChart";
222
+ case "crypto":
223
+ return "Ethereum";
224
+ case "Ellipsis":
225
+ return "Ellipsis";
226
+ default:
227
+ return "";
228
+ }
229
+ };
230
+ export var CurrencySelector = function CurrencySelector(_a) {
231
+ var cell = _a.cell,
232
+ defaultTextFormat = _a.defaultTextFormat,
233
+ toolTipText = _a.toolTipText;
234
+ var _b = useContext(WorkbookContext),
235
+ context = _b.context,
236
+ setContext = _b.setContext,
237
+ refs = _b.refs;
238
+ var _c = useState(""),
239
+ searchTerm = _c[0],
240
+ setSearchTerm = _c[1];
241
+ var _d = useState(2),
242
+ decimals = _d[0],
243
+ setDecimals = _d[1];
244
+ var _e = useState("USD"),
245
+ selectedFiat = _e[0],
246
+ setSelectedFiat = _e[1];
247
+ var currentFmt = defaultTextFormat;
248
+ var currentIcon = "currency";
249
+ if (cell) {
250
+ var curr_1 = normalizedCellAttr(cell, "ct");
251
+ if (curr_1 === null || curr_1 === void 0 ? void 0 : curr_1.fa) {
252
+ var allOptions = __spreadArray(__spreadArray([], CRYPTO_OPTIONS, true), locale(context).currencyDetail.map(function (c) {
253
+ return {
254
+ label: c.name,
255
+ value: c.value,
256
+ icon: undefined,
257
+ type: "fiat"
258
+ };
259
+ }), true);
260
+ var found = __spreadArray([], allOptions, true).sort(function (a, b) {
261
+ return b.value.length - a.value.length;
262
+ }).find(function (o) {
263
+ return curr_1.fa.includes(o.value);
264
+ });
265
+ if (found) {
266
+ currentFmt = found.label;
267
+ }
268
+ }
269
+ }
270
+ var groupedOptions = getGroupedCurrencyOptions(locale(context).currencyDetail);
271
+ var filterOptions = function filterOptions(options) {
272
+ if (!searchTerm.trim()) return options;
273
+ var query = searchTerm.trim().toLowerCase();
274
+ return options.filter(function (opt) {
275
+ return query.split(/\s+/).every(function (word) {
276
+ return opt.label.toLowerCase().includes(word) || opt.value.toLowerCase().includes(word);
277
+ });
278
+ });
279
+ };
280
+ var dedupeByValue = function dedupeByValue(options) {
281
+ var seen = new Set();
282
+ return options.filter(function (opt) {
283
+ if (seen.has(opt.value)) return false;
284
+ seen.add(opt.value);
285
+ return true;
286
+ });
287
+ };
288
+ var handleCurrencyDecimalsChange = function handleCurrencyDecimalsChange(newDecimals) {
289
+ setDecimals(newDecimals);
290
+ var isCrypto = false;
291
+ if (cell && cell.ct && typeof cell.ct.fa === "string") {
292
+ var _a = cell.ct.fa.match(/"([A-Z]+)"/) || [],
293
+ matchedDenom = _a[1];
294
+ if (matchedDenom) isCrypto = true;
295
+ }
296
+ updateCellsDecimalFormat({
297
+ context: context,
298
+ setContext: setContext,
299
+ decimals: newDecimals,
300
+ denomination: isCrypto ? undefined : selectedFiat
301
+ });
302
+ };
303
+ var triggerRef = useRef(null);
304
+ return /*#__PURE__*/React.createElement("div", {
305
+ style: {
306
+ padding: "0px"
307
+ },
308
+ className: "items-center fortune-toolbar-button"
309
+ }, /*#__PURE__*/React.createElement(Tooltip, {
310
+ text: toolTipText,
311
+ placement: "bottom"
312
+ }, /*#__PURE__*/React.createElement("div", {
313
+ className: "",
314
+ onClick: function onClick() {
315
+ var _a;
316
+ (_a = triggerRef === null || triggerRef === void 0 ? void 0 : triggerRef.current) === null || _a === void 0 ? void 0 : _a.click();
317
+ },
318
+ tabIndex: 0,
319
+ role: "button"
320
+ }, /*#__PURE__*/React.createElement(LucideIcon, {
321
+ name: getLucideIcon("currency-format"),
322
+ width: 16,
323
+ height: 16
324
+ }))), /*#__PURE__*/React.createElement(Combo, {
325
+ iconId: currentIcon,
326
+ text: currentFmt,
327
+ key: "currency",
328
+ tooltip: "",
329
+ showArrow: true,
330
+ triggerRef: triggerRef
331
+ }, function (setOpen) {
332
+ return /*#__PURE__*/React.createElement("div", {
333
+ style: {
334
+ minWidth: "20rem",
335
+ boxShadow: "2px 2px 10px rgba(0, 0, 0, 0.2)",
336
+ borderRadius: "8px"
337
+ }
338
+ }, /*#__PURE__*/React.createElement(Command, {
339
+ className: "border color-border-default rounded-lg"
340
+ }, /*#__PURE__*/React.createElement("div", {
341
+ id: "search-input-container"
342
+ }, /*#__PURE__*/React.createElement(CommandInput, {
343
+ placeholder: "Search by name or code",
344
+ value: searchTerm,
345
+ onValueChange: setSearchTerm
346
+ })), /*#__PURE__*/React.createElement("div", {
347
+ className: "px-4 py-2 border-b color-border-default flex items-center justify-between gap-2 text-body-sm color-text-default",
348
+ onClick: function onClick(e) {
349
+ return e.stopPropagation();
350
+ }
351
+ }, /*#__PURE__*/React.createElement("span", null, "Decimal places:"), /*#__PURE__*/React.createElement("span", {
352
+ className: "cds-row flex items-center"
353
+ }, /*#__PURE__*/React.createElement(IconButton, {
354
+ icon: "Minus",
355
+ variant: "ghost",
356
+ size: "sm",
357
+ className: "",
358
+ disabled: decimals === 1,
359
+ onClick: function onClick() {
360
+ return handleCurrencyDecimalsChange(Math.max(1, decimals - 1));
361
+ }
362
+ }), /*#__PURE__*/React.createElement("input", {
363
+ type: "number",
364
+ min: 1,
365
+ max: 18,
366
+ value: decimals,
367
+ onChange: function onChange(e) {
368
+ return handleCurrencyDecimalsChange(Math.max(1, Math.min(18, Number(e.target.value))));
369
+ }
370
+ }), /*#__PURE__*/React.createElement(IconButton, {
371
+ icon: "Plus",
372
+ variant: "ghost",
373
+ size: "sm",
374
+ disabled: decimals === 18,
375
+ onClick: function onClick() {
376
+ return handleCurrencyDecimalsChange(Math.min(18, decimals + 1));
377
+ }
378
+ }))), /*#__PURE__*/React.createElement(CommandList, null, /*#__PURE__*/React.createElement(CommandEmpty, {
379
+ className: "text-center text-body-sm color-text-secondary flex items-center justify-center",
380
+ style: {
381
+ minHeight: "5rem"
382
+ }
383
+ }, "No results found."), groupedOptions.map(function (group) {
384
+ var filtered = dedupeByValue(filterOptions(group.options));
385
+ return /*#__PURE__*/React.createElement(CommandGroup, {
386
+ key: group.group,
387
+ heading: group.group
388
+ }, filtered.map(function (opt) {
389
+ return /*#__PURE__*/React.createElement(CommandItem, {
390
+ key: opt.value,
391
+ value: "".concat(opt.label, " ").concat(opt.value),
392
+ onSelect: function onSelect() {
393
+ return __awaiter(void 0, void 0, void 0, function () {
394
+ return __generator(this, function (_a) {
395
+ switch (_a.label) {
396
+ case 0:
397
+ if (!(opt.type === "crypto")) return [3, 2];
398
+ return [4, convertCellsToCrypto({
399
+ context: context,
400
+ setContext: setContext,
401
+ denomination: opt.value,
402
+ decimals: decimals
403
+ })];
404
+ case 1:
405
+ _a.sent();
406
+ return [3, 3];
407
+ case 2:
408
+ setSelectedFiat(opt.value);
409
+ setContext(function (ctx) {
410
+ var d = getFlowdata(ctx);
411
+ if (d == null) return;
412
+ var formatString = "".concat(getFiatSymbol(opt.value), " #,##0.").concat("0".repeat(decimals));
413
+ updateFormat(ctx, refs.cellInput.current, d, "ct", formatString);
414
+ });
415
+ _a.label = 3;
416
+ case 3:
417
+ setOpen(false);
418
+ return [2];
419
+ }
420
+ });
421
+ });
422
+ }
423
+ }, /*#__PURE__*/React.createElement("div", {
424
+ className: "fortune-toolbar-menu-line flex items-center justify-between w-full"
425
+ }, /*#__PURE__*/React.createElement("div", {
426
+ className: "flex items-center gap-2 w-[250px]"
427
+ }, currentFmt === opt.label ? (/*#__PURE__*/React.createElement(LucideIcon, {
428
+ name: "Check",
429
+ className: "w-4 h-4"
430
+ })) : (/*#__PURE__*/React.createElement("span", {
431
+ className: "w-4 h-4"
432
+ })), /*#__PURE__*/React.createElement("span", {
433
+ className: "truncate flex-1 overflow-hidden whitespace-nowrap"
434
+ }, opt.label)), opt.type === "crypto" ? (/*#__PURE__*/React.createElement("span", {
435
+ className: "color-text-secondary"
436
+ }, /*#__PURE__*/React.createElement(LucideIcon, {
437
+ name: opt.icon,
438
+ className: "cds-icon"
439
+ }), opt.value === "SOL" && (/*#__PURE__*/React.createElement(SVGIcon, {
440
+ name: "solana",
441
+ width: 16,
442
+ height: 16
443
+ })))) : (/*#__PURE__*/React.createElement("span", {
444
+ className: "color-text-secondary"
445
+ }, opt.value))));
446
+ }));
447
+ }))));
448
+ }));
449
+ };
450
+ var Toolbar = function Toolbar(_a) {
451
+ var _b, _c, _d;
452
+ var setMoreItems = _a.setMoreItems,
453
+ moreItemsOpen = _a.moreItemsOpen,
454
+ onMoreToolbarItemsClose = _a.onMoreToolbarItemsClose,
455
+ moreToolbarItems = _a.moreToolbarItems;
456
+ var _e = useContext(WorkbookContext),
457
+ context = _e.context,
458
+ setContext = _e.setContext,
459
+ refs = _e.refs,
460
+ settings = _e.settings,
461
+ handleUndo = _e.handleUndo,
462
+ handleRedo = _e.handleRedo;
463
+ var contextRef = useRef(context);
464
+ var containerRef = useRef(null);
465
+ var _f = useState(-1),
466
+ toolbarWrapIndex = _f[0],
467
+ setToolbarWrapIndex = _f[1];
468
+ var _g = useState([]),
469
+ itemLocations = _g[0],
470
+ setItemLocations = _g[1];
471
+ var _h = useState(false),
472
+ showDuneModal = _h[0],
473
+ setShowDuneModal = _h[1];
474
+ var _j = useState(window.innerWidth >= 1280),
475
+ isDesktop = _j[0],
476
+ setIsDesktop = _j[1];
477
+ var _k = useDialog(),
478
+ showDialog = _k.showDialog,
479
+ hideDialog = _k.hideDialog;
480
+ var firstSelection = (_b = context.luckysheet_select_save) === null || _b === void 0 ? void 0 : _b[0];
481
+ var flowdata = getFlowdata(context);
482
+ contextRef.current = context;
483
+ var row = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.row_focus;
484
+ var col = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.column_focus;
485
+ var cell = flowdata && row != null && col != null ? (_c = flowdata === null || flowdata === void 0 ? void 0 : flowdata[row]) === null || _c === void 0 ? void 0 : _c[col] : undefined;
486
+ var _l = locale(context),
487
+ toolbar = _l.toolbar,
488
+ merge = _l.merge,
489
+ border = _l.border,
490
+ freezen = _l.freezen,
491
+ defaultFmt = _l.defaultFmt,
492
+ formula = _l.formula,
493
+ sort = _l.sort,
494
+ align = _l.align,
495
+ textWrap = _l.textWrap,
496
+ rotation = _l.rotation,
497
+ screenshot = _l.screenshot,
498
+ filter = _l.filter,
499
+ splitText = _l.splitText,
500
+ findAndReplace = _l.findAndReplace,
501
+ comment = _l.comment,
502
+ fontarray = _l.fontarray;
503
+ var toolbarFormat = locale(context).format;
504
+ var sheetWidth = context.luckysheetTableContentHW[0];
505
+ var currency = settings.currency;
506
+ var defaultFormat = defaultFmt(currency);
507
+ var customColor = useState("#000000")[0];
508
+ var customStyle = useState("1")[0];
509
+ var showSubMenu = useCallback(function (e, className) {
510
+ var target = e.target;
511
+ var menuItem = target.className === "fortune-toolbar-menu-line" ? target.parentElement : target;
512
+ var menuItemRect = menuItem.getBoundingClientRect();
513
+ var workbookContainerRect = refs.workbookContainer.current.getBoundingClientRect();
514
+ var subMenu = menuItem.querySelector(".".concat(className));
515
+ if (_.isNil(subMenu)) return;
516
+ var menuItemStyle = window.getComputedStyle(menuItem);
517
+ var menuItemPaddingRight = parseFloat(menuItemStyle.getPropertyValue("padding-right").replace("px", ""));
518
+ if (workbookContainerRect.right - menuItemRect.right < parseFloat(subMenu.style.width.replace("px", ""))) {
519
+ subMenu.style.display = "block";
520
+ subMenu.style.right = "".concat(menuItemRect.width - menuItemPaddingRight, "px");
521
+ } else {
522
+ subMenu.style.display = "block";
523
+ subMenu.style.right = className === "more-format" ? "".concat(-(parseFloat(subMenu.style.width.replace("px", "")) + 0), "px") : "".concat(-(parseFloat(subMenu.style.width.replace("px", "")) + menuItemPaddingRight), "px");
524
+ }
525
+ }, [refs.workbookContainer]);
526
+ var hideSubMenu = useCallback(function (e, className) {
527
+ var target = e.target;
528
+ if (target.className === "".concat(className)) {
529
+ target.style.display = "none";
530
+ return;
531
+ }
532
+ var subMenu = target.className === "condition-format-item" ? target.parentElement : target.querySelector(".".concat(className));
533
+ if (_.isNil(subMenu)) return;
534
+ subMenu.style.display = "none";
535
+ }, []);
536
+ useEffect(function () {
537
+ var handleResize = function handleResize() {
538
+ setIsDesktop(window.innerWidth >= 1280);
539
+ };
540
+ window.addEventListener("resize", handleResize);
541
+ return function () {
542
+ return window.removeEventListener("resize", handleResize);
543
+ };
544
+ }, []);
545
+ useEffect(function () {
546
+ setToolbarWrapIndex(-1);
547
+ }, [settings.toolbarItems, settings.customToolbarItems]);
548
+ useEffect(function () {
549
+ if (toolbarWrapIndex === -1) {
550
+ var container = containerRef.current;
551
+ if (!container) return;
552
+ var items = container.querySelectorAll(".fortune-toolbar-item");
553
+ if (!items) return;
554
+ var locations = [];
555
+ var containerRect = container.getBoundingClientRect();
556
+ for (var i = 0; i < items.length; i += 1) {
557
+ var item = items[i];
558
+ var itemRect = item.getBoundingClientRect();
559
+ locations.push(itemRect.left - containerRect.left + itemRect.width);
560
+ }
561
+ setItemLocations(locations);
562
+ }
563
+ }, [toolbarWrapIndex, sheetWidth]);
564
+ useEffect(function () {
565
+ if (isDesktop) {
566
+ setToolbarWrapIndex(-1);
567
+ setMoreItems(null);
568
+ return;
569
+ }
570
+ if (itemLocations.length === 0) return;
571
+ var container = containerRef.current;
572
+ if (!container) return;
573
+ var moreButtonWidth = 50;
574
+ var containerWidth = container.getBoundingClientRect().width;
575
+ var availableWidth = containerWidth - 30;
576
+ for (var i = itemLocations.length - 1; i >= 0; i -= 1) {
577
+ var loc = itemLocations[i];
578
+ if (loc + moreButtonWidth < availableWidth) {
579
+ setToolbarWrapIndex(i - itemLocations.length + settings.toolbarItems.length);
580
+ if (i === itemLocations.length - 1) {
581
+ setMoreItems(null);
582
+ }
583
+ break;
584
+ }
585
+ }
586
+ }, [itemLocations, setMoreItems, settings.toolbarItems.length, sheetWidth, isDesktop]);
587
+ var getToolbarItem = useCallback(function (name, i) {
588
+ var _a, _b, _c, _d, _e, _f;
589
+ var tooltip = toolbar[name];
590
+ if (name === "|") {
591
+ return /*#__PURE__*/React.createElement(Divider, {
592
+ key: i
593
+ });
594
+ }
595
+ if (["font-color", "background"].includes(name)) {
596
+ var pick_1 = function pick_1(color) {
597
+ setContext(function (draftCtx) {
598
+ return (name === "font-color" ? handleTextColor : handleTextBackground)(draftCtx, refs.cellInput.current, color);
599
+ });
600
+ if (name === "font-color") {
601
+ refs.globalCache.recentTextColor = color;
602
+ } else {
603
+ refs.globalCache.recentBackgroundColor = color;
604
+ }
605
+ };
606
+ return /*#__PURE__*/React.createElement("div", {
607
+ style: {
608
+ position: "relative"
609
+ },
610
+ key: name
611
+ }, /*#__PURE__*/React.createElement("div", {
612
+ style: {
613
+ width: 24,
614
+ height: 4,
615
+ backgroundColor: name === "font-color" ? refs.globalCache.recentTextColor : refs.globalCache.recentBackgroundColor,
616
+ position: "absolute",
617
+ bottom: 2,
618
+ left: 3,
619
+ zIndex: 100
620
+ }
621
+ }), /*#__PURE__*/React.createElement(Combo, {
622
+ iconId: name,
623
+ tooltip: tooltip,
624
+ showArrow: false,
625
+ fillColor: name === "font-color" ? refs.globalCache.recentTextColor : undefined,
626
+ onClick: function onClick() {
627
+ var color = name === "font-color" ? refs.globalCache.recentTextColor : refs.globalCache.recentBackgroundColor;
628
+ if (color) pick_1(color);
629
+ }
630
+ }, function (setOpen) {
631
+ return /*#__PURE__*/React.createElement(CustomColor, {
632
+ onCustomPick: function onCustomPick(color) {
633
+ pick_1(color);
634
+ setOpen(false);
635
+ },
636
+ onColorPick: pick_1
637
+ });
638
+ }));
639
+ }
640
+ if (name === "format") {
641
+ var currentFmt = defaultFormat[0].text;
642
+ if (cell) {
643
+ var curr_2 = normalizedCellAttr(cell, "ct");
644
+ var format = _.find(defaultFormat, function (v) {
645
+ return v.value === (curr_2 === null || curr_2 === void 0 ? void 0 : curr_2.fa);
646
+ });
647
+ if ((curr_2 === null || curr_2 === void 0 ? void 0 : curr_2.fa) != null) {
648
+ if (format != null) {
649
+ currentFmt = format.text;
650
+ } else {
651
+ currentFmt = defaultFormat[defaultFormat.length - 1].text;
652
+ }
653
+ }
654
+ }
655
+ return /*#__PURE__*/React.createElement(Combo, {
656
+ text: currentFmt,
657
+ key: name,
658
+ tooltip: tooltip,
659
+ showArrow: false
660
+ }, function (setOpen) {
661
+ return /*#__PURE__*/React.createElement(Select, null, defaultFormat.map(function (_a, ii) {
662
+ var text = _a.text,
663
+ value = _a.value,
664
+ example = _a.example;
665
+ if (value === "split") {
666
+ return /*#__PURE__*/React.createElement(MenuDivider, {
667
+ key: ii
668
+ });
669
+ }
670
+ if (value === "fmtOtherSelf") {
671
+ return /*#__PURE__*/React.createElement(Option, {
672
+ key: value,
673
+ onClick: function onClick() {
674
+ showDialog(/*#__PURE__*/React.createElement(FormatSearch, {
675
+ onCancel: hideDialog,
676
+ type: "currency"
677
+ }), undefined, "Currency Format");
678
+ setOpen(false);
679
+ }
680
+ }, /*#__PURE__*/React.createElement("div", {
681
+ className: "fortune-toolbar-menu-line"
682
+ }, /*#__PURE__*/React.createElement("div", null, text), /*#__PURE__*/React.createElement("div", {
683
+ className: "fortune-toolbar-subtext"
684
+ }, example)));
685
+ }
686
+ return /*#__PURE__*/React.createElement(Option, {
687
+ key: value,
688
+ onClick: function onClick() {
689
+ setOpen(false);
690
+ setContext(function (ctx) {
691
+ var d = getFlowdata(ctx);
692
+ if (d == null) return;
693
+ updateFormat(ctx, refs.cellInput.current, d, "ct", value);
694
+ });
695
+ }
696
+ }, /*#__PURE__*/React.createElement("div", {
697
+ className: "fortune-toolbar-menu-line"
698
+ }, /*#__PURE__*/React.createElement("div", null, text), /*#__PURE__*/React.createElement("div", {
699
+ className: "fortune-toolbar-subtext"
700
+ }, example)));
701
+ }));
702
+ });
703
+ }
704
+ if (name === "font") {
705
+ var current_1 = fontarray[0];
706
+ if ((cell === null || cell === void 0 ? void 0 : cell.ff) != null) {
707
+ if (_.isNumber(cell.ff)) {
708
+ current_1 = fontarray[cell.ff];
709
+ } else {
710
+ current_1 = cell.ff;
711
+ }
712
+ }
713
+ return /*#__PURE__*/React.createElement(Combo, {
714
+ text: current_1,
715
+ key: name,
716
+ tooltip: tooltip,
717
+ showArrow: false
718
+ }, function (setOpen) {
719
+ return /*#__PURE__*/React.createElement(Select, null, fontarray.map(function (o) {
720
+ return /*#__PURE__*/React.createElement(Option, {
721
+ key: o,
722
+ onClick: function onClick() {
723
+ setContext(function (ctx) {
724
+ current_1 = o;
725
+ var d = getFlowdata(ctx);
726
+ if (!d) return;
727
+ updateFormat(ctx, refs.cellInput.current, d, "ff", o);
728
+ });
729
+ setOpen(false);
730
+ }
731
+ }, o);
732
+ }));
733
+ });
734
+ }
735
+ if (name === "font-size") {
736
+ return /*#__PURE__*/React.createElement(Combo, {
737
+ text: cell ? normalizedCellAttr(cell, "fs", context.defaultFontSize) : context.defaultFontSize.toString(),
738
+ key: name,
739
+ tooltip: tooltip,
740
+ showArrow: false
741
+ }, function (setOpen) {
742
+ return /*#__PURE__*/React.createElement(Select, {
743
+ style: {
744
+ minWidth: "fit-content",
745
+ width: "50px"
746
+ }
747
+ }, [9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72].map(function (num) {
748
+ return /*#__PURE__*/React.createElement("div", {
749
+ className: "fortune-toolbar-select-option text-body-sm text-center color-text-default",
750
+ style: {
751
+ minWidth: "fit-content",
752
+ padding: "0px",
753
+ width: "36px",
754
+ height: "36px",
755
+ display: "flex",
756
+ alignItems: "center",
757
+ justifyContent: "center",
758
+ fontSize: "14px"
759
+ },
760
+ key: num,
761
+ onClick: function onClick() {
762
+ setContext(function (draftContext) {
763
+ return handleTextSize(draftContext, refs.cellInput.current, num, refs.canvas.current.getContext("2d"));
764
+ });
765
+ setOpen(false);
766
+ }
767
+ }, num);
768
+ }));
769
+ });
770
+ }
771
+ if (name === "horizontal-align") {
772
+ var items_1 = [{
773
+ title: "align-left",
774
+ text: align.left,
775
+ value: 1
776
+ }, {
777
+ title: "align-center",
778
+ text: align.center,
779
+ value: 0
780
+ }, {
781
+ title: "align-right",
782
+ text: align.right,
783
+ value: 2
784
+ }];
785
+ return /*#__PURE__*/React.createElement(Combo, {
786
+ iconId: ((_a = _.find(items_1, function (item) {
787
+ return "".concat(item.value) === "".concat(cell === null || cell === void 0 ? void 0 : cell.ht);
788
+ })) === null || _a === void 0 ? void 0 : _a.title) || "align-left",
789
+ key: name,
790
+ tooltip: toolbar.horizontalAlign,
791
+ showArrow: false
792
+ }, function (setOpen) {
793
+ return /*#__PURE__*/React.createElement(Select, {
794
+ style: {
795
+ minWidth: "fit-content",
796
+ display: "flex",
797
+ flexDirection: "row",
798
+ alignItems: "center",
799
+ justifyContent: "center",
800
+ gap: 4
801
+ }
802
+ }, items_1.map(function (_a) {
803
+ var _b;
804
+ var title = _a.title;
805
+ return /*#__PURE__*/React.createElement(IconButton, {
806
+ key: title,
807
+ isActive: ((_b = _.find(items_1, function (item) {
808
+ return "".concat(item.value) === "".concat(cell === null || cell === void 0 ? void 0 : cell.ht);
809
+ })) === null || _b === void 0 ? void 0 : _b.title) === title,
810
+ icon: getLucideIcon(title),
811
+ variant: "ghost",
812
+ onClick: function onClick() {
813
+ setContext(function (ctx) {
814
+ handleHorizontalAlign(ctx, refs.cellInput.current, title.replace("align-", ""));
815
+ });
816
+ setOpen(false);
817
+ },
818
+ tabIndex: 0
819
+ });
820
+ }));
821
+ });
822
+ }
823
+ if (name === "vertical-align") {
824
+ var items_2 = [{
825
+ title: "align-top",
826
+ text: align.top,
827
+ value: 1
828
+ }, {
829
+ title: "align-middle",
830
+ text: align.middle,
831
+ value: 0
832
+ }, {
833
+ title: "align-bottom",
834
+ text: align.bottom,
835
+ value: 2
836
+ }];
837
+ return /*#__PURE__*/React.createElement(Combo, {
838
+ iconId: ((_b = _.find(items_2, function (item) {
839
+ return "".concat(item.value) === "".concat(cell === null || cell === void 0 ? void 0 : cell.vt);
840
+ })) === null || _b === void 0 ? void 0 : _b.title) || "align-top",
841
+ key: name,
842
+ tooltip: toolbar.verticalAlign,
843
+ showArrow: false
844
+ }, function (setOpen) {
845
+ return /*#__PURE__*/React.createElement(Select, {
846
+ style: {
847
+ minWidth: "fit-content",
848
+ display: "flex",
849
+ flexDirection: "row",
850
+ alignItems: "center",
851
+ justifyContent: "center",
852
+ gap: 4
853
+ }
854
+ }, items_2.map(function (_a) {
855
+ var _b;
856
+ var title = _a.title;
857
+ return /*#__PURE__*/React.createElement(IconButton, {
858
+ key: title,
859
+ isActive: ((_b = _.find(items_2, function (item) {
860
+ return "".concat(item.value) === "".concat(cell === null || cell === void 0 ? void 0 : cell.vt);
861
+ })) === null || _b === void 0 ? void 0 : _b.title) === title,
862
+ icon: getLucideIcon(title),
863
+ variant: "ghost",
864
+ onClick: function onClick() {
865
+ setContext(function (ctx) {
866
+ handleVerticalAlign(ctx, refs.cellInput.current, title.replace("align-", ""));
867
+ });
868
+ setOpen(false);
869
+ },
870
+ tabIndex: 0
871
+ });
872
+ }));
873
+ });
874
+ }
875
+ if (name === "undo") {
876
+ return /*#__PURE__*/React.createElement(Button, {
877
+ iconId: name,
878
+ tooltip: tooltip,
879
+ key: name,
880
+ disabled: refs.globalCache.undoList.length === 0,
881
+ onClick: function onClick() {
882
+ return handleUndo();
883
+ }
884
+ });
885
+ }
886
+ if (name === "redo") {
887
+ return /*#__PURE__*/React.createElement(Button, {
888
+ iconId: name,
889
+ tooltip: tooltip,
890
+ key: name,
891
+ disabled: refs.globalCache.redoList.length === 0,
892
+ onClick: function onClick() {
893
+ return handleRedo();
894
+ }
895
+ });
896
+ }
897
+ if (name === "screenshot") {
898
+ return /*#__PURE__*/React.createElement(Button, {
899
+ iconId: name,
900
+ tooltip: tooltip,
901
+ key: name,
902
+ onClick: function onClick() {
903
+ var imgsrc = handleScreenShot(contextRef.current);
904
+ if (imgsrc) {
905
+ showDialog(/*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, screenshot.screenshotTipSuccess), /*#__PURE__*/React.createElement("img", {
906
+ src: imgsrc,
907
+ alt: "",
908
+ style: {
909
+ maxWidth: "100%",
910
+ maxHeight: "100%"
911
+ }
912
+ })));
913
+ }
914
+ }
915
+ });
916
+ }
917
+ if (name === "splitColumn") {
918
+ return /*#__PURE__*/React.createElement(Button, {
919
+ iconId: name,
920
+ tooltip: tooltip,
921
+ key: name,
922
+ onClick: function onClick() {
923
+ if (context.allowEdit === false) return;
924
+ if (_.isUndefined(context.luckysheet_select_save)) {
925
+ showDialog(splitText.tipNoSelect, "ok");
926
+ } else {
927
+ var currentColumn = context.luckysheet_select_save[context.luckysheet_select_save.length - 1].column;
928
+ if (context.luckysheet_select_save.length > 1) {
929
+ showDialog(splitText.tipNoMulti, "ok");
930
+ } else if (currentColumn[0] !== currentColumn[1]) {
931
+ showDialog(splitText.tipNoMultiColumn, "ok");
932
+ } else {
933
+ showDialog(/*#__PURE__*/React.createElement(SplitColumn, null));
934
+ }
935
+ }
936
+ }
937
+ });
938
+ }
939
+ if (name === "dataVerification") {
940
+ return /*#__PURE__*/React.createElement(Button, {
941
+ iconId: name,
942
+ tooltip: tooltip,
943
+ key: name,
944
+ onClick: function onClick() {
945
+ if (context.allowEdit === false) return;
946
+ showDialog(/*#__PURE__*/React.createElement(DataVerification, null), undefined, toolbar.dataVerification);
947
+ }
948
+ });
949
+ }
950
+ if (name === "locationCondition") {
951
+ var items_3 = [{
952
+ text: findAndReplace.location,
953
+ value: "location"
954
+ }, {
955
+ text: findAndReplace.locationFormula,
956
+ value: "locationFormula"
957
+ }, {
958
+ text: findAndReplace.locationDate,
959
+ value: "locationDate"
960
+ }, {
961
+ text: findAndReplace.locationDigital,
962
+ value: "locationDigital"
963
+ }, {
964
+ text: findAndReplace.locationString,
965
+ value: "locationString"
966
+ }, {
967
+ text: findAndReplace.locationError,
968
+ value: "locationError"
969
+ }, {
970
+ text: findAndReplace.locationRowSpan,
971
+ value: "locationRowSpan"
972
+ }, {
973
+ text: findAndReplace.columnSpan,
974
+ value: "locationColumnSpan"
975
+ }];
976
+ return /*#__PURE__*/React.createElement(Combo, {
977
+ iconId: "locationCondition",
978
+ key: name,
979
+ tooltip: findAndReplace.location,
980
+ showArrow: false
981
+ }, function (setOpen) {
982
+ return /*#__PURE__*/React.createElement(Select, null, items_3.map(function (_a) {
983
+ var text = _a.text,
984
+ value = _a.value;
985
+ return /*#__PURE__*/React.createElement(Option, {
986
+ key: value,
987
+ onClick: function onClick() {
988
+ var _a, _b, _c, _d, _e, _f;
989
+ if (context.luckysheet_select_save == null) {
990
+ showDialog(freezen.noSelectionError, "ok");
991
+ return;
992
+ }
993
+ var last = context.luckysheet_select_save[0];
994
+ var range;
995
+ var rangeArr = [];
996
+ if (((_a = context.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a.length) === 0 || ((_b = context.luckysheet_select_save) === null || _b === void 0 ? void 0 : _b.length) === 1 && last.row[0] === last.row[1] && last.column[0] === last.column[1]) {
997
+ range = [{
998
+ row: [0, flowdata.length - 1],
999
+ column: [0, flowdata[0].length - 1]
1000
+ }];
1001
+ } else {
1002
+ range = _.assignIn([], context.luckysheet_select_save);
1003
+ }
1004
+ if (value === "location") {
1005
+ showDialog(/*#__PURE__*/React.createElement(LocationCondition, null));
1006
+ } else if (value === "locationFormula") {
1007
+ setContext(function (ctx) {
1008
+ rangeArr = applyLocation(range, "locationFormula", "all", ctx);
1009
+ });
1010
+ } else if (value === "locationDate") {
1011
+ setContext(function (ctx) {
1012
+ rangeArr = applyLocation(range, "locationConstant", "d", ctx);
1013
+ });
1014
+ } else if (value === "locationDigital") {
1015
+ setContext(function (ctx) {
1016
+ rangeArr = applyLocation(range, "locationConstant", "n", ctx);
1017
+ });
1018
+ } else if (value === "locationString") {
1019
+ setContext(function (ctx) {
1020
+ rangeArr = applyLocation(range, "locationConstant", "s,g", ctx);
1021
+ });
1022
+ } else if (value === "locationError") {
1023
+ setContext(function (ctx) {
1024
+ rangeArr = applyLocation(range, "locationConstant", "e", ctx);
1025
+ });
1026
+ } else if (value === "locationCondition") {
1027
+ setContext(function (ctx) {
1028
+ rangeArr = applyLocation(range, "locationCF", undefined, ctx);
1029
+ });
1030
+ } else if (value === "locationRowSpan") {
1031
+ if (((_c = context.luckysheet_select_save) === null || _c === void 0 ? void 0 : _c.length) === 0 || ((_d = context.luckysheet_select_save) === null || _d === void 0 ? void 0 : _d.length) === 1 && context.luckysheet_select_save[0].row[0] === context.luckysheet_select_save[0].row[1]) {
1032
+ showDialog(findAndReplace.locationTiplessTwoRow, "ok");
1033
+ return;
1034
+ }
1035
+ range = _.assignIn([], context.luckysheet_select_save);
1036
+ setContext(function (ctx) {
1037
+ rangeArr = applyLocation(range, "locationRowSpan", undefined, ctx);
1038
+ });
1039
+ } else if (value === "locationColumnSpan") {
1040
+ if (((_e = context.luckysheet_select_save) === null || _e === void 0 ? void 0 : _e.length) === 0 || ((_f = context.luckysheet_select_save) === null || _f === void 0 ? void 0 : _f.length) === 1 && context.luckysheet_select_save[0].column[0] === context.luckysheet_select_save[0].column[1]) {
1041
+ showDialog(findAndReplace.locationTiplessTwoColumn, "ok");
1042
+ return;
1043
+ }
1044
+ range = _.assignIn([], context.luckysheet_select_save);
1045
+ setContext(function (ctx) {
1046
+ rangeArr = applyLocation(range, "locationColumnSpan", undefined, ctx);
1047
+ });
1048
+ }
1049
+ if (rangeArr.length === 0 && value !== "location") showDialog(findAndReplace.locationTipNotFindCell, "ok");
1050
+ setOpen(false);
1051
+ }
1052
+ }, /*#__PURE__*/React.createElement("div", {
1053
+ className: "fortune-toolbar-menu-line"
1054
+ }, text));
1055
+ }));
1056
+ });
1057
+ }
1058
+ if (name === "conditionFormat") {
1059
+ var items_4 = ["highlightCellRules", "itemSelectionRules", "-", "deleteRule"];
1060
+ return /*#__PURE__*/React.createElement(Combo, {
1061
+ iconId: "conditionFormat",
1062
+ key: name,
1063
+ tooltip: toolbar.conditionalFormat,
1064
+ showArrow: false
1065
+ }, function (setOpen) {
1066
+ return /*#__PURE__*/React.createElement(ConditionalFormat, {
1067
+ items: items_4,
1068
+ setOpen: setOpen
1069
+ });
1070
+ });
1071
+ }
1072
+ if (name === "image") {
1073
+ return /*#__PURE__*/React.createElement(Button, {
1074
+ iconId: name,
1075
+ tooltip: toolbar.insertImage,
1076
+ key: name,
1077
+ onClick: function onClick() {
1078
+ if (context.allowEdit === false) return;
1079
+ showImgChooser();
1080
+ }
1081
+ }, /*#__PURE__*/React.createElement("input", {
1082
+ id: "fortune-img-upload",
1083
+ type: "file",
1084
+ accept: "image/*",
1085
+ style: {
1086
+ display: "none"
1087
+ },
1088
+ onChange: function onChange(e) {
1089
+ var _a;
1090
+ var file = (_a = e.currentTarget.files) === null || _a === void 0 ? void 0 : _a[0];
1091
+ if (!file) return;
1092
+ var render = new FileReader();
1093
+ render.readAsDataURL(file);
1094
+ render.onload = function (event) {
1095
+ var _a;
1096
+ if (event.target == null) return;
1097
+ var src = (_a = event.target) === null || _a === void 0 ? void 0 : _a.result;
1098
+ var image = new Image();
1099
+ image.onload = function () {
1100
+ setContext(function (draftCtx) {
1101
+ insertImage(draftCtx, image);
1102
+ });
1103
+ };
1104
+ image.src = src;
1105
+ };
1106
+ e.currentTarget.value = "";
1107
+ }
1108
+ }));
1109
+ }
1110
+ if (name === "comment") {
1111
+ var last = (_c = context.luckysheet_select_save) === null || _c === void 0 ? void 0 : _c[context.luckysheet_select_save.length - 1];
1112
+ var row_index_1 = last === null || last === void 0 ? void 0 : last.row_focus;
1113
+ var col_index_1 = last === null || last === void 0 ? void 0 : last.column_focus;
1114
+ if (!last) {
1115
+ row_index_1 = 0;
1116
+ col_index_1 = 0;
1117
+ } else {
1118
+ if (row_index_1 == null) {
1119
+ row_index_1 = last.row[0];
1120
+ }
1121
+ if (col_index_1 == null) {
1122
+ col_index_1 = last.column[0];
1123
+ }
1124
+ }
1125
+ var itemData_1;
1126
+ if (((_e = (_d = flowdata === null || flowdata === void 0 ? void 0 : flowdata[row_index_1]) === null || _d === void 0 ? void 0 : _d[col_index_1]) === null || _e === void 0 ? void 0 : _e.ps) != null) {
1127
+ itemData_1 = [{
1128
+ key: "edit",
1129
+ text: comment.edit,
1130
+ onClick: editComment
1131
+ }, {
1132
+ key: "delete",
1133
+ text: comment.delete,
1134
+ onClick: deleteComment
1135
+ }, {
1136
+ key: "showOrHide",
1137
+ text: comment.showOne,
1138
+ onClick: showHideComment
1139
+ }, {
1140
+ key: "showOrHideAll",
1141
+ text: comment.showAll,
1142
+ onClick: showHideAllComments
1143
+ }];
1144
+ } else {
1145
+ itemData_1 = [{
1146
+ key: "new",
1147
+ text: comment.insert,
1148
+ onClick: newComment
1149
+ }, {
1150
+ key: "showOrHideAll",
1151
+ text: comment.showAll,
1152
+ onClick: showHideAllComments
1153
+ }];
1154
+ }
1155
+ return /*#__PURE__*/React.createElement(Combo, {
1156
+ iconId: name,
1157
+ key: name,
1158
+ tooltip: tooltip,
1159
+ showArrow: false
1160
+ }, function (setOpen) {
1161
+ return /*#__PURE__*/React.createElement(Select, null, itemData_1.map(function (_a) {
1162
+ var key = _a.key,
1163
+ text = _a.text,
1164
+ _onClick = _a.onClick;
1165
+ return /*#__PURE__*/React.createElement(Option, {
1166
+ key: key,
1167
+ onClick: function onClick() {
1168
+ setContext(function (draftContext) {
1169
+ return _onClick(draftContext, refs.globalCache, row_index_1, col_index_1);
1170
+ });
1171
+ setOpen(false);
1172
+ }
1173
+ }, text);
1174
+ }));
1175
+ });
1176
+ }
1177
+ if (name === "quick-formula") {
1178
+ var itemData_2 = [{
1179
+ text: formula.sum,
1180
+ value: "SUM"
1181
+ }, {
1182
+ text: formula.average,
1183
+ value: "AVERAGE"
1184
+ }, {
1185
+ text: formula.count,
1186
+ value: "COUNT"
1187
+ }, {
1188
+ text: formula.max,
1189
+ value: "MAX"
1190
+ }, {
1191
+ text: formula.min,
1192
+ value: "MIN"
1193
+ }];
1194
+ return /*#__PURE__*/React.createElement(Combo, {
1195
+ iconId: "formula-sum",
1196
+ key: name,
1197
+ tooltip: toolbar.autoSum,
1198
+ showArrow: false,
1199
+ onClick: function onClick() {
1200
+ return setContext(function (ctx) {
1201
+ handleSum(ctx, refs.cellInput.current, refs.fxInput.current, refs.globalCache);
1202
+ });
1203
+ }
1204
+ }, function (setOpen) {
1205
+ return /*#__PURE__*/React.createElement(Select, null, itemData_2.map(function (_a) {
1206
+ var value = _a.value,
1207
+ text = _a.text;
1208
+ return /*#__PURE__*/React.createElement(Option, {
1209
+ key: value,
1210
+ onClick: function onClick() {
1211
+ setContext(function (ctx) {
1212
+ autoSelectionFormula(ctx, refs.cellInput.current, refs.fxInput.current, value, refs.globalCache);
1213
+ });
1214
+ setOpen(false);
1215
+ }
1216
+ }, /*#__PURE__*/React.createElement("div", {
1217
+ className: "fortune-toolbar-menu-line"
1218
+ }, /*#__PURE__*/React.createElement("div", null, text), /*#__PURE__*/React.createElement("div", {
1219
+ className: "fortune-toolbar-subtext"
1220
+ }, value)));
1221
+ }), /*#__PURE__*/React.createElement(MenuDivider, null), /*#__PURE__*/React.createElement(Option, {
1222
+ key: "formula",
1223
+ onClick: function onClick() {
1224
+ var button = document.getElementById("function-button");
1225
+ if (button) {
1226
+ button.click();
1227
+ }
1228
+ setOpen(false);
1229
+ }
1230
+ }, "".concat(formula.find, "...")));
1231
+ });
1232
+ }
1233
+ if (name === "merge-cell") {
1234
+ var itemdata_1 = [{
1235
+ text: merge.mergeAll,
1236
+ value: "merge-all",
1237
+ icon: "MergeAll"
1238
+ }, {
1239
+ text: merge.mergeV,
1240
+ value: "merge-vertical",
1241
+ icon: "MergeVertical"
1242
+ }, {
1243
+ text: merge.mergeH,
1244
+ value: "merge-horizontal",
1245
+ icon: "MergeHorizontal"
1246
+ }, {
1247
+ text: merge.mergeCancel,
1248
+ value: "merge-cancel",
1249
+ icon: "Unmerge"
1250
+ }];
1251
+ return /*#__PURE__*/React.createElement(Combo, {
1252
+ iconId: "merge-all",
1253
+ key: name,
1254
+ tooltip: tooltip,
1255
+ text: "\u5408\u5E76\u5355\u5143\u683C",
1256
+ onClick: function onClick() {
1257
+ return setContext(function (ctx) {
1258
+ handleMerge(ctx, "merge-all");
1259
+ });
1260
+ }
1261
+ }, function (setOpen) {
1262
+ return /*#__PURE__*/React.createElement(Select, null, itemdata_1.map(function (_a) {
1263
+ var text = _a.text,
1264
+ value = _a.value,
1265
+ icon = _a.icon;
1266
+ return /*#__PURE__*/React.createElement(Option, {
1267
+ key: value,
1268
+ onClick: function onClick() {
1269
+ setContext(function (ctx) {
1270
+ handleMerge(ctx, value);
1271
+ });
1272
+ setOpen(false);
1273
+ }
1274
+ }, /*#__PURE__*/React.createElement("div", {
1275
+ style: {
1276
+ display: "flex",
1277
+ alignItems: "center",
1278
+ gap: 6
1279
+ }
1280
+ }, /*#__PURE__*/React.createElement(LucideIcon, {
1281
+ name: icon,
1282
+ width: 16,
1283
+ height: 16
1284
+ }), text));
1285
+ }));
1286
+ });
1287
+ }
1288
+ if (name === "border") {
1289
+ var items_5 = [{
1290
+ text: border.borderTop,
1291
+ value: "border-top",
1292
+ icon: "BorderTop"
1293
+ }, {
1294
+ text: border.borderBottom,
1295
+ value: "border-bottom",
1296
+ icon: "BorderBottom"
1297
+ }, {
1298
+ text: border.borderLeft,
1299
+ value: "border-left",
1300
+ icon: "BorderLeft"
1301
+ }, {
1302
+ text: border.borderRight,
1303
+ value: "border-right",
1304
+ icon: "BorderRight"
1305
+ }, {
1306
+ text: border.borderNone,
1307
+ value: "border-none",
1308
+ icon: "NoBorder"
1309
+ }, {
1310
+ text: border.borderAll,
1311
+ value: "border-all",
1312
+ icon: "Border"
1313
+ }, {
1314
+ text: border.borderOutside,
1315
+ value: "border-outside",
1316
+ icon: "BorderOutside"
1317
+ }, {
1318
+ text: border.borderInside,
1319
+ value: "border-inside",
1320
+ icon: "BorderInside"
1321
+ }, {
1322
+ text: border.borderHorizontal,
1323
+ value: "border-horizontal",
1324
+ icon: "BorderHorizontal"
1325
+ }, {
1326
+ text: border.borderVertical,
1327
+ value: "border-vertical",
1328
+ icon: "BorderVertical"
1329
+ }];
1330
+ return /*#__PURE__*/React.createElement(Combo, {
1331
+ iconId: "border-all",
1332
+ key: name,
1333
+ tooltip: tooltip,
1334
+ text: "\u8FB9\u6846\u8BBE\u7F6E",
1335
+ showArrow: false,
1336
+ onClick: function onClick() {
1337
+ return setContext(function (ctx) {
1338
+ handleBorder(ctx, "border-all", customColor, customStyle);
1339
+ });
1340
+ }
1341
+ }, function (setOpen) {
1342
+ return /*#__PURE__*/React.createElement("div", {
1343
+ className: "fortune-toolbar-select fortune-border-grid"
1344
+ }, items_5.map(function (_a) {
1345
+ var value = _a.value,
1346
+ icon = _a.icon;
1347
+ return /*#__PURE__*/React.createElement("div", {
1348
+ key: value,
1349
+ className: "fortune-border-grid-item",
1350
+ onClick: function onClick() {
1351
+ setContext(function (ctx) {
1352
+ handleBorder(ctx, value, customColor, customStyle);
1353
+ });
1354
+ setOpen(false);
1355
+ }
1356
+ }, /*#__PURE__*/React.createElement(LucideIcon, {
1357
+ name: icon,
1358
+ width: 16,
1359
+ height: 16
1360
+ }));
1361
+ }));
1362
+ });
1363
+ }
1364
+ if (name === "freeze") {
1365
+ var items_6 = [{
1366
+ text: freezen.freezenRowRange,
1367
+ value: "freeze-row"
1368
+ }, {
1369
+ text: freezen.freezenColumnRange,
1370
+ value: "freeze-col"
1371
+ }, {
1372
+ text: freezen.freezenRCRange,
1373
+ value: "freeze-row-col"
1374
+ }, {
1375
+ text: freezen.freezenCancel,
1376
+ value: "freeze-cancel"
1377
+ }];
1378
+ return /*#__PURE__*/React.createElement(Combo, {
1379
+ iconId: "freeze-row-col",
1380
+ key: name,
1381
+ tooltip: tooltip,
1382
+ showArrow: false,
1383
+ onClick: function onClick() {
1384
+ return setContext(function (ctx) {
1385
+ handleFreeze(ctx, "freeze-row-col");
1386
+ });
1387
+ }
1388
+ }, function (setOpen) {
1389
+ return /*#__PURE__*/React.createElement(Select, null, items_6.map(function (_a) {
1390
+ var text = _a.text,
1391
+ value = _a.value;
1392
+ return /*#__PURE__*/React.createElement(Option, {
1393
+ key: value,
1394
+ onClick: function onClick() {
1395
+ setContext(function (ctx) {
1396
+ handleFreeze(ctx, value);
1397
+ });
1398
+ setOpen(false);
1399
+ }
1400
+ }, /*#__PURE__*/React.createElement("div", {
1401
+ className: "fortune-toolbar-menu-line"
1402
+ }, text, /*#__PURE__*/React.createElement(SVGIcon, {
1403
+ name: value,
1404
+ width: 16,
1405
+ height: 16
1406
+ })));
1407
+ }));
1408
+ });
1409
+ }
1410
+ if (name === "text-wrap") {
1411
+ var items_7 = [{
1412
+ text: textWrap.clip,
1413
+ iconId: "text-clip",
1414
+ value: "clip"
1415
+ }, {
1416
+ text: textWrap.overflow,
1417
+ iconId: "text-overflow",
1418
+ value: "overflow"
1419
+ }, {
1420
+ text: textWrap.wrap,
1421
+ iconId: "text-wrap",
1422
+ value: "wrap"
1423
+ }];
1424
+ var curr_3 = items_7[0];
1425
+ if ((cell === null || cell === void 0 ? void 0 : cell.tb) != null) {
1426
+ curr_3 = _.get(items_7, cell.tb);
1427
+ }
1428
+ return /*#__PURE__*/React.createElement(Combo, {
1429
+ iconId: curr_3.iconId,
1430
+ key: name,
1431
+ tooltip: toolbar.textWrap,
1432
+ showArrow: false
1433
+ }, function (setOpen) {
1434
+ return /*#__PURE__*/React.createElement(Select, {
1435
+ style: {
1436
+ minWidth: "fit-content",
1437
+ display: "flex",
1438
+ flexDirection: "row",
1439
+ alignItems: "center",
1440
+ justifyContent: "center",
1441
+ gap: 4
1442
+ }
1443
+ }, items_7.map(function (_a) {
1444
+ var iconId = _a.iconId,
1445
+ value = _a.value;
1446
+ return /*#__PURE__*/React.createElement(IconButton, {
1447
+ key: value,
1448
+ isActive: curr_3.value === value,
1449
+ icon: getLucideIcon(iconId),
1450
+ variant: "ghost",
1451
+ onClick: function onClick() {
1452
+ setContext(function (ctx) {
1453
+ var d = getFlowdata(ctx);
1454
+ if (d == null) return;
1455
+ updateFormat(ctx, refs.cellInput.current, d, "tb", value);
1456
+ });
1457
+ setOpen(false);
1458
+ },
1459
+ tabIndex: 0
1460
+ });
1461
+ }));
1462
+ });
1463
+ }
1464
+ if (name === "text-rotation") {
1465
+ var items_8 = [{
1466
+ text: rotation.none,
1467
+ iconId: "text-rotation-none",
1468
+ value: "none"
1469
+ }, {
1470
+ text: rotation.angleup,
1471
+ iconId: "text-rotation-angleup",
1472
+ value: "angleup"
1473
+ }, {
1474
+ text: rotation.angledown,
1475
+ iconId: "text-rotation-angledown",
1476
+ value: "angledown"
1477
+ }, {
1478
+ text: rotation.vertical,
1479
+ iconId: "text-rotation-vertical",
1480
+ value: "vertical"
1481
+ }, {
1482
+ text: rotation.rotationUp,
1483
+ iconId: "text-rotation-up",
1484
+ value: "rotation-up"
1485
+ }, {
1486
+ text: rotation.rotationDown,
1487
+ iconId: "text-rotation-down",
1488
+ value: "rotation-down"
1489
+ }];
1490
+ var curr = items_8[0];
1491
+ if ((cell === null || cell === void 0 ? void 0 : cell.tr) != null) {
1492
+ curr = _.get(items_8, cell.tr);
1493
+ }
1494
+ return /*#__PURE__*/React.createElement(Combo, {
1495
+ iconId: curr.iconId,
1496
+ key: name,
1497
+ tooltip: toolbar.textRotate,
1498
+ showArrow: false
1499
+ }, function (setOpen) {
1500
+ return /*#__PURE__*/React.createElement(Select, null, items_8.map(function (_a) {
1501
+ var text = _a.text,
1502
+ iconId = _a.iconId,
1503
+ value = _a.value;
1504
+ return /*#__PURE__*/React.createElement(Option, {
1505
+ key: value,
1506
+ onClick: function onClick() {
1507
+ setContext(function (ctx) {
1508
+ var d = getFlowdata(ctx);
1509
+ if (d == null) return;
1510
+ updateFormat(ctx, refs.cellInput.current, d, "tr", value);
1511
+ });
1512
+ setOpen(false);
1513
+ }
1514
+ }, /*#__PURE__*/React.createElement("div", {
1515
+ className: "fortune-toolbar-menu-line"
1516
+ }, text, /*#__PURE__*/React.createElement(SVGIcon, {
1517
+ name: iconId,
1518
+ width: 16,
1519
+ height: 16
1520
+ })));
1521
+ }));
1522
+ });
1523
+ }
1524
+ if (name === "filter") {
1525
+ var items_9 = [{
1526
+ iconId: "sort-asc",
1527
+ value: "sort-asc",
1528
+ text: sort.asc,
1529
+ onClick: function onClick() {
1530
+ setContext(function (ctx) {
1531
+ handleSort(ctx, true);
1532
+ });
1533
+ }
1534
+ }, {
1535
+ iconId: "sort-desc",
1536
+ value: "sort-desc",
1537
+ text: sort.desc,
1538
+ onClick: function onClick() {
1539
+ setContext(function (ctx) {
1540
+ handleSort(ctx, false);
1541
+ });
1542
+ }
1543
+ }, {
1544
+ iconId: "",
1545
+ value: "divider"
1546
+ }, {
1547
+ iconId: "filter1",
1548
+ value: "filter",
1549
+ text: filter.filter,
1550
+ onClick: function onClick() {
1551
+ return setContext(function (draftCtx) {
1552
+ createFilter(draftCtx);
1553
+ });
1554
+ }
1555
+ }, {
1556
+ iconId: "eraser",
1557
+ value: "eraser",
1558
+ text: filter.clearFilter,
1559
+ onClick: function onClick() {
1560
+ return setContext(function (draftCtx) {
1561
+ clearFilter(draftCtx);
1562
+ });
1563
+ }
1564
+ }];
1565
+ return /*#__PURE__*/React.createElement(Combo, {
1566
+ iconId: "filter",
1567
+ key: name,
1568
+ tooltip: toolbar.sortAndFilter,
1569
+ showArrow: false
1570
+ }, function (setOpen) {
1571
+ return /*#__PURE__*/React.createElement(Select, {
1572
+ style: {
1573
+ minWidth: "11.25rem"
1574
+ }
1575
+ }, items_9.map(function (_a, index) {
1576
+ var text = _a.text,
1577
+ iconId = _a.iconId,
1578
+ value = _a.value,
1579
+ _onClick2 = _a.onClick;
1580
+ return value !== "divider" ? (/*#__PURE__*/React.createElement(Option, {
1581
+ key: value,
1582
+ onClick: function onClick() {
1583
+ _onClick2 === null || _onClick2 === void 0 ? void 0 : _onClick2();
1584
+ setOpen(false);
1585
+ }
1586
+ }, /*#__PURE__*/React.createElement("div", {
1587
+ className: "fortune-toolbar-menu-line gap-1",
1588
+ style: {
1589
+ justifyContent: "start"
1590
+ }
1591
+ }, /*#__PURE__*/React.createElement(SVGIcon, {
1592
+ name: iconId,
1593
+ width: 16,
1594
+ height: 16
1595
+ }), text))) : (/*#__PURE__*/React.createElement(MenuDivider, {
1596
+ key: "divider-".concat(index)
1597
+ }));
1598
+ }));
1599
+ });
1600
+ }
1601
+ if (name === "currency") {
1602
+ return /*#__PURE__*/React.createElement(CurrencySelector, {
1603
+ cell: cell,
1604
+ defaultTextFormat: defaultFormat[0].text,
1605
+ toolTipText: toolbar["currency-format"]
1606
+ });
1607
+ }
1608
+ return /*#__PURE__*/React.createElement(Tooltip, {
1609
+ text: tooltip,
1610
+ placement: "bottom"
1611
+ }, /*#__PURE__*/React.createElement(Button, {
1612
+ iconId: name,
1613
+ tooltip: tooltip,
1614
+ key: name,
1615
+ selected: (_f = toolbarItemSelectedFunc(name)) === null || _f === void 0 ? void 0 : _f(cell),
1616
+ onClick: function onClick() {
1617
+ return setContext(function (draftCtx) {
1618
+ var _a;
1619
+ (_a = toolbarItemClickHandler(name)) === null || _a === void 0 ? void 0 : _a(draftCtx, refs.cellInput.current, refs.globalCache);
1620
+ });
1621
+ }
1622
+ }));
1623
+ }, [toolbar, cell, setContext, refs.cellInput, refs.fxInput, refs.globalCache, defaultFormat, align, handleUndo, handleRedo, flowdata, formula, showDuneModal, merge, border, freezen, screenshot, sort, textWrap, rotation, filter, splitText, findAndReplace, context.luckysheet_select_save, context.defaultFontSize, context.allowEdit, comment, fontarray, hideSubMenu, showSubMenu, refs.canvas, customColor, customStyle, toolbarFormat.moreCurrency]);
1624
+ return /*#__PURE__*/React.createElement("div", {
1625
+ ref: containerRef,
1626
+ className: "fortune-toolbar",
1627
+ "aria-label": toolbar.toolbar
1628
+ }, /*#__PURE__*/React.createElement("div", {
1629
+ className: "fortune-toolbar-left"
1630
+ }, settings.customToolbarItems.filter(function (n) {
1631
+ return n.key === "import-export";
1632
+ }).map(function (n) {
1633
+ return /*#__PURE__*/React.createElement(CustomButton, {
1634
+ tooltip: n.tooltip,
1635
+ onClick: n.onClick,
1636
+ key: n.key,
1637
+ icon: n.icon,
1638
+ iconName: n.iconName
1639
+ }, n.children);
1640
+ }), ((_d = settings.customToolbarItems) === null || _d === void 0 ? void 0 : _d.length) > 0 ? (/*#__PURE__*/React.createElement(Divider, {
1641
+ key: "customDivider"
1642
+ })) : null, (toolbarWrapIndex === -1 || isDesktop ? settings.toolbarItems : settings.toolbarItems.slice(0, toolbarWrapIndex + 1)).map(function (name, i) {
1643
+ return getToolbarItem(name, i);
1644
+ }), !isDesktop && toolbarWrapIndex !== -1 && toolbarWrapIndex < settings.toolbarItems.length - 1 ? (/*#__PURE__*/React.createElement(Button, {
1645
+ iconId: "Ellipsis",
1646
+ tooltip: toolbar.toolMore,
1647
+ onClick: function onClick() {
1648
+ if (moreItemsOpen) {
1649
+ setMoreItems(null);
1650
+ } else {
1651
+ setMoreItems(settings.toolbarItems.slice(toolbarWrapIndex + 1).map(function (name, i) {
1652
+ return getToolbarItem(name, i);
1653
+ }));
1654
+ }
1655
+ }
1656
+ })) : null, moreToolbarItems && (/*#__PURE__*/React.createElement(MoreItemsContaier, {
1657
+ onClose: onMoreToolbarItemsClose
1658
+ }, moreToolbarItems))), /*#__PURE__*/React.createElement("div", {
1659
+ className: "fortune-toolbar-right"
1660
+ }, settings.customToolbarItems.length > 0 && (/*#__PURE__*/React.createElement(React.Fragment, null, settings.customToolbarItems.filter(function (t) {
1661
+ return t.key === "Smart Contract";
1662
+ }).map(function (n) {
1663
+ return /*#__PURE__*/React.createElement(CustomButton, {
1664
+ tooltip: n.tooltip,
1665
+ onClick: n.onClick,
1666
+ key: n.key,
1667
+ icon: n.icon,
1668
+ iconName: n.iconName
1669
+ }, n.children);
1670
+ }), /*#__PURE__*/React.createElement(Button, {
1671
+ iconId: "dune",
1672
+ tooltip: "Insert Dune Chart",
1673
+ key: "dune-charts",
1674
+ onClick: function onClick() {
1675
+ if (context.allowEdit === false) return;
1676
+ setShowDuneModal(true);
1677
+ },
1678
+ style: {
1679
+ backgroundColor: "#F4603E2E",
1680
+ borderRadius: "8px"
1681
+ }
1682
+ }), /*#__PURE__*/React.createElement("span", {
1683
+ style: {
1684
+ display: "inline-block",
1685
+ position: "relative"
1686
+ }
1687
+ }, /*#__PURE__*/React.createElement(CryptoDenominationSelector, null, /*#__PURE__*/React.createElement(Button, {
1688
+ iconId: "crypto",
1689
+ tooltip: "Crypto denominations",
1690
+ key: "crypto-denominations",
1691
+ style: {
1692
+ backgroundColor: "#e8ebec",
1693
+ borderRadius: "8px"
1694
+ }
1695
+ }))))), settings.customToolbarItems.filter(function (n) {
1696
+ return n.key !== "import-export" && n.key !== "Smart Contract";
1697
+ }).map(function (n) {
1698
+ return /*#__PURE__*/React.createElement(CustomButton, {
1699
+ tooltip: n.tooltip,
1700
+ onClick: n.onClick,
1701
+ key: n.key,
1702
+ icon: n.icon,
1703
+ iconName: n.iconName
1704
+ }, n.children);
1705
+ }), showDuneModal && (/*#__PURE__*/React.createElement(DuneChartsInputModal, {
1706
+ isOpen: showDuneModal,
1707
+ onSubmit: function onSubmit(url) {
1708
+ var _a;
1709
+ setContext(function (draftCtx) {
1710
+ insertDuneChart(draftCtx, url);
1711
+ });
1712
+ setShowDuneModal(false);
1713
+ (_a = settings.onDuneChartEmbed) === null || _a === void 0 ? void 0 : _a.call(settings);
1714
+ },
1715
+ onClose: function onClose() {
1716
+ return setShowDuneModal(false);
1717
+ },
1718
+ placeholder: "Paste here any Dune chart link for some magic",
1719
+ submitText: "Add Dune chart"
1720
+ }))));
1721
+ };
1722
+ export default Toolbar;