@fileverse-dev/fortune-react 1.0.4 → 1.0.6

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 (420) hide show
  1. package/es/components/ChangeColor/index.css +76 -0
  2. package/{dist/packages/react/src → es}/components/ChangeColor/index.d.ts +7 -7
  3. package/es/components/ChangeColor/index.js +41 -0
  4. package/{dist/packages/react/src → es}/components/ConditionFormat/ConditionRules.d.ts +6 -6
  5. package/es/components/ConditionFormat/ConditionRules.js +323 -0
  6. package/es/components/ConditionFormat/index.css +210 -0
  7. package/{dist/packages/react/src → es}/components/ConditionFormat/index.d.ts +7 -7
  8. package/es/components/ConditionFormat/index.js +252 -0
  9. package/{dist/packages/react/src → es}/components/ContextMenu/Divider.d.ts +3 -3
  10. package/es/components/ContextMenu/Divider.js +7 -0
  11. package/{dist/packages/react/src → es}/components/ContextMenu/FilterMenu.d.ts +3 -3
  12. package/es/components/ContextMenu/FilterMenu.js +612 -0
  13. package/{dist/packages/react/src → es}/components/ContextMenu/Menu.d.ts +8 -8
  14. package/es/components/ContextMenu/Menu.js +25 -0
  15. package/{dist/packages/react/src → es}/components/ContextMenu/SheetTab.d.ts +4 -4
  16. package/es/components/ContextMenu/SheetTab.js +223 -0
  17. package/es/components/ContextMenu/index.css +322 -0
  18. package/{dist/packages/react/src → es}/components/ContextMenu/index.d.ts +5 -5
  19. package/es/components/ContextMenu/index.js +1054 -0
  20. package/es/components/CustomSort/index.css +23 -0
  21. package/{dist/packages/react/src → es}/components/CustomSort/index.d.ts +4 -4
  22. package/es/components/CustomSort/index.js +113 -0
  23. package/{dist/packages/react/src → es}/components/DataVerification/DropdownList.d.ts +4 -4
  24. package/es/components/DataVerification/DropdownList.js +126 -0
  25. package/{dist/packages/react/src → es}/components/DataVerification/RangeDialog.d.ts +4 -4
  26. package/es/components/DataVerification/RangeDialog.js +105 -0
  27. package/{dist/packages/react/src → es}/components/DataVerification/getDisplayedRangeTxt.d.ts +2 -2
  28. package/es/components/DataVerification/getDisplayedRangeTxt.js +9 -0
  29. package/es/components/DataVerification/index.css +202 -0
  30. package/{dist/packages/react/src → es}/components/DataVerification/index.d.ts +4 -4
  31. package/es/components/DataVerification/index.js +398 -0
  32. package/es/components/Dialog/index.css +64 -0
  33. package/{dist/packages/react/src → es}/components/Dialog/index.d.ts +15 -15
  34. package/es/components/Dialog/index.js +60 -0
  35. package/{dist/packages/react/src → es}/components/DuneChartsInputModal/DuneChartsInputModal.d.ts +11 -11
  36. package/es/components/DuneChartsInputModal/DuneChartsInputModal.js +95 -0
  37. package/es/components/DuneChartsInputModal/duneChartsInputModal.css +98 -0
  38. package/{dist/packages/react/src → es}/components/DunePreview/DunePreview.d.ts +13 -13
  39. package/es/components/DunePreview/DunePreview.js +46 -0
  40. package/es/components/DunePreview/index.css +57 -0
  41. package/{dist/packages/react/src → es}/components/FilterOption/index.d.ts +5 -5
  42. package/es/components/FilterOption/index.js +121 -0
  43. package/es/components/FormatSearch/index.css +19 -0
  44. package/{dist/packages/react/src → es}/components/FormatSearch/index.d.ts +6 -6
  45. package/es/components/FormatSearch/index.js +129 -0
  46. package/es/components/FormulaSearch/index.css +65 -0
  47. package/{dist/packages/react/src → es}/components/FormulaSearch/index.d.ts +5 -5
  48. package/es/components/FormulaSearch/index.js +198 -0
  49. package/{dist/packages/react/src → es}/components/FxEditor/NameBox.d.ts +3 -3
  50. package/es/components/FxEditor/NameBox.js +29 -0
  51. package/es/components/FxEditor/index.css +72 -0
  52. package/{dist/packages/react/src → es}/components/FxEditor/index.d.ts +4 -4
  53. package/es/components/FxEditor/index.js +167 -0
  54. package/es/components/IFrameBoxs/iFrameBoxs.css +16 -0
  55. package/{dist/packages/react/src → es}/components/IFrameBoxs/iFrameBoxs.d.ts +4 -4
  56. package/es/components/IFrameBoxs/iFrameBoxs.js +142 -0
  57. package/{dist/packages/react/src → es}/components/ImgBoxs/index.d.ts +3 -3
  58. package/es/components/ImgBoxs/index.js +219 -0
  59. package/es/components/LinkEidtCard/index.css +255 -0
  60. package/{dist/packages/react/src → es}/components/LinkEidtCard/index.d.ts +5 -5
  61. package/es/components/LinkEidtCard/index.js +238 -0
  62. package/es/components/LocationCondition/index.css +74 -0
  63. package/{dist/packages/react/src → es}/components/LocationCondition/index.d.ts +3 -3
  64. package/es/components/LocationCondition/index.js +195 -0
  65. package/{dist/packages/react/src → es}/components/MessageBox/index.d.ts +9 -9
  66. package/es/components/MessageBox/index.js +16 -0
  67. package/{dist/packages/react/src → es}/components/NotationBoxes/index.d.ts +3 -3
  68. package/es/components/NotationBoxes/index.js +105 -0
  69. package/{dist/packages/react/src → es}/components/ResetColumnWidth/index.d.ts +2 -2
  70. package/es/components/ResetColumnWidth/index.js +130 -0
  71. package/{dist/packages/react/src → es}/components/SVGDefines.d.ts +5 -5
  72. package/es/components/SVGDefines.js +1902 -0
  73. package/{dist/packages/react/src → es}/components/SVGIcon.d.ts +9 -9
  74. package/es/components/SVGIcon.js +18 -0
  75. package/es/components/SearchReplace/index.css +191 -0
  76. package/{dist/packages/react/src → es}/components/SearchReplace/index.d.ts +6 -6
  77. package/es/components/SearchReplace/index.js +294 -0
  78. package/es/components/Sheet/index.css +27 -0
  79. package/{dist/packages/react/src → es}/components/Sheet/index.d.ts +8 -8
  80. package/es/components/Sheet/index.js +173 -0
  81. package/{dist/packages/react/src → es}/components/SheetList/SheetHiddenButton.d.ts +8 -8
  82. package/es/components/SheetList/SheetHiddenButton.js +35 -0
  83. package/{dist/packages/react/src → es}/components/SheetList/SheetListItem.d.ts +9 -9
  84. package/es/components/SheetList/SheetListItem.js +72 -0
  85. package/es/components/SheetList/index.css +48 -0
  86. package/{dist/packages/react/src → es}/components/SheetList/index.d.ts +4 -4
  87. package/es/components/SheetList/index.js +30 -0
  88. package/{dist/packages/react/src → es}/components/SheetOverlay/ColumnHeader.d.ts +3 -3
  89. package/es/components/SheetOverlay/ColumnHeader.js +217 -0
  90. package/{dist/packages/react/src → es}/components/SheetOverlay/ContentEditable.d.ts +11 -11
  91. package/es/components/SheetOverlay/ContentEditable.js +74 -0
  92. package/es/components/SheetOverlay/FormulaHint/index.css +180 -0
  93. package/{dist/packages/react/src → es}/components/SheetOverlay/FormulaHint/index.d.ts +4 -4
  94. package/es/components/SheetOverlay/FormulaHint/index.js +348 -0
  95. package/{dist/packages/react/src → es}/components/SheetOverlay/FormulaSearch/constant.d.ts +63 -63
  96. package/es/components/SheetOverlay/FormulaSearch/constant.js +328 -0
  97. package/es/components/SheetOverlay/FormulaSearch/index.css +42 -0
  98. package/{dist/packages/react/src → es}/components/SheetOverlay/FormulaSearch/index.d.ts +4 -4
  99. package/es/components/SheetOverlay/FormulaSearch/index.js +261 -0
  100. package/{dist/packages/react/src → es}/components/SheetOverlay/InputBox.d.ts +3 -3
  101. package/es/components/SheetOverlay/InputBox.js +305 -0
  102. package/{dist/packages/react/src → es}/components/SheetOverlay/RowHeader.d.ts +3 -3
  103. package/es/components/SheetOverlay/RowHeader.js +187 -0
  104. package/es/components/SheetOverlay/ScrollBar/index.css +40 -0
  105. package/{dist/packages/react/src → es}/components/SheetOverlay/ScrollBar/index.d.ts +7 -7
  106. package/es/components/SheetOverlay/ScrollBar/index.js +47 -0
  107. package/es/components/SheetOverlay/index.css +939 -0
  108. package/{dist/packages/react/src → es}/components/SheetOverlay/index.d.ts +4 -4
  109. package/es/components/SheetOverlay/index.js +578 -0
  110. package/{dist/packages/react/src → es}/components/SheetTab/SheetItem.d.ts +8 -8
  111. package/es/components/SheetTab/SheetItem.js +228 -0
  112. package/es/components/SheetTab/index.css +280 -0
  113. package/{dist/packages/react/src → es}/components/SheetTab/index.d.ts +4 -4
  114. package/es/components/SheetTab/index.js +143 -0
  115. package/es/components/SplitColumn/index.css +121 -0
  116. package/{dist/packages/react/src → es}/components/SplitColumn/index.d.ts +3 -3
  117. package/es/components/SplitColumn/index.js +167 -0
  118. package/{dist/packages/react/src → es}/components/Toolbar/Button.d.ts +12 -12
  119. package/es/components/Toolbar/Button.js +32 -0
  120. package/{dist/packages/react/src → es}/components/Toolbar/ColorPicker.d.ts +6 -6
  121. package/es/components/Toolbar/ColorPicker.js +27 -0
  122. package/{dist/packages/react/src → es}/components/Toolbar/Combo.d.ts +12 -12
  123. package/es/components/Toolbar/Combo.js +102 -0
  124. package/{dist/packages/react/src → es}/components/Toolbar/CustomBorder.d.ts +7 -7
  125. package/es/components/Toolbar/CustomBorder.js +211 -0
  126. package/{dist/packages/react/src → es}/components/Toolbar/CustomButton.d.ts +11 -11
  127. package/es/components/Toolbar/CustomButton.js +29 -0
  128. package/{dist/packages/react/src → es}/components/Toolbar/CustomColor.d.ts +8 -8
  129. package/es/components/Toolbar/CustomColor.js +25 -0
  130. package/{dist/packages/react/src → es}/components/Toolbar/CustomIcon.d.ts +9 -9
  131. package/es/components/Toolbar/CustomIcon.js +38 -0
  132. package/{dist/packages/react/src → es}/components/Toolbar/Divider.d.ts +4 -4
  133. package/es/components/Toolbar/Divider.js +12 -0
  134. package/{dist/packages/react/src → es}/components/Toolbar/MoreItemsContainer.d.ts +6 -6
  135. package/es/components/Toolbar/MoreItemsContainer.js +17 -0
  136. package/{dist/packages/react/src → es}/components/Toolbar/Select.d.ts +14 -14
  137. package/es/components/Toolbar/Select.js +34 -0
  138. package/es/components/Toolbar/index.css +405 -0
  139. package/es/components/Toolbar/index.d.ts +10 -0
  140. package/es/components/Toolbar/index.js +1338 -0
  141. package/{dist/packages/react/src → es}/components/Workbook/api.d.ts +1177 -1177
  142. package/es/components/Workbook/api.js +395 -0
  143. package/es/components/Workbook/index.css +44 -0
  144. package/{dist/packages/react/src → es}/components/Workbook/index.d.ts +1185 -1185
  145. package/es/components/Workbook/index.js +586 -0
  146. package/es/components/ZoomControl/index.css +54 -0
  147. package/{dist/packages/react/src → es}/components/ZoomControl/index.d.ts +4 -4
  148. package/es/components/ZoomControl/index.js +111 -0
  149. package/{dist/packages/react/src → es}/components/index.d.ts +4 -4
  150. package/es/components/index.js +3 -0
  151. package/{dist/packages/react/src → es}/constants.d.ts +1 -1
  152. package/es/constants.js +4 -0
  153. package/{dist/packages/react/src → es}/context/index.d.ts +25 -25
  154. package/es/context/index.js +34 -0
  155. package/{dist/packages/react/src → es}/context/modal.d.ts +10 -10
  156. package/es/context/modal.js +43 -0
  157. package/{dist/packages/react/src → es}/hooks/useAlert.d.ts +4 -4
  158. package/es/hooks/useAlert.js +28 -0
  159. package/{dist/packages/react/src → es}/hooks/useDialog.d.ts +5 -5
  160. package/es/hooks/useDialog.js +28 -0
  161. package/{dist/packages/react/src → es}/hooks/useOutsideClick.d.ts +2 -2
  162. package/es/hooks/useOutsideClick.js +15 -0
  163. package/{dist/packages/react/src → es}/hooks/usePrevious.d.ts +2 -2
  164. package/es/hooks/usePrevious.js +9 -0
  165. package/{dist/packages/react/src → es}/index.d.ts +1 -1
  166. package/es/index.js +1 -0
  167. package/{dist/packages/react/src → es}/utils/datepickerStyles.d.ts +2 -2
  168. package/es/utils/datepickerStyles.js +8 -0
  169. package/lib/components/ChangeColor/index.css +76 -0
  170. package/lib/components/ChangeColor/index.d.ts +7 -0
  171. package/lib/components/ChangeColor/index.js +50 -0
  172. package/lib/components/ConditionFormat/ConditionRules.d.ts +6 -0
  173. package/lib/components/ConditionFormat/ConditionRules.js +332 -0
  174. package/lib/components/ConditionFormat/index.css +210 -0
  175. package/lib/components/ConditionFormat/index.d.ts +7 -0
  176. package/lib/components/ConditionFormat/index.js +261 -0
  177. package/lib/components/ContextMenu/Divider.d.ts +3 -0
  178. package/lib/components/ContextMenu/Divider.js +14 -0
  179. package/lib/components/ContextMenu/FilterMenu.d.ts +3 -0
  180. package/lib/components/ContextMenu/FilterMenu.js +621 -0
  181. package/lib/components/ContextMenu/Menu.d.ts +8 -0
  182. package/lib/components/ContextMenu/Menu.js +33 -0
  183. package/lib/components/ContextMenu/SheetTab.d.ts +4 -0
  184. package/lib/components/ContextMenu/SheetTab.js +232 -0
  185. package/lib/components/ContextMenu/index.css +322 -0
  186. package/lib/components/ContextMenu/index.d.ts +5 -0
  187. package/lib/components/ContextMenu/index.js +1063 -0
  188. package/lib/components/CustomSort/index.css +23 -0
  189. package/lib/components/CustomSort/index.d.ts +4 -0
  190. package/lib/components/CustomSort/index.js +122 -0
  191. package/lib/components/DataVerification/DropdownList.d.ts +4 -0
  192. package/lib/components/DataVerification/DropdownList.js +135 -0
  193. package/lib/components/DataVerification/RangeDialog.d.ts +4 -0
  194. package/lib/components/DataVerification/RangeDialog.js +114 -0
  195. package/lib/components/DataVerification/getDisplayedRangeTxt.d.ts +2 -0
  196. package/lib/components/DataVerification/getDisplayedRangeTxt.js +15 -0
  197. package/lib/components/DataVerification/index.css +202 -0
  198. package/lib/components/DataVerification/index.d.ts +4 -0
  199. package/lib/components/DataVerification/index.js +407 -0
  200. package/lib/components/Dialog/index.css +64 -0
  201. package/lib/components/Dialog/index.d.ts +15 -0
  202. package/lib/components/Dialog/index.js +69 -0
  203. package/lib/components/DuneChartsInputModal/DuneChartsInputModal.d.ts +11 -0
  204. package/lib/components/DuneChartsInputModal/DuneChartsInputModal.js +104 -0
  205. package/lib/components/DuneChartsInputModal/duneChartsInputModal.css +98 -0
  206. package/lib/components/DunePreview/DunePreview.d.ts +13 -0
  207. package/lib/components/DunePreview/DunePreview.js +53 -0
  208. package/lib/components/DunePreview/index.css +57 -0
  209. package/lib/components/FilterOption/index.d.ts +5 -0
  210. package/lib/components/FilterOption/index.js +130 -0
  211. package/lib/components/FormatSearch/index.css +19 -0
  212. package/lib/components/FormatSearch/index.d.ts +6 -0
  213. package/lib/components/FormatSearch/index.js +138 -0
  214. package/lib/components/FormulaSearch/index.css +65 -0
  215. package/lib/components/FormulaSearch/index.d.ts +5 -0
  216. package/lib/components/FormulaSearch/index.js +207 -0
  217. package/lib/components/FxEditor/NameBox.d.ts +3 -0
  218. package/lib/components/FxEditor/NameBox.js +38 -0
  219. package/lib/components/FxEditor/index.css +72 -0
  220. package/lib/components/FxEditor/index.d.ts +4 -0
  221. package/lib/components/FxEditor/index.js +176 -0
  222. package/lib/components/IFrameBoxs/iFrameBoxs.css +16 -0
  223. package/lib/components/IFrameBoxs/iFrameBoxs.d.ts +4 -0
  224. package/lib/components/IFrameBoxs/iFrameBoxs.js +151 -0
  225. package/lib/components/ImgBoxs/index.d.ts +3 -0
  226. package/lib/components/ImgBoxs/index.js +228 -0
  227. package/lib/components/LinkEidtCard/index.css +255 -0
  228. package/lib/components/LinkEidtCard/index.d.ts +5 -0
  229. package/lib/components/LinkEidtCard/index.js +247 -0
  230. package/lib/components/LocationCondition/index.css +74 -0
  231. package/lib/components/LocationCondition/index.d.ts +3 -0
  232. package/lib/components/LocationCondition/index.js +204 -0
  233. package/lib/components/MessageBox/index.d.ts +9 -0
  234. package/lib/components/MessageBox/index.js +23 -0
  235. package/lib/components/NotationBoxes/index.d.ts +3 -0
  236. package/lib/components/NotationBoxes/index.js +114 -0
  237. package/lib/components/ResetColumnWidth/index.d.ts +2 -0
  238. package/lib/components/ResetColumnWidth/index.js +138 -0
  239. package/lib/components/SVGDefines.d.ts +5 -0
  240. package/lib/components/SVGDefines.js +1909 -0
  241. package/lib/components/SVGIcon.d.ts +9 -0
  242. package/lib/components/SVGIcon.js +25 -0
  243. package/lib/components/SearchReplace/index.css +191 -0
  244. package/lib/components/SearchReplace/index.d.ts +6 -0
  245. package/lib/components/SearchReplace/index.js +303 -0
  246. package/lib/components/Sheet/index.css +27 -0
  247. package/lib/components/Sheet/index.d.ts +8 -0
  248. package/lib/components/Sheet/index.js +182 -0
  249. package/lib/components/SheetList/SheetHiddenButton.d.ts +8 -0
  250. package/lib/components/SheetList/SheetHiddenButton.js +44 -0
  251. package/lib/components/SheetList/SheetListItem.d.ts +9 -0
  252. package/lib/components/SheetList/SheetListItem.js +81 -0
  253. package/lib/components/SheetList/index.css +48 -0
  254. package/lib/components/SheetList/index.d.ts +4 -0
  255. package/lib/components/SheetList/index.js +39 -0
  256. package/lib/components/SheetOverlay/ColumnHeader.d.ts +3 -0
  257. package/lib/components/SheetOverlay/ColumnHeader.js +226 -0
  258. package/lib/components/SheetOverlay/ContentEditable.d.ts +11 -0
  259. package/lib/components/SheetOverlay/ContentEditable.js +83 -0
  260. package/lib/components/SheetOverlay/FormulaHint/index.css +180 -0
  261. package/lib/components/SheetOverlay/FormulaHint/index.d.ts +4 -0
  262. package/lib/components/SheetOverlay/FormulaHint/index.js +357 -0
  263. package/lib/components/SheetOverlay/FormulaSearch/constant.d.ts +63 -0
  264. package/lib/components/SheetOverlay/FormulaSearch/constant.js +334 -0
  265. package/lib/components/SheetOverlay/FormulaSearch/index.css +42 -0
  266. package/lib/components/SheetOverlay/FormulaSearch/index.d.ts +4 -0
  267. package/lib/components/SheetOverlay/FormulaSearch/index.js +270 -0
  268. package/lib/components/SheetOverlay/InputBox.d.ts +3 -0
  269. package/lib/components/SheetOverlay/InputBox.js +314 -0
  270. package/lib/components/SheetOverlay/RowHeader.d.ts +3 -0
  271. package/lib/components/SheetOverlay/RowHeader.js +196 -0
  272. package/lib/components/SheetOverlay/ScrollBar/index.css +40 -0
  273. package/lib/components/SheetOverlay/ScrollBar/index.d.ts +7 -0
  274. package/lib/components/SheetOverlay/ScrollBar/index.js +56 -0
  275. package/lib/components/SheetOverlay/index.css +939 -0
  276. package/lib/components/SheetOverlay/index.d.ts +4 -0
  277. package/lib/components/SheetOverlay/index.js +587 -0
  278. package/lib/components/SheetTab/SheetItem.d.ts +8 -0
  279. package/lib/components/SheetTab/SheetItem.js +237 -0
  280. package/lib/components/SheetTab/index.css +280 -0
  281. package/lib/components/SheetTab/index.d.ts +4 -0
  282. package/lib/components/SheetTab/index.js +152 -0
  283. package/lib/components/SplitColumn/index.css +121 -0
  284. package/lib/components/SplitColumn/index.d.ts +3 -0
  285. package/lib/components/SplitColumn/index.js +176 -0
  286. package/lib/components/Toolbar/Button.d.ts +12 -0
  287. package/lib/components/Toolbar/Button.js +39 -0
  288. package/lib/components/Toolbar/ColorPicker.d.ts +6 -0
  289. package/lib/components/Toolbar/ColorPicker.js +34 -0
  290. package/lib/components/Toolbar/Combo.d.ts +12 -0
  291. package/lib/components/Toolbar/Combo.js +111 -0
  292. package/lib/components/Toolbar/CustomBorder.d.ts +7 -0
  293. package/lib/components/Toolbar/CustomBorder.js +220 -0
  294. package/lib/components/Toolbar/CustomButton.d.ts +11 -0
  295. package/lib/components/Toolbar/CustomButton.js +36 -0
  296. package/lib/components/Toolbar/CustomColor.d.ts +8 -0
  297. package/lib/components/Toolbar/CustomColor.js +32 -0
  298. package/lib/components/Toolbar/CustomIcon.d.ts +9 -0
  299. package/lib/components/Toolbar/CustomIcon.js +46 -0
  300. package/lib/components/Toolbar/Divider.d.ts +4 -0
  301. package/lib/components/Toolbar/Divider.js +19 -0
  302. package/lib/components/Toolbar/MoreItemsContainer.d.ts +6 -0
  303. package/lib/components/Toolbar/MoreItemsContainer.js +25 -0
  304. package/lib/components/Toolbar/Select.d.ts +14 -0
  305. package/lib/components/Toolbar/Select.js +40 -0
  306. package/lib/components/Toolbar/index.css +405 -0
  307. package/lib/components/Toolbar/index.d.ts +10 -0
  308. package/lib/components/Toolbar/index.js +1347 -0
  309. package/lib/components/Workbook/api.d.ts +1177 -0
  310. package/lib/components/Workbook/api.js +402 -0
  311. package/lib/components/Workbook/index.css +44 -0
  312. package/{dist/stories/API.stories.d.ts → lib/components/Workbook/index.d.ts} +1185 -1210
  313. package/lib/components/Workbook/index.js +595 -0
  314. package/lib/components/ZoomControl/index.css +54 -0
  315. package/lib/components/ZoomControl/index.d.ts +4 -0
  316. package/lib/components/ZoomControl/index.js +120 -0
  317. package/lib/components/index.d.ts +4 -0
  318. package/lib/components/index.js +28 -0
  319. package/lib/constants.d.ts +1 -0
  320. package/lib/constants.js +10 -0
  321. package/lib/context/index.d.ts +25 -0
  322. package/lib/context/index.js +41 -0
  323. package/lib/context/modal.d.ts +10 -0
  324. package/lib/context/modal.js +50 -0
  325. package/lib/hooks/useAlert.d.ts +4 -0
  326. package/lib/hooks/useAlert.js +37 -0
  327. package/lib/hooks/useDialog.d.ts +5 -0
  328. package/lib/hooks/useDialog.js +37 -0
  329. package/lib/hooks/useOutsideClick.d.ts +2 -0
  330. package/lib/hooks/useOutsideClick.js +21 -0
  331. package/lib/hooks/usePrevious.d.ts +2 -0
  332. package/lib/hooks/usePrevious.js +15 -0
  333. package/lib/index.d.ts +1 -0
  334. package/lib/index.js +16 -0
  335. package/lib/utils/datepickerStyles.d.ts +2 -0
  336. package/lib/utils/datepickerStyles.js +14 -0
  337. package/package.json +7 -6
  338. package/dist/index.css +0 -3915
  339. package/dist/index.esm.css +0 -3915
  340. package/dist/index.esm.js +0 -12974
  341. package/dist/index.js +0 -12994
  342. package/dist/index.umd.css +0 -3915
  343. package/dist/index.umd.js +0 -122178
  344. package/dist/index.umd.min.css +0 -1
  345. package/dist/index.umd.min.js +0 -50
  346. package/dist/packages/core/src/api/cell.d.ts +0 -10
  347. package/dist/packages/core/src/api/common.d.ts +0 -66
  348. package/dist/packages/core/src/api/errors.d.ts +0 -2
  349. package/dist/packages/core/src/api/index.d.ts +0 -9
  350. package/dist/packages/core/src/api/merge.d.ts +0 -5
  351. package/dist/packages/core/src/api/range.d.ts +0 -22
  352. package/dist/packages/core/src/api/rowcol.d.ts +0 -14
  353. package/dist/packages/core/src/api/sheet.d.ts +0 -10
  354. package/dist/packages/core/src/api/workbook.d.ts +0 -15
  355. package/dist/packages/core/src/canvas.d.ts +0 -46
  356. package/dist/packages/core/src/context.d.ts +0 -197
  357. package/dist/packages/core/src/events/copy.d.ts +0 -2
  358. package/dist/packages/core/src/events/index.d.ts +0 -4
  359. package/dist/packages/core/src/events/keyboard.d.ts +0 -6
  360. package/dist/packages/core/src/events/mouse.d.ts +0 -22
  361. package/dist/packages/core/src/events/paste.d.ts +0 -3
  362. package/dist/packages/core/src/index.d.ts +0 -10
  363. package/dist/packages/core/src/locale/en.d.ts +0 -992
  364. package/dist/packages/core/src/locale/es.d.ts +0 -1134
  365. package/dist/packages/core/src/locale/hi.d.ts +0 -1030
  366. package/dist/packages/core/src/locale/index.d.ts +0 -1049
  367. package/dist/packages/core/src/locale/zh.d.ts +0 -1048
  368. package/dist/packages/core/src/locale/zh_tw.d.ts +0 -1187
  369. package/dist/packages/core/src/modules/ConditionFormat.d.ts +0 -17
  370. package/dist/packages/core/src/modules/border.d.ts +0 -3
  371. package/dist/packages/core/src/modules/cell.d.ts +0 -32
  372. package/dist/packages/core/src/modules/clipboard.d.ts +0 -3
  373. package/dist/packages/core/src/modules/color.d.ts +0 -1
  374. package/dist/packages/core/src/modules/comment.d.ts +0 -97
  375. package/dist/packages/core/src/modules/conditionalFormat.d.ts +0 -2
  376. package/dist/packages/core/src/modules/cursor.d.ts +0 -3
  377. package/dist/packages/core/src/modules/dataVerification.d.ts +0 -11
  378. package/dist/packages/core/src/modules/dropCell.d.ts +0 -10
  379. package/dist/packages/core/src/modules/filter.d.ts +0 -45
  380. package/dist/packages/core/src/modules/format.d.ts +0 -6
  381. package/dist/packages/core/src/modules/formula.d.ts +0 -54
  382. package/dist/packages/core/src/modules/freeze.d.ts +0 -5
  383. package/dist/packages/core/src/modules/hyperlink.d.ts +0 -21
  384. package/dist/packages/core/src/modules/iframe.d.ts +0 -12
  385. package/dist/packages/core/src/modules/image.d.ts +0 -31
  386. package/dist/packages/core/src/modules/index.d.ts +0 -36
  387. package/dist/packages/core/src/modules/inline-string.d.ts +0 -36
  388. package/dist/packages/core/src/modules/location.d.ts +0 -6
  389. package/dist/packages/core/src/modules/locationCondition.d.ts +0 -21
  390. package/dist/packages/core/src/modules/merge.d.ts +0 -3
  391. package/dist/packages/core/src/modules/mobile.d.ts +0 -5
  392. package/dist/packages/core/src/modules/moveCells.d.ts +0 -5
  393. package/dist/packages/core/src/modules/protection.d.ts +0 -5
  394. package/dist/packages/core/src/modules/refresh.d.ts +0 -3
  395. package/dist/packages/core/src/modules/rowcol.d.ts +0 -19
  396. package/dist/packages/core/src/modules/screenshot.d.ts +0 -2
  397. package/dist/packages/core/src/modules/searchReplace.d.ts +0 -36
  398. package/dist/packages/core/src/modules/selection.d.ts +0 -46
  399. package/dist/packages/core/src/modules/sheet.d.ts +0 -10
  400. package/dist/packages/core/src/modules/sort.d.ts +0 -7
  401. package/dist/packages/core/src/modules/splitColumn.d.ts +0 -5
  402. package/dist/packages/core/src/modules/text.d.ts +0 -10
  403. package/dist/packages/core/src/modules/toolbar.d.ts +0 -32
  404. package/dist/packages/core/src/modules/validation.d.ts +0 -19
  405. package/dist/packages/core/src/modules/zoom.d.ts +0 -3
  406. package/dist/packages/core/src/settings.d.ts +0 -100
  407. package/dist/packages/core/src/types.d.ts +0 -371
  408. package/dist/packages/core/src/utils/freeze.d.ts +0 -7
  409. package/dist/packages/core/src/utils/index.d.ts +0 -18
  410. package/dist/packages/core/src/utils/patch.d.ts +0 -37
  411. package/dist/packages/react/src/components/Toolbar/index.d.ts +0 -10
  412. package/dist/stories/Collabration.stories.d.ts +0 -2359
  413. package/dist/stories/Features.stories.d.ts +0 -9430
  414. package/dist/stories/data/cell.d.ts +0 -983
  415. package/dist/stories/data/dataVerification.d.ts +0 -131
  416. package/dist/stories/data/empty.d.ts +0 -10
  417. package/dist/stories/data/formula.d.ts +0 -362
  418. package/dist/stories/data/freeze.d.ts +0 -34
  419. package/dist/stories/data/protected.d.ts +0 -40
  420. package/dist/stories/utils.d.ts +0 -1
@@ -0,0 +1,1338 @@
1
+ import React, { useContext, useCallback, useRef, useEffect, useState } from "react";
2
+ 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";
3
+ import _ from "lodash";
4
+ import { IconButton, LucideIcon, Tooltip } from "@fileverse/ui";
5
+ import WorkbookContext from "../../context";
6
+ import "./index.css";
7
+ import Button from "./Button";
8
+ import Divider, { MenuDivider } from "./Divider";
9
+ import Combo from "./Combo";
10
+ import Select, { Option } from "./Select";
11
+ import SVGIcon from "../SVGIcon";
12
+ import { useDialog } from "../../hooks/useDialog";
13
+ import { SplitColumn } from "../SplitColumn";
14
+ import { LocationCondition } from "../LocationCondition";
15
+ import DataVerification from "../DataVerification";
16
+ import ConditionalFormat from "../ConditionFormat";
17
+ import CustomButton from "./CustomButton";
18
+ import { CustomColor } from "./CustomColor";
19
+ import { FormatSearch } from "../FormatSearch";
20
+ import DuneChartsInputModal from "../DuneChartsInputModal/DuneChartsInputModal";
21
+ import MoreItemsContaier from "./MoreItemsContainer";
22
+ export var getLucideIcon = function getLucideIcon(title) {
23
+ switch (title) {
24
+ case "undo":
25
+ return "Undo";
26
+ case "redo":
27
+ return "Redo";
28
+ case "bold":
29
+ return "Bold";
30
+ case "italic":
31
+ return "Italic";
32
+ case "strike-through":
33
+ return "Strikethrough";
34
+ case "underline":
35
+ return "Underline";
36
+ case "align-left":
37
+ return "AlignLeft";
38
+ case "align-center":
39
+ return "AlignCenter";
40
+ case "align-right":
41
+ return "AlignRight";
42
+ case "align-top":
43
+ return "ArrowUpFromLine";
44
+ case "align-middle":
45
+ return "AlignVerticalMiddle";
46
+ case "align-bottom":
47
+ return "ArrowDownToLine";
48
+ case "text-overflow":
49
+ return "TextOverflow";
50
+ case "text-wrap":
51
+ return "WrapText";
52
+ case "text-clip":
53
+ return "TextClip";
54
+ case "font-color":
55
+ return "Baseline";
56
+ case "background":
57
+ return "PaintBucket";
58
+ case "border-all":
59
+ return "Border";
60
+ case "merge-all":
61
+ return "MergeHorizontal";
62
+ case "format":
63
+ return "DollarSign";
64
+ case "currency-format":
65
+ return "DollarSign";
66
+ case "percentage-format":
67
+ return "Percent";
68
+ case "number-decrease":
69
+ return "DecimalsArrowLeft";
70
+ case "number-increase":
71
+ return "DecimalsArrowRight";
72
+ case "conditionFormat":
73
+ return "PaintbrushVertical";
74
+ case "filter":
75
+ return "Filter";
76
+ case "link":
77
+ return "Link";
78
+ case "comment":
79
+ return "MessageSquarePlus";
80
+ case "image":
81
+ return "Image";
82
+ case "formula-sum":
83
+ return "Sigma";
84
+ case "dataVerification":
85
+ return "ShieldCheck";
86
+ case "search":
87
+ return "Search";
88
+ case "dune":
89
+ return "DuneChart";
90
+ case "Ellipsis":
91
+ return "Ellipsis";
92
+ default:
93
+ return "";
94
+ }
95
+ };
96
+ var Toolbar = function Toolbar(_a) {
97
+ var _b, _c, _d;
98
+ var setMoreItems = _a.setMoreItems,
99
+ moreItemsOpen = _a.moreItemsOpen,
100
+ onMoreToolbarItemsClose = _a.onMoreToolbarItemsClose,
101
+ moreToolbarItems = _a.moreToolbarItems;
102
+ var _e = useContext(WorkbookContext),
103
+ context = _e.context,
104
+ setContext = _e.setContext,
105
+ refs = _e.refs,
106
+ settings = _e.settings,
107
+ handleUndo = _e.handleUndo,
108
+ handleRedo = _e.handleRedo;
109
+ var contextRef = useRef(context);
110
+ var containerRef = useRef(null);
111
+ var _f = useState(-1),
112
+ toolbarWrapIndex = _f[0],
113
+ setToolbarWrapIndex = _f[1];
114
+ var _g = useState([]),
115
+ itemLocations = _g[0],
116
+ setItemLocations = _g[1];
117
+ var _h = useState(false),
118
+ showDuneModal = _h[0],
119
+ setShowDuneModal = _h[1];
120
+ var _j = useState(window.innerWidth >= 1280),
121
+ isDesktop = _j[0],
122
+ setIsDesktop = _j[1];
123
+ var _k = useDialog(),
124
+ showDialog = _k.showDialog,
125
+ hideDialog = _k.hideDialog;
126
+ var firstSelection = (_b = context.luckysheet_select_save) === null || _b === void 0 ? void 0 : _b[0];
127
+ var flowdata = getFlowdata(context);
128
+ contextRef.current = context;
129
+ var row = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.row_focus;
130
+ var col = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.column_focus;
131
+ 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;
132
+ var _l = locale(context),
133
+ toolbar = _l.toolbar,
134
+ merge = _l.merge,
135
+ border = _l.border,
136
+ freezen = _l.freezen,
137
+ defaultFmt = _l.defaultFmt,
138
+ formula = _l.formula,
139
+ sort = _l.sort,
140
+ align = _l.align,
141
+ textWrap = _l.textWrap,
142
+ rotation = _l.rotation,
143
+ screenshot = _l.screenshot,
144
+ filter = _l.filter,
145
+ splitText = _l.splitText,
146
+ findAndReplace = _l.findAndReplace,
147
+ comment = _l.comment,
148
+ fontarray = _l.fontarray;
149
+ var toolbarFormat = locale(context).format;
150
+ var sheetWidth = context.luckysheetTableContentHW[0];
151
+ var currency = settings.currency;
152
+ var defaultFormat = defaultFmt(currency);
153
+ var customColor = useState("#000000")[0];
154
+ var customStyle = useState("1")[0];
155
+ var showSubMenu = useCallback(function (e, className) {
156
+ var target = e.target;
157
+ var menuItem = target.className === "fortune-toolbar-menu-line" ? target.parentElement : target;
158
+ var menuItemRect = menuItem.getBoundingClientRect();
159
+ var workbookContainerRect = refs.workbookContainer.current.getBoundingClientRect();
160
+ var subMenu = menuItem.querySelector(".".concat(className));
161
+ if (_.isNil(subMenu)) return;
162
+ var menuItemStyle = window.getComputedStyle(menuItem);
163
+ var menuItemPaddingRight = parseFloat(menuItemStyle.getPropertyValue("padding-right").replace("px", ""));
164
+ if (workbookContainerRect.right - menuItemRect.right < parseFloat(subMenu.style.width.replace("px", ""))) {
165
+ subMenu.style.display = "block";
166
+ subMenu.style.right = "".concat(menuItemRect.width - menuItemPaddingRight, "px");
167
+ } else {
168
+ subMenu.style.display = "block";
169
+ subMenu.style.right = className === "more-format" ? "".concat(-(parseFloat(subMenu.style.width.replace("px", "")) + 0), "px") : "".concat(-(parseFloat(subMenu.style.width.replace("px", "")) + menuItemPaddingRight), "px");
170
+ }
171
+ }, [refs.workbookContainer]);
172
+ var hideSubMenu = useCallback(function (e, className) {
173
+ var target = e.target;
174
+ if (target.className === "".concat(className)) {
175
+ target.style.display = "none";
176
+ return;
177
+ }
178
+ var subMenu = target.className === "condition-format-item" ? target.parentElement : target.querySelector(".".concat(className));
179
+ if (_.isNil(subMenu)) return;
180
+ subMenu.style.display = "none";
181
+ }, []);
182
+ useEffect(function () {
183
+ var handleResize = function handleResize() {
184
+ setIsDesktop(window.innerWidth >= 1280);
185
+ };
186
+ window.addEventListener("resize", handleResize);
187
+ return function () {
188
+ return window.removeEventListener("resize", handleResize);
189
+ };
190
+ }, []);
191
+ useEffect(function () {
192
+ setToolbarWrapIndex(-1);
193
+ }, [settings.toolbarItems, settings.customToolbarItems]);
194
+ useEffect(function () {
195
+ if (toolbarWrapIndex === -1) {
196
+ var container = containerRef.current;
197
+ if (!container) return;
198
+ var items = container.querySelectorAll(".fortune-toolbar-item");
199
+ if (!items) return;
200
+ var locations = [];
201
+ var containerRect = container.getBoundingClientRect();
202
+ for (var i = 0; i < items.length; i += 1) {
203
+ var item = items[i];
204
+ var itemRect = item.getBoundingClientRect();
205
+ locations.push(itemRect.left - containerRect.left + itemRect.width);
206
+ }
207
+ setItemLocations(locations);
208
+ }
209
+ }, [toolbarWrapIndex, sheetWidth]);
210
+ useEffect(function () {
211
+ if (isDesktop) {
212
+ setToolbarWrapIndex(-1);
213
+ setMoreItems(null);
214
+ return;
215
+ }
216
+ if (itemLocations.length === 0) return;
217
+ var container = containerRef.current;
218
+ if (!container) return;
219
+ var moreButtonWidth = 50;
220
+ var containerWidth = container.getBoundingClientRect().width;
221
+ var availableWidth = containerWidth - 30;
222
+ for (var i = itemLocations.length - 1; i >= 0; i -= 1) {
223
+ var loc = itemLocations[i];
224
+ if (loc + moreButtonWidth < availableWidth) {
225
+ setToolbarWrapIndex(i - itemLocations.length + settings.toolbarItems.length);
226
+ if (i === itemLocations.length - 1) {
227
+ setMoreItems(null);
228
+ }
229
+ break;
230
+ }
231
+ }
232
+ }, [itemLocations, setMoreItems, settings.toolbarItems.length, sheetWidth, isDesktop]);
233
+ var getToolbarItem = useCallback(function (name, i) {
234
+ var _a, _b, _c, _d, _e, _f;
235
+ var tooltip = toolbar[name];
236
+ if (name === "|") {
237
+ return /*#__PURE__*/React.createElement(Divider, {
238
+ key: i
239
+ });
240
+ }
241
+ if (["font-color", "background"].includes(name)) {
242
+ var pick_1 = function pick_1(color) {
243
+ setContext(function (draftCtx) {
244
+ return (name === "font-color" ? handleTextColor : handleTextBackground)(draftCtx, refs.cellInput.current, color);
245
+ });
246
+ if (name === "font-color") {
247
+ refs.globalCache.recentTextColor = color;
248
+ } else {
249
+ refs.globalCache.recentBackgroundColor = color;
250
+ }
251
+ };
252
+ return /*#__PURE__*/React.createElement("div", {
253
+ style: {
254
+ position: "relative"
255
+ },
256
+ key: name
257
+ }, /*#__PURE__*/React.createElement("div", {
258
+ style: {
259
+ width: 24,
260
+ height: 4,
261
+ backgroundColor: name === "font-color" ? refs.globalCache.recentTextColor : refs.globalCache.recentBackgroundColor,
262
+ position: "absolute",
263
+ bottom: 2,
264
+ left: 3,
265
+ zIndex: 100
266
+ }
267
+ }), /*#__PURE__*/React.createElement(Combo, {
268
+ iconId: name,
269
+ tooltip: tooltip,
270
+ showArrow: false,
271
+ fillColor: name === "font-color" ? refs.globalCache.recentTextColor : undefined,
272
+ onClick: function onClick() {
273
+ var color = name === "font-color" ? refs.globalCache.recentTextColor : refs.globalCache.recentBackgroundColor;
274
+ if (color) pick_1(color);
275
+ }
276
+ }, function (setOpen) {
277
+ return /*#__PURE__*/React.createElement(CustomColor, {
278
+ onCustomPick: function onCustomPick(color) {
279
+ pick_1(color);
280
+ setOpen(false);
281
+ },
282
+ onColorPick: pick_1
283
+ });
284
+ }));
285
+ }
286
+ if (name === "format") {
287
+ var currentFmt = defaultFormat[0].text;
288
+ if (cell) {
289
+ var curr_1 = normalizedCellAttr(cell, "ct");
290
+ var format = _.find(defaultFormat, function (v) {
291
+ return v.value === (curr_1 === null || curr_1 === void 0 ? void 0 : curr_1.fa);
292
+ });
293
+ if ((curr_1 === null || curr_1 === void 0 ? void 0 : curr_1.fa) != null) {
294
+ if (format != null) {
295
+ currentFmt = format.text;
296
+ } else {
297
+ currentFmt = defaultFormat[defaultFormat.length - 1].text;
298
+ }
299
+ }
300
+ }
301
+ return /*#__PURE__*/React.createElement(Combo, {
302
+ text: currentFmt,
303
+ key: name,
304
+ tooltip: tooltip,
305
+ showArrow: false
306
+ }, function (setOpen) {
307
+ return /*#__PURE__*/React.createElement(Select, null, defaultFormat.map(function (_a, ii) {
308
+ var text = _a.text,
309
+ value = _a.value,
310
+ example = _a.example;
311
+ if (value === "split") {
312
+ return /*#__PURE__*/React.createElement(MenuDivider, {
313
+ key: ii
314
+ });
315
+ }
316
+ if (value === "fmtOtherSelf") {
317
+ return /*#__PURE__*/React.createElement(Option, {
318
+ key: value,
319
+ onClick: function onClick() {
320
+ showDialog(/*#__PURE__*/React.createElement(FormatSearch, {
321
+ onCancel: hideDialog,
322
+ type: "currency"
323
+ }), undefined, "Currency Format");
324
+ setOpen(false);
325
+ }
326
+ }, /*#__PURE__*/React.createElement("div", {
327
+ className: "fortune-toolbar-menu-line"
328
+ }, /*#__PURE__*/React.createElement("div", null, text), /*#__PURE__*/React.createElement("div", {
329
+ className: "fortune-toolbar-subtext"
330
+ }, example)));
331
+ }
332
+ return /*#__PURE__*/React.createElement(Option, {
333
+ key: value,
334
+ onClick: function onClick() {
335
+ setOpen(false);
336
+ setContext(function (ctx) {
337
+ var d = getFlowdata(ctx);
338
+ if (d == null) return;
339
+ updateFormat(ctx, refs.cellInput.current, d, "ct", value);
340
+ });
341
+ }
342
+ }, /*#__PURE__*/React.createElement("div", {
343
+ className: "fortune-toolbar-menu-line"
344
+ }, /*#__PURE__*/React.createElement("div", null, text), /*#__PURE__*/React.createElement("div", {
345
+ className: "fortune-toolbar-subtext"
346
+ }, example)));
347
+ }));
348
+ });
349
+ }
350
+ if (name === "font") {
351
+ var current_1 = fontarray[0];
352
+ if ((cell === null || cell === void 0 ? void 0 : cell.ff) != null) {
353
+ if (_.isNumber(cell.ff)) {
354
+ current_1 = fontarray[cell.ff];
355
+ } else {
356
+ current_1 = cell.ff;
357
+ }
358
+ }
359
+ return /*#__PURE__*/React.createElement(Combo, {
360
+ text: current_1,
361
+ key: name,
362
+ tooltip: tooltip,
363
+ showArrow: false
364
+ }, function (setOpen) {
365
+ return /*#__PURE__*/React.createElement(Select, null, fontarray.map(function (o) {
366
+ return /*#__PURE__*/React.createElement(Option, {
367
+ key: o,
368
+ onClick: function onClick() {
369
+ setContext(function (ctx) {
370
+ current_1 = o;
371
+ var d = getFlowdata(ctx);
372
+ if (!d) return;
373
+ updateFormat(ctx, refs.cellInput.current, d, "ff", o);
374
+ });
375
+ setOpen(false);
376
+ }
377
+ }, o);
378
+ }));
379
+ });
380
+ }
381
+ if (name === "font-size") {
382
+ return /*#__PURE__*/React.createElement(Combo, {
383
+ text: cell ? normalizedCellAttr(cell, "fs", context.defaultFontSize) : context.defaultFontSize.toString(),
384
+ key: name,
385
+ tooltip: tooltip,
386
+ showArrow: false
387
+ }, function (setOpen) {
388
+ return /*#__PURE__*/React.createElement(Select, {
389
+ style: {
390
+ minWidth: "fit-content",
391
+ width: "50px"
392
+ }
393
+ }, [9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72].map(function (num) {
394
+ return /*#__PURE__*/React.createElement("div", {
395
+ className: "fortune-toolbar-select-option text-body-sm text-center color-text-default",
396
+ style: {
397
+ minWidth: "fit-content",
398
+ padding: "0px",
399
+ width: "36px",
400
+ height: "36px",
401
+ display: "flex",
402
+ alignItems: "center",
403
+ justifyContent: "center",
404
+ fontSize: "14px"
405
+ },
406
+ key: num,
407
+ onClick: function onClick() {
408
+ setContext(function (draftContext) {
409
+ return handleTextSize(draftContext, refs.cellInput.current, num, refs.canvas.current.getContext("2d"));
410
+ });
411
+ setOpen(false);
412
+ }
413
+ }, num);
414
+ }));
415
+ });
416
+ }
417
+ if (name === "horizontal-align") {
418
+ var items_1 = [{
419
+ title: "align-left",
420
+ text: align.left,
421
+ value: 1
422
+ }, {
423
+ title: "align-center",
424
+ text: align.center,
425
+ value: 0
426
+ }, {
427
+ title: "align-right",
428
+ text: align.right,
429
+ value: 2
430
+ }];
431
+ return /*#__PURE__*/React.createElement(Combo, {
432
+ iconId: ((_a = _.find(items_1, function (item) {
433
+ return "".concat(item.value) === "".concat(cell === null || cell === void 0 ? void 0 : cell.ht);
434
+ })) === null || _a === void 0 ? void 0 : _a.title) || "align-left",
435
+ key: name,
436
+ tooltip: toolbar.horizontalAlign,
437
+ showArrow: false
438
+ }, function (setOpen) {
439
+ return /*#__PURE__*/React.createElement(Select, {
440
+ style: {
441
+ minWidth: "fit-content",
442
+ display: "flex",
443
+ flexDirection: "row",
444
+ alignItems: "center",
445
+ justifyContent: "center",
446
+ gap: 4
447
+ }
448
+ }, items_1.map(function (_a) {
449
+ var _b;
450
+ var title = _a.title;
451
+ return /*#__PURE__*/React.createElement(IconButton, {
452
+ key: title,
453
+ isActive: ((_b = _.find(items_1, function (item) {
454
+ return "".concat(item.value) === "".concat(cell === null || cell === void 0 ? void 0 : cell.ht);
455
+ })) === null || _b === void 0 ? void 0 : _b.title) === title,
456
+ icon: getLucideIcon(title),
457
+ variant: "ghost",
458
+ onClick: function onClick() {
459
+ setContext(function (ctx) {
460
+ handleHorizontalAlign(ctx, refs.cellInput.current, title.replace("align-", ""));
461
+ });
462
+ setOpen(false);
463
+ },
464
+ tabIndex: 0
465
+ });
466
+ }));
467
+ });
468
+ }
469
+ if (name === "vertical-align") {
470
+ var items_2 = [{
471
+ title: "align-top",
472
+ text: align.top,
473
+ value: 1
474
+ }, {
475
+ title: "align-middle",
476
+ text: align.middle,
477
+ value: 0
478
+ }, {
479
+ title: "align-bottom",
480
+ text: align.bottom,
481
+ value: 2
482
+ }];
483
+ return /*#__PURE__*/React.createElement(Combo, {
484
+ iconId: ((_b = _.find(items_2, function (item) {
485
+ return "".concat(item.value) === "".concat(cell === null || cell === void 0 ? void 0 : cell.vt);
486
+ })) === null || _b === void 0 ? void 0 : _b.title) || "align-top",
487
+ key: name,
488
+ tooltip: toolbar.verticalAlign,
489
+ showArrow: false
490
+ }, function (setOpen) {
491
+ return /*#__PURE__*/React.createElement(Select, {
492
+ style: {
493
+ minWidth: "fit-content",
494
+ display: "flex",
495
+ flexDirection: "row",
496
+ alignItems: "center",
497
+ justifyContent: "center",
498
+ gap: 4
499
+ }
500
+ }, items_2.map(function (_a) {
501
+ var _b;
502
+ var title = _a.title;
503
+ return /*#__PURE__*/React.createElement(IconButton, {
504
+ key: title,
505
+ isActive: ((_b = _.find(items_2, function (item) {
506
+ return "".concat(item.value) === "".concat(cell === null || cell === void 0 ? void 0 : cell.vt);
507
+ })) === null || _b === void 0 ? void 0 : _b.title) === title,
508
+ icon: getLucideIcon(title),
509
+ variant: "ghost",
510
+ onClick: function onClick() {
511
+ setContext(function (ctx) {
512
+ handleVerticalAlign(ctx, refs.cellInput.current, title.replace("align-", ""));
513
+ });
514
+ setOpen(false);
515
+ },
516
+ tabIndex: 0
517
+ });
518
+ }));
519
+ });
520
+ }
521
+ if (name === "undo") {
522
+ return /*#__PURE__*/React.createElement(Button, {
523
+ iconId: name,
524
+ tooltip: tooltip,
525
+ key: name,
526
+ disabled: refs.globalCache.undoList.length === 0,
527
+ onClick: function onClick() {
528
+ return handleUndo();
529
+ }
530
+ });
531
+ }
532
+ if (name === "redo") {
533
+ return /*#__PURE__*/React.createElement(Button, {
534
+ iconId: name,
535
+ tooltip: tooltip,
536
+ key: name,
537
+ disabled: refs.globalCache.redoList.length === 0,
538
+ onClick: function onClick() {
539
+ return handleRedo();
540
+ }
541
+ });
542
+ }
543
+ if (name === "screenshot") {
544
+ return /*#__PURE__*/React.createElement(Button, {
545
+ iconId: name,
546
+ tooltip: tooltip,
547
+ key: name,
548
+ onClick: function onClick() {
549
+ var imgsrc = handleScreenShot(contextRef.current);
550
+ if (imgsrc) {
551
+ showDialog(/*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, screenshot.screenshotTipSuccess), /*#__PURE__*/React.createElement("img", {
552
+ src: imgsrc,
553
+ alt: "",
554
+ style: {
555
+ maxWidth: "100%",
556
+ maxHeight: "100%"
557
+ }
558
+ })));
559
+ }
560
+ }
561
+ });
562
+ }
563
+ if (name === "splitColumn") {
564
+ return /*#__PURE__*/React.createElement(Button, {
565
+ iconId: name,
566
+ tooltip: tooltip,
567
+ key: name,
568
+ onClick: function onClick() {
569
+ if (context.allowEdit === false) return;
570
+ if (_.isUndefined(context.luckysheet_select_save)) {
571
+ showDialog(splitText.tipNoSelect, "ok");
572
+ } else {
573
+ var currentColumn = context.luckysheet_select_save[context.luckysheet_select_save.length - 1].column;
574
+ if (context.luckysheet_select_save.length > 1) {
575
+ showDialog(splitText.tipNoMulti, "ok");
576
+ } else if (currentColumn[0] !== currentColumn[1]) {
577
+ showDialog(splitText.tipNoMultiColumn, "ok");
578
+ } else {
579
+ showDialog(/*#__PURE__*/React.createElement(SplitColumn, null));
580
+ }
581
+ }
582
+ }
583
+ });
584
+ }
585
+ if (name === "dataVerification") {
586
+ return /*#__PURE__*/React.createElement(Button, {
587
+ iconId: name,
588
+ tooltip: tooltip,
589
+ key: name,
590
+ onClick: function onClick() {
591
+ if (context.allowEdit === false) return;
592
+ showDialog(/*#__PURE__*/React.createElement(DataVerification, null), undefined, toolbar.dataVerification);
593
+ }
594
+ });
595
+ }
596
+ if (name === "locationCondition") {
597
+ var items_3 = [{
598
+ text: findAndReplace.location,
599
+ value: "location"
600
+ }, {
601
+ text: findAndReplace.locationFormula,
602
+ value: "locationFormula"
603
+ }, {
604
+ text: findAndReplace.locationDate,
605
+ value: "locationDate"
606
+ }, {
607
+ text: findAndReplace.locationDigital,
608
+ value: "locationDigital"
609
+ }, {
610
+ text: findAndReplace.locationString,
611
+ value: "locationString"
612
+ }, {
613
+ text: findAndReplace.locationError,
614
+ value: "locationError"
615
+ }, {
616
+ text: findAndReplace.locationRowSpan,
617
+ value: "locationRowSpan"
618
+ }, {
619
+ text: findAndReplace.columnSpan,
620
+ value: "locationColumnSpan"
621
+ }];
622
+ return /*#__PURE__*/React.createElement(Combo, {
623
+ iconId: "locationCondition",
624
+ key: name,
625
+ tooltip: findAndReplace.location,
626
+ showArrow: false
627
+ }, function (setOpen) {
628
+ return /*#__PURE__*/React.createElement(Select, null, items_3.map(function (_a) {
629
+ var text = _a.text,
630
+ value = _a.value;
631
+ return /*#__PURE__*/React.createElement(Option, {
632
+ key: value,
633
+ onClick: function onClick() {
634
+ var _a, _b, _c, _d, _e, _f;
635
+ if (context.luckysheet_select_save == null) {
636
+ showDialog(freezen.noSelectionError, "ok");
637
+ return;
638
+ }
639
+ var last = context.luckysheet_select_save[0];
640
+ var range;
641
+ var rangeArr = [];
642
+ 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]) {
643
+ range = [{
644
+ row: [0, flowdata.length - 1],
645
+ column: [0, flowdata[0].length - 1]
646
+ }];
647
+ } else {
648
+ range = _.assignIn([], context.luckysheet_select_save);
649
+ }
650
+ if (value === "location") {
651
+ showDialog(/*#__PURE__*/React.createElement(LocationCondition, null));
652
+ } else if (value === "locationFormula") {
653
+ setContext(function (ctx) {
654
+ rangeArr = applyLocation(range, "locationFormula", "all", ctx);
655
+ });
656
+ } else if (value === "locationDate") {
657
+ setContext(function (ctx) {
658
+ rangeArr = applyLocation(range, "locationConstant", "d", ctx);
659
+ });
660
+ } else if (value === "locationDigital") {
661
+ setContext(function (ctx) {
662
+ rangeArr = applyLocation(range, "locationConstant", "n", ctx);
663
+ });
664
+ } else if (value === "locationString") {
665
+ setContext(function (ctx) {
666
+ rangeArr = applyLocation(range, "locationConstant", "s,g", ctx);
667
+ });
668
+ } else if (value === "locationError") {
669
+ setContext(function (ctx) {
670
+ rangeArr = applyLocation(range, "locationConstant", "e", ctx);
671
+ });
672
+ } else if (value === "locationCondition") {
673
+ setContext(function (ctx) {
674
+ rangeArr = applyLocation(range, "locationCF", undefined, ctx);
675
+ });
676
+ } else if (value === "locationRowSpan") {
677
+ 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]) {
678
+ showDialog(findAndReplace.locationTiplessTwoRow, "ok");
679
+ return;
680
+ }
681
+ range = _.assignIn([], context.luckysheet_select_save);
682
+ setContext(function (ctx) {
683
+ rangeArr = applyLocation(range, "locationRowSpan", undefined, ctx);
684
+ });
685
+ } else if (value === "locationColumnSpan") {
686
+ 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]) {
687
+ showDialog(findAndReplace.locationTiplessTwoColumn, "ok");
688
+ return;
689
+ }
690
+ range = _.assignIn([], context.luckysheet_select_save);
691
+ setContext(function (ctx) {
692
+ rangeArr = applyLocation(range, "locationColumnSpan", undefined, ctx);
693
+ });
694
+ }
695
+ if (rangeArr.length === 0 && value !== "location") showDialog(findAndReplace.locationTipNotFindCell, "ok");
696
+ setOpen(false);
697
+ }
698
+ }, /*#__PURE__*/React.createElement("div", {
699
+ className: "fortune-toolbar-menu-line"
700
+ }, text));
701
+ }));
702
+ });
703
+ }
704
+ if (name === "conditionFormat") {
705
+ var items_4 = ["highlightCellRules", "itemSelectionRules", "-", "deleteRule"];
706
+ return /*#__PURE__*/React.createElement(Combo, {
707
+ iconId: "conditionFormat",
708
+ key: name,
709
+ tooltip: toolbar.conditionalFormat,
710
+ showArrow: false
711
+ }, function (setOpen) {
712
+ return /*#__PURE__*/React.createElement(ConditionalFormat, {
713
+ items: items_4,
714
+ setOpen: setOpen
715
+ });
716
+ });
717
+ }
718
+ if (name === "image") {
719
+ return /*#__PURE__*/React.createElement(Button, {
720
+ iconId: name,
721
+ tooltip: toolbar.insertImage,
722
+ key: name,
723
+ onClick: function onClick() {
724
+ if (context.allowEdit === false) return;
725
+ showImgChooser();
726
+ }
727
+ }, /*#__PURE__*/React.createElement("input", {
728
+ id: "fortune-img-upload",
729
+ type: "file",
730
+ accept: "image/*",
731
+ style: {
732
+ display: "none"
733
+ },
734
+ onChange: function onChange(e) {
735
+ var _a;
736
+ var file = (_a = e.currentTarget.files) === null || _a === void 0 ? void 0 : _a[0];
737
+ if (!file) return;
738
+ var render = new FileReader();
739
+ render.readAsDataURL(file);
740
+ render.onload = function (event) {
741
+ var _a;
742
+ if (event.target == null) return;
743
+ var src = (_a = event.target) === null || _a === void 0 ? void 0 : _a.result;
744
+ var image = new Image();
745
+ image.onload = function () {
746
+ setContext(function (draftCtx) {
747
+ insertImage(draftCtx, image);
748
+ });
749
+ };
750
+ image.src = src;
751
+ };
752
+ e.currentTarget.value = "";
753
+ }
754
+ }));
755
+ }
756
+ if (name === "comment") {
757
+ var last = (_c = context.luckysheet_select_save) === null || _c === void 0 ? void 0 : _c[context.luckysheet_select_save.length - 1];
758
+ var row_index_1 = last === null || last === void 0 ? void 0 : last.row_focus;
759
+ var col_index_1 = last === null || last === void 0 ? void 0 : last.column_focus;
760
+ if (!last) {
761
+ row_index_1 = 0;
762
+ col_index_1 = 0;
763
+ } else {
764
+ if (row_index_1 == null) {
765
+ row_index_1 = last.row[0];
766
+ }
767
+ if (col_index_1 == null) {
768
+ col_index_1 = last.column[0];
769
+ }
770
+ }
771
+ var itemData_1;
772
+ 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) {
773
+ itemData_1 = [{
774
+ key: "edit",
775
+ text: comment.edit,
776
+ onClick: editComment
777
+ }, {
778
+ key: "delete",
779
+ text: comment.delete,
780
+ onClick: deleteComment
781
+ }, {
782
+ key: "showOrHide",
783
+ text: comment.showOne,
784
+ onClick: showHideComment
785
+ }, {
786
+ key: "showOrHideAll",
787
+ text: comment.showAll,
788
+ onClick: showHideAllComments
789
+ }];
790
+ } else {
791
+ itemData_1 = [{
792
+ key: "new",
793
+ text: comment.insert,
794
+ onClick: newComment
795
+ }, {
796
+ key: "showOrHideAll",
797
+ text: comment.showAll,
798
+ onClick: showHideAllComments
799
+ }];
800
+ }
801
+ return /*#__PURE__*/React.createElement(Combo, {
802
+ iconId: name,
803
+ key: name,
804
+ tooltip: tooltip,
805
+ showArrow: false
806
+ }, function (setOpen) {
807
+ return /*#__PURE__*/React.createElement(Select, null, itemData_1.map(function (_a) {
808
+ var key = _a.key,
809
+ text = _a.text,
810
+ _onClick = _a.onClick;
811
+ return /*#__PURE__*/React.createElement(Option, {
812
+ key: key,
813
+ onClick: function onClick() {
814
+ setContext(function (draftContext) {
815
+ return _onClick(draftContext, refs.globalCache, row_index_1, col_index_1);
816
+ });
817
+ setOpen(false);
818
+ }
819
+ }, text);
820
+ }));
821
+ });
822
+ }
823
+ if (name === "quick-formula") {
824
+ var itemData_2 = [{
825
+ text: formula.sum,
826
+ value: "SUM"
827
+ }, {
828
+ text: formula.average,
829
+ value: "AVERAGE"
830
+ }, {
831
+ text: formula.count,
832
+ value: "COUNT"
833
+ }, {
834
+ text: formula.max,
835
+ value: "MAX"
836
+ }, {
837
+ text: formula.min,
838
+ value: "MIN"
839
+ }];
840
+ return /*#__PURE__*/React.createElement(Combo, {
841
+ iconId: "formula-sum",
842
+ key: name,
843
+ tooltip: toolbar.autoSum,
844
+ showArrow: false,
845
+ onClick: function onClick() {
846
+ return setContext(function (ctx) {
847
+ handleSum(ctx, refs.cellInput.current, refs.fxInput.current, refs.globalCache);
848
+ });
849
+ }
850
+ }, function (setOpen) {
851
+ return /*#__PURE__*/React.createElement(Select, null, itemData_2.map(function (_a) {
852
+ var value = _a.value,
853
+ text = _a.text;
854
+ return /*#__PURE__*/React.createElement(Option, {
855
+ key: value,
856
+ onClick: function onClick() {
857
+ setContext(function (ctx) {
858
+ autoSelectionFormula(ctx, refs.cellInput.current, refs.fxInput.current, value, refs.globalCache);
859
+ });
860
+ setOpen(false);
861
+ }
862
+ }, /*#__PURE__*/React.createElement("div", {
863
+ className: "fortune-toolbar-menu-line"
864
+ }, /*#__PURE__*/React.createElement("div", null, text), /*#__PURE__*/React.createElement("div", {
865
+ className: "fortune-toolbar-subtext"
866
+ }, value)));
867
+ }), /*#__PURE__*/React.createElement(MenuDivider, null), /*#__PURE__*/React.createElement(Option, {
868
+ key: "formula",
869
+ onClick: function onClick() {
870
+ var button = document.getElementById("function-button");
871
+ if (button) {
872
+ button.click();
873
+ }
874
+ setOpen(false);
875
+ }
876
+ }, "".concat(formula.find, "...")));
877
+ });
878
+ }
879
+ if (name === "merge-cell") {
880
+ var itemdata_1 = [{
881
+ text: merge.mergeAll,
882
+ value: "merge-all",
883
+ icon: "MergeAll"
884
+ }, {
885
+ text: merge.mergeV,
886
+ value: "merge-vertical",
887
+ icon: "MergeVertical"
888
+ }, {
889
+ text: merge.mergeH,
890
+ value: "merge-horizontal",
891
+ icon: "MergeHorizontal"
892
+ }, {
893
+ text: merge.mergeCancel,
894
+ value: "merge-cancel",
895
+ icon: "Unmerge"
896
+ }];
897
+ return /*#__PURE__*/React.createElement(Combo, {
898
+ iconId: "merge-all",
899
+ key: name,
900
+ tooltip: tooltip,
901
+ text: "\u5408\u5E76\u5355\u5143\u683C",
902
+ onClick: function onClick() {
903
+ return setContext(function (ctx) {
904
+ handleMerge(ctx, "merge-all");
905
+ });
906
+ }
907
+ }, function (setOpen) {
908
+ return /*#__PURE__*/React.createElement(Select, null, itemdata_1.map(function (_a) {
909
+ var text = _a.text,
910
+ value = _a.value,
911
+ icon = _a.icon;
912
+ return /*#__PURE__*/React.createElement(Option, {
913
+ key: value,
914
+ onClick: function onClick() {
915
+ setContext(function (ctx) {
916
+ handleMerge(ctx, value);
917
+ });
918
+ setOpen(false);
919
+ }
920
+ }, /*#__PURE__*/React.createElement("div", {
921
+ style: {
922
+ display: "flex",
923
+ alignItems: "center",
924
+ gap: 6
925
+ }
926
+ }, /*#__PURE__*/React.createElement(LucideIcon, {
927
+ name: icon,
928
+ width: 16,
929
+ height: 16
930
+ }), text));
931
+ }));
932
+ });
933
+ }
934
+ if (name === "border") {
935
+ var items_5 = [{
936
+ text: border.borderTop,
937
+ value: "border-top",
938
+ icon: "BorderTop"
939
+ }, {
940
+ text: border.borderBottom,
941
+ value: "border-bottom",
942
+ icon: "BorderBottom"
943
+ }, {
944
+ text: border.borderLeft,
945
+ value: "border-left",
946
+ icon: "BorderLeft"
947
+ }, {
948
+ text: border.borderRight,
949
+ value: "border-right",
950
+ icon: "BorderRight"
951
+ }, {
952
+ text: border.borderNone,
953
+ value: "border-none",
954
+ icon: "NoBorder"
955
+ }, {
956
+ text: border.borderAll,
957
+ value: "border-all",
958
+ icon: "Border"
959
+ }, {
960
+ text: border.borderOutside,
961
+ value: "border-outside",
962
+ icon: "BorderOutside"
963
+ }, {
964
+ text: border.borderInside,
965
+ value: "border-inside",
966
+ icon: "BorderInside"
967
+ }, {
968
+ text: border.borderHorizontal,
969
+ value: "border-horizontal",
970
+ icon: "BorderHorizontal"
971
+ }, {
972
+ text: border.borderVertical,
973
+ value: "border-vertical",
974
+ icon: "BorderVertical"
975
+ }];
976
+ return /*#__PURE__*/React.createElement(Combo, {
977
+ iconId: "border-all",
978
+ key: name,
979
+ tooltip: tooltip,
980
+ text: "\u8FB9\u6846\u8BBE\u7F6E",
981
+ showArrow: false,
982
+ onClick: function onClick() {
983
+ return setContext(function (ctx) {
984
+ handleBorder(ctx, "border-all", customColor, customStyle);
985
+ });
986
+ }
987
+ }, function (setOpen) {
988
+ return /*#__PURE__*/React.createElement("div", {
989
+ className: "fortune-toolbar-select fortune-border-grid"
990
+ }, items_5.map(function (_a) {
991
+ var value = _a.value,
992
+ icon = _a.icon;
993
+ return /*#__PURE__*/React.createElement("div", {
994
+ key: value,
995
+ className: "fortune-border-grid-item",
996
+ onClick: function onClick() {
997
+ setContext(function (ctx) {
998
+ handleBorder(ctx, value, customColor, customStyle);
999
+ });
1000
+ setOpen(false);
1001
+ }
1002
+ }, /*#__PURE__*/React.createElement(LucideIcon, {
1003
+ name: icon,
1004
+ width: 16,
1005
+ height: 16
1006
+ }));
1007
+ }));
1008
+ });
1009
+ }
1010
+ if (name === "freeze") {
1011
+ var items_6 = [{
1012
+ text: freezen.freezenRowRange,
1013
+ value: "freeze-row"
1014
+ }, {
1015
+ text: freezen.freezenColumnRange,
1016
+ value: "freeze-col"
1017
+ }, {
1018
+ text: freezen.freezenRCRange,
1019
+ value: "freeze-row-col"
1020
+ }, {
1021
+ text: freezen.freezenCancel,
1022
+ value: "freeze-cancel"
1023
+ }];
1024
+ return /*#__PURE__*/React.createElement(Combo, {
1025
+ iconId: "freeze-row-col",
1026
+ key: name,
1027
+ tooltip: tooltip,
1028
+ showArrow: false,
1029
+ onClick: function onClick() {
1030
+ return setContext(function (ctx) {
1031
+ handleFreeze(ctx, "freeze-row-col");
1032
+ });
1033
+ }
1034
+ }, function (setOpen) {
1035
+ return /*#__PURE__*/React.createElement(Select, null, items_6.map(function (_a) {
1036
+ var text = _a.text,
1037
+ value = _a.value;
1038
+ return /*#__PURE__*/React.createElement(Option, {
1039
+ key: value,
1040
+ onClick: function onClick() {
1041
+ setContext(function (ctx) {
1042
+ handleFreeze(ctx, value);
1043
+ });
1044
+ setOpen(false);
1045
+ }
1046
+ }, /*#__PURE__*/React.createElement("div", {
1047
+ className: "fortune-toolbar-menu-line"
1048
+ }, text, /*#__PURE__*/React.createElement(SVGIcon, {
1049
+ name: value,
1050
+ width: 16,
1051
+ height: 16
1052
+ })));
1053
+ }));
1054
+ });
1055
+ }
1056
+ if (name === "text-wrap") {
1057
+ var items_7 = [{
1058
+ text: textWrap.clip,
1059
+ iconId: "text-clip",
1060
+ value: "clip"
1061
+ }, {
1062
+ text: textWrap.overflow,
1063
+ iconId: "text-overflow",
1064
+ value: "overflow"
1065
+ }, {
1066
+ text: textWrap.wrap,
1067
+ iconId: "text-wrap",
1068
+ value: "wrap"
1069
+ }];
1070
+ var curr_2 = items_7[0];
1071
+ if ((cell === null || cell === void 0 ? void 0 : cell.tb) != null) {
1072
+ curr_2 = _.get(items_7, cell.tb);
1073
+ }
1074
+ return /*#__PURE__*/React.createElement(Combo, {
1075
+ iconId: curr_2.iconId,
1076
+ key: name,
1077
+ tooltip: toolbar.textWrap,
1078
+ showArrow: false
1079
+ }, function (setOpen) {
1080
+ return /*#__PURE__*/React.createElement(Select, {
1081
+ style: {
1082
+ minWidth: "fit-content",
1083
+ display: "flex",
1084
+ flexDirection: "row",
1085
+ alignItems: "center",
1086
+ justifyContent: "center",
1087
+ gap: 4
1088
+ }
1089
+ }, items_7.map(function (_a) {
1090
+ var iconId = _a.iconId,
1091
+ value = _a.value;
1092
+ return /*#__PURE__*/React.createElement(IconButton, {
1093
+ key: value,
1094
+ isActive: curr_2.value === value,
1095
+ icon: getLucideIcon(iconId),
1096
+ variant: "ghost",
1097
+ onClick: function onClick() {
1098
+ setContext(function (ctx) {
1099
+ var d = getFlowdata(ctx);
1100
+ if (d == null) return;
1101
+ updateFormat(ctx, refs.cellInput.current, d, "tb", value);
1102
+ });
1103
+ setOpen(false);
1104
+ },
1105
+ tabIndex: 0
1106
+ });
1107
+ }));
1108
+ });
1109
+ }
1110
+ if (name === "text-rotation") {
1111
+ var items_8 = [{
1112
+ text: rotation.none,
1113
+ iconId: "text-rotation-none",
1114
+ value: "none"
1115
+ }, {
1116
+ text: rotation.angleup,
1117
+ iconId: "text-rotation-angleup",
1118
+ value: "angleup"
1119
+ }, {
1120
+ text: rotation.angledown,
1121
+ iconId: "text-rotation-angledown",
1122
+ value: "angledown"
1123
+ }, {
1124
+ text: rotation.vertical,
1125
+ iconId: "text-rotation-vertical",
1126
+ value: "vertical"
1127
+ }, {
1128
+ text: rotation.rotationUp,
1129
+ iconId: "text-rotation-up",
1130
+ value: "rotation-up"
1131
+ }, {
1132
+ text: rotation.rotationDown,
1133
+ iconId: "text-rotation-down",
1134
+ value: "rotation-down"
1135
+ }];
1136
+ var curr = items_8[0];
1137
+ if ((cell === null || cell === void 0 ? void 0 : cell.tr) != null) {
1138
+ curr = _.get(items_8, cell.tr);
1139
+ }
1140
+ return /*#__PURE__*/React.createElement(Combo, {
1141
+ iconId: curr.iconId,
1142
+ key: name,
1143
+ tooltip: toolbar.textRotate,
1144
+ showArrow: false
1145
+ }, function (setOpen) {
1146
+ return /*#__PURE__*/React.createElement(Select, null, items_8.map(function (_a) {
1147
+ var text = _a.text,
1148
+ iconId = _a.iconId,
1149
+ value = _a.value;
1150
+ return /*#__PURE__*/React.createElement(Option, {
1151
+ key: value,
1152
+ onClick: function onClick() {
1153
+ setContext(function (ctx) {
1154
+ var d = getFlowdata(ctx);
1155
+ if (d == null) return;
1156
+ updateFormat(ctx, refs.cellInput.current, d, "tr", value);
1157
+ });
1158
+ setOpen(false);
1159
+ }
1160
+ }, /*#__PURE__*/React.createElement("div", {
1161
+ className: "fortune-toolbar-menu-line"
1162
+ }, text, /*#__PURE__*/React.createElement(SVGIcon, {
1163
+ name: iconId,
1164
+ width: 16,
1165
+ height: 16
1166
+ })));
1167
+ }));
1168
+ });
1169
+ }
1170
+ if (name === "filter") {
1171
+ var items_9 = [{
1172
+ iconId: "sort-asc",
1173
+ value: "sort-asc",
1174
+ text: sort.asc,
1175
+ onClick: function onClick() {
1176
+ setContext(function (ctx) {
1177
+ handleSort(ctx, true);
1178
+ });
1179
+ }
1180
+ }, {
1181
+ iconId: "sort-desc",
1182
+ value: "sort-desc",
1183
+ text: sort.desc,
1184
+ onClick: function onClick() {
1185
+ setContext(function (ctx) {
1186
+ handleSort(ctx, false);
1187
+ });
1188
+ }
1189
+ }, {
1190
+ iconId: "",
1191
+ value: "divider"
1192
+ }, {
1193
+ iconId: "filter1",
1194
+ value: "filter",
1195
+ text: filter.filter,
1196
+ onClick: function onClick() {
1197
+ return setContext(function (draftCtx) {
1198
+ createFilter(draftCtx);
1199
+ });
1200
+ }
1201
+ }, {
1202
+ iconId: "eraser",
1203
+ value: "eraser",
1204
+ text: filter.clearFilter,
1205
+ onClick: function onClick() {
1206
+ return setContext(function (draftCtx) {
1207
+ clearFilter(draftCtx);
1208
+ });
1209
+ }
1210
+ }];
1211
+ return /*#__PURE__*/React.createElement(Combo, {
1212
+ iconId: "filter",
1213
+ key: name,
1214
+ tooltip: toolbar.sortAndFilter,
1215
+ showArrow: false
1216
+ }, function (setOpen) {
1217
+ return /*#__PURE__*/React.createElement(Select, {
1218
+ style: {
1219
+ minWidth: "11.25rem"
1220
+ }
1221
+ }, items_9.map(function (_a, index) {
1222
+ var text = _a.text,
1223
+ iconId = _a.iconId,
1224
+ value = _a.value,
1225
+ _onClick2 = _a.onClick;
1226
+ return value !== "divider" ? (/*#__PURE__*/React.createElement(Option, {
1227
+ key: value,
1228
+ onClick: function onClick() {
1229
+ _onClick2 === null || _onClick2 === void 0 ? void 0 : _onClick2();
1230
+ setOpen(false);
1231
+ }
1232
+ }, /*#__PURE__*/React.createElement("div", {
1233
+ className: "fortune-toolbar-menu-line gap-1",
1234
+ style: {
1235
+ justifyContent: "start"
1236
+ }
1237
+ }, /*#__PURE__*/React.createElement(SVGIcon, {
1238
+ name: iconId,
1239
+ width: 16,
1240
+ height: 16
1241
+ }), text))) : (/*#__PURE__*/React.createElement(MenuDivider, {
1242
+ key: "divider-".concat(index)
1243
+ }));
1244
+ }));
1245
+ });
1246
+ }
1247
+ return /*#__PURE__*/React.createElement(Tooltip, {
1248
+ text: tooltip,
1249
+ placement: "bottom"
1250
+ }, /*#__PURE__*/React.createElement(Button, {
1251
+ iconId: name,
1252
+ tooltip: tooltip,
1253
+ key: name,
1254
+ selected: (_f = toolbarItemSelectedFunc(name)) === null || _f === void 0 ? void 0 : _f(cell),
1255
+ onClick: function onClick() {
1256
+ return setContext(function (draftCtx) {
1257
+ var _a;
1258
+ (_a = toolbarItemClickHandler(name)) === null || _a === void 0 ? void 0 : _a(draftCtx, refs.cellInput.current, refs.globalCache);
1259
+ });
1260
+ }
1261
+ }));
1262
+ }, [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]);
1263
+ return /*#__PURE__*/React.createElement("div", {
1264
+ ref: containerRef,
1265
+ className: "fortune-toolbar",
1266
+ "aria-label": toolbar.toolbar
1267
+ }, /*#__PURE__*/React.createElement("div", {
1268
+ className: "fortune-toolbar-left"
1269
+ }, settings.customToolbarItems.filter(function (n) {
1270
+ return n.key === "import-export";
1271
+ }).map(function (n) {
1272
+ return /*#__PURE__*/React.createElement(CustomButton, {
1273
+ tooltip: n.tooltip,
1274
+ onClick: n.onClick,
1275
+ key: n.key,
1276
+ icon: n.icon,
1277
+ iconName: n.iconName
1278
+ }, n.children);
1279
+ }), ((_d = settings.customToolbarItems) === null || _d === void 0 ? void 0 : _d.length) > 0 ? (/*#__PURE__*/React.createElement(Divider, {
1280
+ key: "customDivider"
1281
+ })) : null, (toolbarWrapIndex === -1 || isDesktop ? settings.toolbarItems : settings.toolbarItems.slice(0, toolbarWrapIndex + 1)).map(function (name, i) {
1282
+ return getToolbarItem(name, i);
1283
+ }), !isDesktop && toolbarWrapIndex !== -1 && toolbarWrapIndex < settings.toolbarItems.length - 1 ? (/*#__PURE__*/React.createElement(Button, {
1284
+ iconId: "Ellipsis",
1285
+ tooltip: toolbar.toolMore,
1286
+ onClick: function onClick() {
1287
+ if (moreItemsOpen) {
1288
+ setMoreItems(null);
1289
+ } else {
1290
+ setMoreItems(settings.toolbarItems.slice(toolbarWrapIndex + 1).map(function (name, i) {
1291
+ return getToolbarItem(name, i);
1292
+ }));
1293
+ }
1294
+ }
1295
+ })) : null, moreToolbarItems && (/*#__PURE__*/React.createElement(MoreItemsContaier, {
1296
+ onClose: onMoreToolbarItemsClose
1297
+ }, moreToolbarItems))), /*#__PURE__*/React.createElement("div", {
1298
+ className: "fortune-toolbar-right"
1299
+ }, settings.customToolbarItems.length > 0 && (/*#__PURE__*/React.createElement(Button, {
1300
+ iconId: "dune",
1301
+ tooltip: "Insert Dune Chart",
1302
+ key: "dune-charts",
1303
+ onClick: function onClick() {
1304
+ if (context.allowEdit === false) return;
1305
+ setShowDuneModal(true);
1306
+ },
1307
+ style: {
1308
+ backgroundColor: "#F4603E2E",
1309
+ borderRadius: "8px"
1310
+ }
1311
+ })), settings.customToolbarItems.filter(function (n) {
1312
+ return n.key !== "import-export";
1313
+ }).map(function (n) {
1314
+ return /*#__PURE__*/React.createElement(CustomButton, {
1315
+ tooltip: n.tooltip,
1316
+ onClick: n.onClick,
1317
+ key: n.key,
1318
+ icon: n.icon,
1319
+ iconName: n.iconName
1320
+ }, n.children);
1321
+ }), showDuneModal && (/*#__PURE__*/React.createElement(DuneChartsInputModal, {
1322
+ isOpen: showDuneModal,
1323
+ onSubmit: function onSubmit(url) {
1324
+ var _a;
1325
+ setContext(function (draftCtx) {
1326
+ insertDuneChart(draftCtx, url);
1327
+ });
1328
+ setShowDuneModal(false);
1329
+ (_a = settings.onDuneChartEmbed) === null || _a === void 0 ? void 0 : _a.call(settings);
1330
+ },
1331
+ onClose: function onClose() {
1332
+ return setShowDuneModal(false);
1333
+ },
1334
+ placeholder: "Paste here any Dune chart link for some magic",
1335
+ submitText: "Add Dune chart"
1336
+ }))));
1337
+ };
1338
+ export default Toolbar;