@fileverse-dev/fortune-react 1.0.26-patch-1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (422) hide show
  1. package/dist/index.css +3915 -0
  2. package/dist/index.esm.css +3915 -0
  3. package/dist/index.esm.js +12975 -0
  4. package/dist/index.js +12995 -0
  5. package/dist/index.umd.css +3915 -0
  6. package/dist/index.umd.js +122445 -0
  7. package/dist/index.umd.min.css +1 -0
  8. package/dist/index.umd.min.js +50 -0
  9. package/dist/packages/core/src/api/cell.d.ts +10 -0
  10. package/dist/packages/core/src/api/common.d.ts +66 -0
  11. package/dist/packages/core/src/api/errors.d.ts +2 -0
  12. package/dist/packages/core/src/api/index.d.ts +9 -0
  13. package/dist/packages/core/src/api/merge.d.ts +5 -0
  14. package/dist/packages/core/src/api/range.d.ts +22 -0
  15. package/dist/packages/core/src/api/rowcol.d.ts +14 -0
  16. package/dist/packages/core/src/api/sheet.d.ts +10 -0
  17. package/dist/packages/core/src/api/workbook.d.ts +15 -0
  18. package/dist/packages/core/src/canvas.d.ts +46 -0
  19. package/dist/packages/core/src/context.d.ts +197 -0
  20. package/dist/packages/core/src/events/copy.d.ts +2 -0
  21. package/dist/packages/core/src/events/index.d.ts +4 -0
  22. package/dist/packages/core/src/events/keyboard.d.ts +6 -0
  23. package/dist/packages/core/src/events/mouse.d.ts +22 -0
  24. package/dist/packages/core/src/events/paste.d.ts +3 -0
  25. package/dist/packages/core/src/index.d.ts +10 -0
  26. package/dist/packages/core/src/locale/en.d.ts +992 -0
  27. package/dist/packages/core/src/locale/es.d.ts +1134 -0
  28. package/dist/packages/core/src/locale/hi.d.ts +1030 -0
  29. package/dist/packages/core/src/locale/index.d.ts +1049 -0
  30. package/dist/packages/core/src/locale/zh.d.ts +1048 -0
  31. package/dist/packages/core/src/locale/zh_tw.d.ts +1187 -0
  32. package/dist/packages/core/src/modules/ConditionFormat.d.ts +17 -0
  33. package/dist/packages/core/src/modules/border.d.ts +3 -0
  34. package/dist/packages/core/src/modules/cell.d.ts +32 -0
  35. package/dist/packages/core/src/modules/clipboard.d.ts +3 -0
  36. package/dist/packages/core/src/modules/color.d.ts +1 -0
  37. package/dist/packages/core/src/modules/comment.d.ts +97 -0
  38. package/dist/packages/core/src/modules/conditionalFormat.d.ts +2 -0
  39. package/dist/packages/core/src/modules/cursor.d.ts +3 -0
  40. package/dist/packages/core/src/modules/dataVerification.d.ts +11 -0
  41. package/dist/packages/core/src/modules/dropCell.d.ts +10 -0
  42. package/dist/packages/core/src/modules/filter.d.ts +45 -0
  43. package/dist/packages/core/src/modules/format.d.ts +6 -0
  44. package/dist/packages/core/src/modules/formula.d.ts +54 -0
  45. package/dist/packages/core/src/modules/freeze.d.ts +5 -0
  46. package/dist/packages/core/src/modules/hyperlink.d.ts +21 -0
  47. package/dist/packages/core/src/modules/iframe.d.ts +12 -0
  48. package/dist/packages/core/src/modules/image.d.ts +31 -0
  49. package/dist/packages/core/src/modules/index.d.ts +36 -0
  50. package/dist/packages/core/src/modules/inline-string.d.ts +36 -0
  51. package/dist/packages/core/src/modules/location.d.ts +6 -0
  52. package/dist/packages/core/src/modules/locationCondition.d.ts +21 -0
  53. package/dist/packages/core/src/modules/merge.d.ts +3 -0
  54. package/dist/packages/core/src/modules/mobile.d.ts +5 -0
  55. package/dist/packages/core/src/modules/moveCells.d.ts +5 -0
  56. package/dist/packages/core/src/modules/protection.d.ts +5 -0
  57. package/dist/packages/core/src/modules/refresh.d.ts +3 -0
  58. package/dist/packages/core/src/modules/rowcol.d.ts +19 -0
  59. package/dist/packages/core/src/modules/screenshot.d.ts +2 -0
  60. package/dist/packages/core/src/modules/searchReplace.d.ts +36 -0
  61. package/dist/packages/core/src/modules/selection.d.ts +46 -0
  62. package/dist/packages/core/src/modules/sheet.d.ts +10 -0
  63. package/dist/packages/core/src/modules/sort.d.ts +7 -0
  64. package/dist/packages/core/src/modules/splitColumn.d.ts +5 -0
  65. package/dist/packages/core/src/modules/text.d.ts +10 -0
  66. package/dist/packages/core/src/modules/toolbar.d.ts +32 -0
  67. package/dist/packages/core/src/modules/validation.d.ts +19 -0
  68. package/dist/packages/core/src/modules/zoom.d.ts +3 -0
  69. package/dist/packages/core/src/settings.d.ts +100 -0
  70. package/dist/packages/core/src/types.d.ts +371 -0
  71. package/dist/packages/core/src/utils/freeze.d.ts +7 -0
  72. package/dist/packages/core/src/utils/index.d.ts +18 -0
  73. package/dist/packages/core/src/utils/patch.d.ts +37 -0
  74. package/{es → dist/packages/react/src}/components/ChangeColor/index.d.ts +7 -7
  75. package/{lib → dist/packages/react/src}/components/ConditionFormat/ConditionRules.d.ts +6 -6
  76. package/{es → dist/packages/react/src}/components/ConditionFormat/index.d.ts +7 -7
  77. package/{es → dist/packages/react/src}/components/ContextMenu/Divider.d.ts +3 -3
  78. package/{lib → dist/packages/react/src}/components/ContextMenu/FilterMenu.d.ts +3 -3
  79. package/{es → dist/packages/react/src}/components/ContextMenu/Menu.d.ts +8 -8
  80. package/{lib → dist/packages/react/src}/components/ContextMenu/SheetTab.d.ts +4 -4
  81. package/{es → dist/packages/react/src}/components/ContextMenu/index.d.ts +5 -5
  82. package/{lib → dist/packages/react/src}/components/CustomSort/index.d.ts +4 -4
  83. package/{es → dist/packages/react/src}/components/DataVerification/DropdownList.d.ts +4 -4
  84. package/{lib → dist/packages/react/src}/components/DataVerification/RangeDialog.d.ts +4 -4
  85. package/{es → dist/packages/react/src}/components/DataVerification/getDisplayedRangeTxt.d.ts +2 -2
  86. package/{lib → dist/packages/react/src}/components/DataVerification/index.d.ts +4 -4
  87. package/{lib → dist/packages/react/src}/components/Dialog/index.d.ts +15 -15
  88. package/{lib → dist/packages/react/src}/components/DuneChartsInputModal/DuneChartsInputModal.d.ts +11 -11
  89. package/{lib → dist/packages/react/src}/components/DunePreview/DunePreview.d.ts +13 -13
  90. package/{es → dist/packages/react/src}/components/FilterOption/index.d.ts +5 -5
  91. package/{es → dist/packages/react/src}/components/FormatSearch/index.d.ts +6 -6
  92. package/{lib → dist/packages/react/src}/components/FormulaSearch/index.d.ts +5 -5
  93. package/{lib → dist/packages/react/src}/components/FxEditor/NameBox.d.ts +3 -3
  94. package/{es → dist/packages/react/src}/components/FxEditor/index.d.ts +4 -4
  95. package/{es → dist/packages/react/src}/components/IFrameBoxs/iFrameBoxs.d.ts +4 -4
  96. package/{lib → dist/packages/react/src}/components/ImgBoxs/index.d.ts +3 -3
  97. package/{es → dist/packages/react/src}/components/LinkEidtCard/index.d.ts +5 -5
  98. package/{lib → dist/packages/react/src}/components/LocationCondition/index.d.ts +3 -3
  99. package/{lib → dist/packages/react/src}/components/MessageBox/index.d.ts +9 -9
  100. package/{es → dist/packages/react/src}/components/NotationBoxes/index.d.ts +3 -3
  101. package/{lib → dist/packages/react/src}/components/ResetColumnWidth/index.d.ts +2 -2
  102. package/{es → dist/packages/react/src}/components/SVGDefines.d.ts +5 -5
  103. package/{es → dist/packages/react/src}/components/SVGIcon.d.ts +9 -9
  104. package/{lib → dist/packages/react/src}/components/SearchReplace/index.d.ts +6 -6
  105. package/{es → dist/packages/react/src}/components/Sheet/index.d.ts +8 -8
  106. package/{es → dist/packages/react/src}/components/SheetList/SheetHiddenButton.d.ts +8 -8
  107. package/{lib → dist/packages/react/src}/components/SheetList/SheetListItem.d.ts +9 -9
  108. package/{lib → dist/packages/react/src}/components/SheetList/index.d.ts +4 -4
  109. package/{es → dist/packages/react/src}/components/SheetOverlay/ColumnHeader.d.ts +3 -3
  110. package/{es → dist/packages/react/src}/components/SheetOverlay/ContentEditable.d.ts +11 -11
  111. package/{es → dist/packages/react/src}/components/SheetOverlay/FormulaHint/index.d.ts +4 -4
  112. package/{es → dist/packages/react/src}/components/SheetOverlay/FormulaSearch/constant.d.ts +63 -63
  113. package/{es → dist/packages/react/src}/components/SheetOverlay/FormulaSearch/index.d.ts +4 -4
  114. package/{lib → dist/packages/react/src}/components/SheetOverlay/InputBox.d.ts +3 -3
  115. package/{es → dist/packages/react/src}/components/SheetOverlay/RowHeader.d.ts +3 -3
  116. package/{es → dist/packages/react/src}/components/SheetOverlay/ScrollBar/index.d.ts +7 -7
  117. package/{es → dist/packages/react/src}/components/SheetOverlay/index.d.ts +4 -4
  118. package/{es → dist/packages/react/src}/components/SheetTab/SheetItem.d.ts +8 -8
  119. package/{lib → dist/packages/react/src}/components/SheetTab/index.d.ts +4 -4
  120. package/{es → dist/packages/react/src}/components/SplitColumn/index.d.ts +3 -3
  121. package/{lib → dist/packages/react/src}/components/Toolbar/Button.d.ts +12 -12
  122. package/{es → dist/packages/react/src}/components/Toolbar/ColorPicker.d.ts +6 -6
  123. package/{es → dist/packages/react/src}/components/Toolbar/Combo.d.ts +12 -12
  124. package/{es → dist/packages/react/src}/components/Toolbar/CustomBorder.d.ts +7 -7
  125. package/{lib → dist/packages/react/src}/components/Toolbar/CustomButton.d.ts +11 -11
  126. package/{es → dist/packages/react/src}/components/Toolbar/CustomColor.d.ts +8 -8
  127. package/{lib → dist/packages/react/src}/components/Toolbar/CustomIcon.d.ts +9 -9
  128. package/{es → dist/packages/react/src}/components/Toolbar/Divider.d.ts +4 -4
  129. package/{es → dist/packages/react/src}/components/Toolbar/MoreItemsContainer.d.ts +6 -6
  130. package/{lib → dist/packages/react/src}/components/Toolbar/Select.d.ts +14 -14
  131. package/dist/packages/react/src/components/Toolbar/index.d.ts +10 -0
  132. package/{es → dist/packages/react/src}/components/Workbook/api.d.ts +1177 -1183
  133. package/{lib → dist/packages/react/src}/components/Workbook/index.d.ts +1185 -1191
  134. package/{es → dist/packages/react/src}/components/ZoomControl/index.d.ts +4 -4
  135. package/{es → dist/packages/react/src}/components/index.d.ts +4 -4
  136. package/{es → dist/packages/react/src}/constants.d.ts +1 -1
  137. package/{es → dist/packages/react/src}/context/index.d.ts +25 -25
  138. package/{es → dist/packages/react/src}/context/modal.d.ts +10 -10
  139. package/{es → dist/packages/react/src}/hooks/useAlert.d.ts +4 -4
  140. package/{es → dist/packages/react/src}/hooks/useDialog.d.ts +5 -5
  141. package/{es → dist/packages/react/src}/hooks/useOutsideClick.d.ts +2 -2
  142. package/{es → dist/packages/react/src}/hooks/usePrevious.d.ts +2 -2
  143. package/{es → dist/packages/react/src}/index.d.ts +1 -1
  144. package/{es → dist/packages/react/src}/utils/datepickerStyles.d.ts +2 -2
  145. package/{es/components/Workbook/index.d.ts → dist/stories/API.stories.d.ts} +1210 -1191
  146. package/dist/stories/Collabration.stories.d.ts +2359 -0
  147. package/dist/stories/Features.stories.d.ts +9430 -0
  148. package/dist/stories/data/cell.d.ts +983 -0
  149. package/dist/stories/data/dataVerification.d.ts +131 -0
  150. package/dist/stories/data/empty.d.ts +10 -0
  151. package/dist/stories/data/formula.d.ts +362 -0
  152. package/dist/stories/data/freeze.d.ts +34 -0
  153. package/dist/stories/data/protected.d.ts +40 -0
  154. package/dist/stories/utils.d.ts +1 -0
  155. package/package.json +6 -7
  156. package/es/components/ChangeColor/index.css +0 -76
  157. package/es/components/ChangeColor/index.js +0 -41
  158. package/es/components/ConditionFormat/ConditionRules.d.ts +0 -6
  159. package/es/components/ConditionFormat/ConditionRules.js +0 -323
  160. package/es/components/ConditionFormat/index.css +0 -210
  161. package/es/components/ConditionFormat/index.js +0 -252
  162. package/es/components/ContextMenu/Divider.js +0 -7
  163. package/es/components/ContextMenu/FilterMenu.d.ts +0 -3
  164. package/es/components/ContextMenu/FilterMenu.js +0 -612
  165. package/es/components/ContextMenu/Menu.js +0 -25
  166. package/es/components/ContextMenu/SheetTab.d.ts +0 -4
  167. package/es/components/ContextMenu/SheetTab.js +0 -223
  168. package/es/components/ContextMenu/index.css +0 -322
  169. package/es/components/ContextMenu/index.js +0 -1054
  170. package/es/components/CustomSort/index.css +0 -23
  171. package/es/components/CustomSort/index.d.ts +0 -4
  172. package/es/components/CustomSort/index.js +0 -113
  173. package/es/components/DataVerification/DropdownList.js +0 -126
  174. package/es/components/DataVerification/RangeDialog.d.ts +0 -4
  175. package/es/components/DataVerification/RangeDialog.js +0 -105
  176. package/es/components/DataVerification/getDisplayedRangeTxt.js +0 -9
  177. package/es/components/DataVerification/index.css +0 -202
  178. package/es/components/DataVerification/index.d.ts +0 -4
  179. package/es/components/DataVerification/index.js +0 -398
  180. package/es/components/Dialog/index.css +0 -64
  181. package/es/components/Dialog/index.d.ts +0 -15
  182. package/es/components/Dialog/index.js +0 -72
  183. package/es/components/DuneChartsInputModal/DuneChartsInputModal.d.ts +0 -11
  184. package/es/components/DuneChartsInputModal/DuneChartsInputModal.js +0 -95
  185. package/es/components/DuneChartsInputModal/duneChartsInputModal.css +0 -98
  186. package/es/components/DunePreview/DunePreview.d.ts +0 -13
  187. package/es/components/DunePreview/DunePreview.js +0 -46
  188. package/es/components/DunePreview/index.css +0 -57
  189. package/es/components/FilterOption/index.js +0 -121
  190. package/es/components/FormatSearch/index.css +0 -19
  191. package/es/components/FormatSearch/index.js +0 -129
  192. package/es/components/FormulaSearch/index.css +0 -65
  193. package/es/components/FormulaSearch/index.d.ts +0 -5
  194. package/es/components/FormulaSearch/index.js +0 -198
  195. package/es/components/FxEditor/NameBox.d.ts +0 -3
  196. package/es/components/FxEditor/NameBox.js +0 -29
  197. package/es/components/FxEditor/index.css +0 -72
  198. package/es/components/FxEditor/index.js +0 -167
  199. package/es/components/IFrameBoxs/iFrameBoxs.css +0 -16
  200. package/es/components/IFrameBoxs/iFrameBoxs.js +0 -142
  201. package/es/components/ImgBoxs/index.d.ts +0 -3
  202. package/es/components/ImgBoxs/index.js +0 -219
  203. package/es/components/LinkEidtCard/index.css +0 -255
  204. package/es/components/LinkEidtCard/index.js +0 -238
  205. package/es/components/LocationCondition/index.css +0 -74
  206. package/es/components/LocationCondition/index.d.ts +0 -3
  207. package/es/components/LocationCondition/index.js +0 -195
  208. package/es/components/MessageBox/index.d.ts +0 -9
  209. package/es/components/MessageBox/index.js +0 -16
  210. package/es/components/NotationBoxes/index.js +0 -105
  211. package/es/components/ResetColumnWidth/index.d.ts +0 -2
  212. package/es/components/ResetColumnWidth/index.js +0 -130
  213. package/es/components/SVGDefines.js +0 -1902
  214. package/es/components/SVGIcon.js +0 -18
  215. package/es/components/SearchReplace/index.css +0 -191
  216. package/es/components/SearchReplace/index.d.ts +0 -6
  217. package/es/components/SearchReplace/index.js +0 -294
  218. package/es/components/Sheet/index.css +0 -27
  219. package/es/components/Sheet/index.js +0 -175
  220. package/es/components/SheetList/SheetHiddenButton.js +0 -35
  221. package/es/components/SheetList/SheetListItem.d.ts +0 -9
  222. package/es/components/SheetList/SheetListItem.js +0 -72
  223. package/es/components/SheetList/index.css +0 -48
  224. package/es/components/SheetList/index.d.ts +0 -4
  225. package/es/components/SheetList/index.js +0 -30
  226. package/es/components/SheetOverlay/ColumnHeader.js +0 -217
  227. package/es/components/SheetOverlay/ContentEditable.js +0 -74
  228. package/es/components/SheetOverlay/FormulaHint/index.css +0 -180
  229. package/es/components/SheetOverlay/FormulaHint/index.js +0 -348
  230. package/es/components/SheetOverlay/FormulaSearch/constant.js +0 -328
  231. package/es/components/SheetOverlay/FormulaSearch/index.css +0 -44
  232. package/es/components/SheetOverlay/FormulaSearch/index.js +0 -261
  233. package/es/components/SheetOverlay/InputBox.d.ts +0 -3
  234. package/es/components/SheetOverlay/InputBox.js +0 -394
  235. package/es/components/SheetOverlay/RowHeader.js +0 -187
  236. package/es/components/SheetOverlay/ScrollBar/index.css +0 -40
  237. package/es/components/SheetOverlay/ScrollBar/index.js +0 -47
  238. package/es/components/SheetOverlay/index.css +0 -954
  239. package/es/components/SheetOverlay/index.js +0 -578
  240. package/es/components/SheetTab/SheetItem.js +0 -230
  241. package/es/components/SheetTab/index.css +0 -280
  242. package/es/components/SheetTab/index.d.ts +0 -4
  243. package/es/components/SheetTab/index.js +0 -143
  244. package/es/components/SplitColumn/index.css +0 -121
  245. package/es/components/SplitColumn/index.js +0 -167
  246. package/es/components/Toolbar/Button.d.ts +0 -12
  247. package/es/components/Toolbar/Button.js +0 -32
  248. package/es/components/Toolbar/ColorPicker.js +0 -27
  249. package/es/components/Toolbar/Combo.js +0 -102
  250. package/es/components/Toolbar/CustomBorder.js +0 -211
  251. package/es/components/Toolbar/CustomButton.d.ts +0 -11
  252. package/es/components/Toolbar/CustomButton.js +0 -29
  253. package/es/components/Toolbar/CustomColor.js +0 -25
  254. package/es/components/Toolbar/CustomIcon.d.ts +0 -9
  255. package/es/components/Toolbar/CustomIcon.js +0 -38
  256. package/es/components/Toolbar/Divider.js +0 -12
  257. package/es/components/Toolbar/MoreItemsContainer.js +0 -17
  258. package/es/components/Toolbar/Select.d.ts +0 -14
  259. package/es/components/Toolbar/Select.js +0 -34
  260. package/es/components/Toolbar/index.css +0 -405
  261. package/es/components/Toolbar/index.d.ts +0 -10
  262. package/es/components/Toolbar/index.js +0 -1338
  263. package/es/components/Workbook/api.js +0 -398
  264. package/es/components/Workbook/index.css +0 -44
  265. package/es/components/Workbook/index.js +0 -588
  266. package/es/components/ZoomControl/index.css +0 -54
  267. package/es/components/ZoomControl/index.js +0 -111
  268. package/es/components/index.js +0 -3
  269. package/es/constants.js +0 -4
  270. package/es/context/index.js +0 -34
  271. package/es/context/modal.js +0 -43
  272. package/es/hooks/useAlert.js +0 -28
  273. package/es/hooks/useDialog.js +0 -28
  274. package/es/hooks/useOutsideClick.js +0 -15
  275. package/es/hooks/usePrevious.js +0 -9
  276. package/es/index.css +0 -27
  277. package/es/index.js +0 -1
  278. package/es/utils/datepickerStyles.js +0 -8
  279. package/lib/components/ChangeColor/index.css +0 -76
  280. package/lib/components/ChangeColor/index.d.ts +0 -7
  281. package/lib/components/ChangeColor/index.js +0 -50
  282. package/lib/components/ConditionFormat/ConditionRules.js +0 -332
  283. package/lib/components/ConditionFormat/index.css +0 -210
  284. package/lib/components/ConditionFormat/index.d.ts +0 -7
  285. package/lib/components/ConditionFormat/index.js +0 -261
  286. package/lib/components/ContextMenu/Divider.d.ts +0 -3
  287. package/lib/components/ContextMenu/Divider.js +0 -14
  288. package/lib/components/ContextMenu/FilterMenu.js +0 -621
  289. package/lib/components/ContextMenu/Menu.d.ts +0 -8
  290. package/lib/components/ContextMenu/Menu.js +0 -33
  291. package/lib/components/ContextMenu/SheetTab.js +0 -232
  292. package/lib/components/ContextMenu/index.css +0 -322
  293. package/lib/components/ContextMenu/index.d.ts +0 -5
  294. package/lib/components/ContextMenu/index.js +0 -1063
  295. package/lib/components/CustomSort/index.css +0 -23
  296. package/lib/components/CustomSort/index.js +0 -122
  297. package/lib/components/DataVerification/DropdownList.d.ts +0 -4
  298. package/lib/components/DataVerification/DropdownList.js +0 -135
  299. package/lib/components/DataVerification/RangeDialog.js +0 -114
  300. package/lib/components/DataVerification/getDisplayedRangeTxt.d.ts +0 -2
  301. package/lib/components/DataVerification/getDisplayedRangeTxt.js +0 -15
  302. package/lib/components/DataVerification/index.css +0 -202
  303. package/lib/components/DataVerification/index.js +0 -407
  304. package/lib/components/Dialog/index.css +0 -64
  305. package/lib/components/Dialog/index.js +0 -81
  306. package/lib/components/DuneChartsInputModal/DuneChartsInputModal.js +0 -104
  307. package/lib/components/DuneChartsInputModal/duneChartsInputModal.css +0 -98
  308. package/lib/components/DunePreview/DunePreview.js +0 -53
  309. package/lib/components/DunePreview/index.css +0 -57
  310. package/lib/components/FilterOption/index.d.ts +0 -5
  311. package/lib/components/FilterOption/index.js +0 -130
  312. package/lib/components/FormatSearch/index.css +0 -19
  313. package/lib/components/FormatSearch/index.d.ts +0 -6
  314. package/lib/components/FormatSearch/index.js +0 -138
  315. package/lib/components/FormulaSearch/index.css +0 -65
  316. package/lib/components/FormulaSearch/index.js +0 -207
  317. package/lib/components/FxEditor/NameBox.js +0 -38
  318. package/lib/components/FxEditor/index.css +0 -72
  319. package/lib/components/FxEditor/index.d.ts +0 -4
  320. package/lib/components/FxEditor/index.js +0 -176
  321. package/lib/components/IFrameBoxs/iFrameBoxs.css +0 -16
  322. package/lib/components/IFrameBoxs/iFrameBoxs.d.ts +0 -4
  323. package/lib/components/IFrameBoxs/iFrameBoxs.js +0 -151
  324. package/lib/components/ImgBoxs/index.js +0 -228
  325. package/lib/components/LinkEidtCard/index.css +0 -255
  326. package/lib/components/LinkEidtCard/index.d.ts +0 -5
  327. package/lib/components/LinkEidtCard/index.js +0 -247
  328. package/lib/components/LocationCondition/index.css +0 -74
  329. package/lib/components/LocationCondition/index.js +0 -204
  330. package/lib/components/MessageBox/index.js +0 -23
  331. package/lib/components/NotationBoxes/index.d.ts +0 -3
  332. package/lib/components/NotationBoxes/index.js +0 -114
  333. package/lib/components/ResetColumnWidth/index.js +0 -138
  334. package/lib/components/SVGDefines.d.ts +0 -5
  335. package/lib/components/SVGDefines.js +0 -1909
  336. package/lib/components/SVGIcon.d.ts +0 -9
  337. package/lib/components/SVGIcon.js +0 -25
  338. package/lib/components/SearchReplace/index.css +0 -191
  339. package/lib/components/SearchReplace/index.js +0 -303
  340. package/lib/components/Sheet/index.css +0 -27
  341. package/lib/components/Sheet/index.d.ts +0 -8
  342. package/lib/components/Sheet/index.js +0 -184
  343. package/lib/components/SheetList/SheetHiddenButton.d.ts +0 -8
  344. package/lib/components/SheetList/SheetHiddenButton.js +0 -44
  345. package/lib/components/SheetList/SheetListItem.js +0 -81
  346. package/lib/components/SheetList/index.css +0 -48
  347. package/lib/components/SheetList/index.js +0 -39
  348. package/lib/components/SheetOverlay/ColumnHeader.d.ts +0 -3
  349. package/lib/components/SheetOverlay/ColumnHeader.js +0 -226
  350. package/lib/components/SheetOverlay/ContentEditable.d.ts +0 -11
  351. package/lib/components/SheetOverlay/ContentEditable.js +0 -83
  352. package/lib/components/SheetOverlay/FormulaHint/index.css +0 -180
  353. package/lib/components/SheetOverlay/FormulaHint/index.d.ts +0 -4
  354. package/lib/components/SheetOverlay/FormulaHint/index.js +0 -357
  355. package/lib/components/SheetOverlay/FormulaSearch/constant.d.ts +0 -63
  356. package/lib/components/SheetOverlay/FormulaSearch/constant.js +0 -334
  357. package/lib/components/SheetOverlay/FormulaSearch/index.css +0 -44
  358. package/lib/components/SheetOverlay/FormulaSearch/index.d.ts +0 -4
  359. package/lib/components/SheetOverlay/FormulaSearch/index.js +0 -270
  360. package/lib/components/SheetOverlay/InputBox.js +0 -403
  361. package/lib/components/SheetOverlay/RowHeader.d.ts +0 -3
  362. package/lib/components/SheetOverlay/RowHeader.js +0 -196
  363. package/lib/components/SheetOverlay/ScrollBar/index.css +0 -40
  364. package/lib/components/SheetOverlay/ScrollBar/index.d.ts +0 -7
  365. package/lib/components/SheetOverlay/ScrollBar/index.js +0 -56
  366. package/lib/components/SheetOverlay/index.css +0 -954
  367. package/lib/components/SheetOverlay/index.d.ts +0 -4
  368. package/lib/components/SheetOverlay/index.js +0 -587
  369. package/lib/components/SheetTab/SheetItem.d.ts +0 -8
  370. package/lib/components/SheetTab/SheetItem.js +0 -239
  371. package/lib/components/SheetTab/index.css +0 -280
  372. package/lib/components/SheetTab/index.js +0 -152
  373. package/lib/components/SplitColumn/index.css +0 -121
  374. package/lib/components/SplitColumn/index.d.ts +0 -3
  375. package/lib/components/SplitColumn/index.js +0 -176
  376. package/lib/components/Toolbar/Button.js +0 -39
  377. package/lib/components/Toolbar/ColorPicker.d.ts +0 -6
  378. package/lib/components/Toolbar/ColorPicker.js +0 -34
  379. package/lib/components/Toolbar/Combo.d.ts +0 -12
  380. package/lib/components/Toolbar/Combo.js +0 -111
  381. package/lib/components/Toolbar/CustomBorder.d.ts +0 -7
  382. package/lib/components/Toolbar/CustomBorder.js +0 -220
  383. package/lib/components/Toolbar/CustomButton.js +0 -36
  384. package/lib/components/Toolbar/CustomColor.d.ts +0 -8
  385. package/lib/components/Toolbar/CustomColor.js +0 -32
  386. package/lib/components/Toolbar/CustomIcon.js +0 -46
  387. package/lib/components/Toolbar/Divider.d.ts +0 -4
  388. package/lib/components/Toolbar/Divider.js +0 -19
  389. package/lib/components/Toolbar/MoreItemsContainer.d.ts +0 -6
  390. package/lib/components/Toolbar/MoreItemsContainer.js +0 -25
  391. package/lib/components/Toolbar/Select.js +0 -40
  392. package/lib/components/Toolbar/index.css +0 -405
  393. package/lib/components/Toolbar/index.d.ts +0 -10
  394. package/lib/components/Toolbar/index.js +0 -1347
  395. package/lib/components/Workbook/api.d.ts +0 -1183
  396. package/lib/components/Workbook/api.js +0 -405
  397. package/lib/components/Workbook/index.css +0 -44
  398. package/lib/components/Workbook/index.js +0 -597
  399. package/lib/components/ZoomControl/index.css +0 -54
  400. package/lib/components/ZoomControl/index.d.ts +0 -4
  401. package/lib/components/ZoomControl/index.js +0 -120
  402. package/lib/components/index.d.ts +0 -4
  403. package/lib/components/index.js +0 -28
  404. package/lib/constants.d.ts +0 -1
  405. package/lib/constants.js +0 -10
  406. package/lib/context/index.d.ts +0 -25
  407. package/lib/context/index.js +0 -41
  408. package/lib/context/modal.d.ts +0 -10
  409. package/lib/context/modal.js +0 -50
  410. package/lib/hooks/useAlert.d.ts +0 -4
  411. package/lib/hooks/useAlert.js +0 -37
  412. package/lib/hooks/useDialog.d.ts +0 -5
  413. package/lib/hooks/useDialog.js +0 -37
  414. package/lib/hooks/useOutsideClick.d.ts +0 -2
  415. package/lib/hooks/useOutsideClick.js +0 -21
  416. package/lib/hooks/usePrevious.d.ts +0 -2
  417. package/lib/hooks/usePrevious.js +0 -15
  418. package/lib/index.css +0 -27
  419. package/lib/index.d.ts +0 -1
  420. package/lib/index.js +0 -16
  421. package/lib/utils/datepickerStyles.d.ts +0 -2
  422. package/lib/utils/datepickerStyles.js +0 -14
@@ -1,1338 +0,0 @@
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;