@fileverse-dev/fortune-core 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 (346) hide show
  1. package/{dist/packages/core/src → es}/api/cell.d.ts +10 -10
  2. package/es/api/cell.js +204 -0
  3. package/{dist/packages/core/src → es}/api/common.d.ts +66 -66
  4. package/es/api/common.js +79 -0
  5. package/{dist/packages/core/src → es}/api/errors.d.ts +2 -2
  6. package/es/api/errors.js +2 -0
  7. package/{dist/packages/core/src → es}/api/index.d.ts +9 -9
  8. package/es/api/index.js +8 -0
  9. package/{dist/packages/core/src → es}/api/merge.d.ts +5 -5
  10. package/es/api/merge.js +15 -0
  11. package/{dist/packages/core/src → es}/api/range.d.ts +22 -22
  12. package/es/api/range.js +123 -0
  13. package/{dist/packages/core/src → es}/api/rowcol.d.ts +14 -14
  14. package/es/api/rowcol.js +207 -0
  15. package/{dist/packages/core/src → es}/api/sheet.d.ts +10 -10
  16. package/es/api/sheet.js +128 -0
  17. package/{dist/packages/core/src → es}/api/workbook.d.ts +15 -15
  18. package/es/api/workbook.js +85 -0
  19. package/{dist/packages/core/src → es}/canvas.d.ts +46 -46
  20. package/es/canvas.js +1350 -0
  21. package/{dist/packages/core/src → es}/context.d.ts +197 -197
  22. package/es/context.js +380 -0
  23. package/{dist/packages/core/src → es}/events/copy.d.ts +2 -2
  24. package/es/events/copy.js +78 -0
  25. package/{dist/packages/core/src → es}/events/index.d.ts +4 -4
  26. package/es/events/index.js +4 -0
  27. package/{dist/packages/core/src → es}/events/keyboard.d.ts +6 -6
  28. package/es/events/keyboard.js +332 -0
  29. package/{dist/packages/core/src → es}/events/mouse.d.ts +22 -22
  30. package/es/events/mouse.js +1725 -0
  31. package/{dist/packages/core/src → es}/events/paste.d.ts +3 -3
  32. package/es/events/paste.js +1358 -0
  33. package/{dist/packages/core/src → es}/index.d.ts +10 -10
  34. package/es/index.js +10 -0
  35. package/{dist/packages/core/src → es}/locale/en.d.ts +992 -992
  36. package/es/locale/en.js +10564 -0
  37. package/{dist/packages/core/src → es}/locale/es.d.ts +1134 -1134
  38. package/es/locale/es.js +10010 -0
  39. package/{dist/packages/core/src → es}/locale/hi.d.ts +1030 -1030
  40. package/es/locale/hi.js +10550 -0
  41. package/{dist/packages/core/src → es}/locale/index.d.ts +1049 -1049
  42. package/es/locale/index.js +23 -0
  43. package/{dist/packages/core/src → es}/locale/zh.d.ts +1048 -1048
  44. package/es/locale/zh.js +10568 -0
  45. package/{dist/packages/core/src → es}/locale/zh_tw.d.ts +1187 -1187
  46. package/es/locale/zh_tw.js +10072 -0
  47. package/{dist/packages/core/src → es}/modules/ConditionFormat.d.ts +17 -17
  48. package/es/modules/ConditionFormat.js +1258 -0
  49. package/{dist/packages/core/src → es}/modules/border.d.ts +3 -3
  50. package/es/modules/border.js +1240 -0
  51. package/{dist/packages/core/src → es}/modules/cell.d.ts +32 -32
  52. package/es/modules/cell.js +1055 -0
  53. package/{dist/packages/core/src → es}/modules/clipboard.d.ts +3 -3
  54. package/es/modules/clipboard.js +36 -0
  55. package/{dist/packages/core/src → es}/modules/color.d.ts +1 -1
  56. package/es/modules/color.js +1 -0
  57. package/{dist/packages/core/src → es}/modules/comment.d.ts +97 -97
  58. package/es/modules/comment.js +597 -0
  59. package/{dist/packages/core/src → es}/modules/conditionalFormat.d.ts +2 -2
  60. package/es/modules/conditionalFormat.js +441 -0
  61. package/{dist/packages/core/src → es}/modules/cursor.d.ts +3 -3
  62. package/es/modules/cursor.js +62 -0
  63. package/{dist/packages/core/src → es}/modules/dataVerification.d.ts +11 -11
  64. package/es/modules/dataVerification.js +700 -0
  65. package/{dist/packages/core/src → es}/modules/dropCell.d.ts +10 -10
  66. package/es/modules/dropCell.js +2266 -0
  67. package/{dist/packages/core/src → es}/modules/filter.d.ts +45 -45
  68. package/es/modules/filter.js +434 -0
  69. package/{dist/packages/core/src → es}/modules/format.d.ts +6 -6
  70. package/es/modules/format.js +323 -0
  71. package/{dist/packages/core/src → es}/modules/formula.d.ts +54 -54
  72. package/es/modules/formula.js +2301 -0
  73. package/{dist/packages/core/src → es}/modules/freeze.d.ts +5 -5
  74. package/es/modules/freeze.js +148 -0
  75. package/{dist/packages/core/src → es}/modules/hyperlink.d.ts +21 -21
  76. package/es/modules/hyperlink.js +216 -0
  77. package/{dist/packages/core/src → es}/modules/iframe.d.ts +12 -12
  78. package/es/modules/iframe.js +220 -0
  79. package/{dist/packages/core/src → es}/modules/image.d.ts +31 -31
  80. package/es/modules/image.js +253 -0
  81. package/{dist/packages/core/src → es}/modules/index.d.ts +36 -36
  82. package/es/modules/index.js +36 -0
  83. package/{dist/packages/core/src → es}/modules/inline-string.d.ts +36 -36
  84. package/es/modules/inline-string.js +437 -0
  85. package/{dist/packages/core/src → es}/modules/location.d.ts +6 -6
  86. package/es/modules/location.js +46 -0
  87. package/{dist/packages/core/src → es}/modules/locationCondition.d.ts +21 -21
  88. package/es/modules/locationCondition.js +218 -0
  89. package/{dist/packages/core/src → es}/modules/merge.d.ts +3 -3
  90. package/es/modules/merge.js +216 -0
  91. package/{dist/packages/core/src → es}/modules/mobile.d.ts +5 -5
  92. package/es/modules/mobile.js +33 -0
  93. package/{dist/packages/core/src → es}/modules/moveCells.d.ts +5 -5
  94. package/es/modules/moveCells.js +348 -0
  95. package/{dist/packages/core/src → es}/modules/protection.d.ts +5 -5
  96. package/es/modules/protection.js +96 -0
  97. package/{dist/packages/core/src → es}/modules/refresh.d.ts +3 -3
  98. package/es/modules/refresh.js +34 -0
  99. package/{dist/packages/core/src → es}/modules/rowcol.d.ts +19 -19
  100. package/es/modules/rowcol.js +1922 -0
  101. package/{dist/packages/core/src → es}/modules/screenshot.d.ts +2 -2
  102. package/es/modules/screenshot.js +90 -0
  103. package/{dist/packages/core/src → es}/modules/searchReplace.d.ts +36 -36
  104. package/es/modules/searchReplace.js +388 -0
  105. package/{dist/packages/core/src → es}/modules/selection.d.ts +46 -46
  106. package/es/modules/selection.js +1674 -0
  107. package/{dist/packages/core/src → es}/modules/sheet.d.ts +10 -10
  108. package/es/modules/sheet.js +237 -0
  109. package/{dist/packages/core/src → es}/modules/sort.d.ts +7 -7
  110. package/es/modules/sort.js +150 -0
  111. package/{dist/packages/core/src → es}/modules/splitColumn.d.ts +5 -5
  112. package/es/modules/splitColumn.js +126 -0
  113. package/es/modules/ssf.js +1533 -0
  114. package/{dist/packages/core/src → es}/modules/text.d.ts +10 -10
  115. package/es/modules/text.js +1207 -0
  116. package/{dist/packages/core/src → es}/modules/toolbar.d.ts +32 -32
  117. package/es/modules/toolbar.js +970 -0
  118. package/{dist/packages/core/src → es}/modules/validation.d.ts +19 -19
  119. package/es/modules/validation.js +190 -0
  120. package/{dist/packages/core/src → es}/modules/zoom.d.ts +3 -3
  121. package/es/modules/zoom.js +29 -0
  122. package/{dist/packages/core/src → es}/settings.d.ts +100 -100
  123. package/es/settings.js +36 -0
  124. package/{dist/packages/core/src → es}/types.d.ts +371 -371
  125. package/es/types.js +1 -0
  126. package/{dist/packages/core/src → es}/utils/freeze.d.ts +7 -7
  127. package/es/utils/freeze.js +86 -0
  128. package/{dist/packages/core/src → es}/utils/index.d.ts +18 -18
  129. package/es/utils/index.js +173 -0
  130. package/{dist/packages/core/src → es}/utils/patch.d.ts +37 -37
  131. package/es/utils/patch.js +381 -0
  132. package/lib/api/cell.d.ts +10 -0
  133. package/lib/api/cell.js +215 -0
  134. package/lib/api/common.d.ts +66 -0
  135. package/lib/api/common.js +88 -0
  136. package/lib/api/errors.d.ts +2 -0
  137. package/lib/api/errors.js +8 -0
  138. package/lib/api/index.d.ts +9 -0
  139. package/lib/api/index.js +101 -0
  140. package/lib/api/merge.d.ts +5 -0
  141. package/lib/api/merge.js +22 -0
  142. package/lib/api/range.d.ts +22 -0
  143. package/lib/api/range.js +138 -0
  144. package/lib/api/rowcol.d.ts +14 -0
  145. package/lib/api/rowcol.js +222 -0
  146. package/lib/api/sheet.d.ts +10 -0
  147. package/lib/api/sheet.js +145 -0
  148. package/lib/api/workbook.d.ts +15 -0
  149. package/lib/api/workbook.js +98 -0
  150. package/lib/canvas.d.ts +46 -0
  151. package/lib/canvas.js +1356 -0
  152. package/lib/context.d.ts +197 -0
  153. package/lib/context.js +392 -0
  154. package/lib/events/copy.d.ts +2 -0
  155. package/lib/events/copy.js +85 -0
  156. package/lib/events/index.d.ts +4 -0
  157. package/lib/events/index.js +49 -0
  158. package/lib/events/keyboard.d.ts +6 -0
  159. package/lib/events/keyboard.js +342 -0
  160. package/lib/events/mouse.d.ts +22 -0
  161. package/lib/events/mouse.js +1744 -0
  162. package/lib/events/paste.d.ts +3 -0
  163. package/lib/events/paste.js +1366 -0
  164. package/lib/index.d.ts +10 -0
  165. package/lib/index.js +109 -0
  166. package/lib/locale/en.d.ts +992 -0
  167. package/lib/locale/en.js +10570 -0
  168. package/lib/locale/es.d.ts +1134 -0
  169. package/lib/locale/es.js +10016 -0
  170. package/lib/locale/hi.d.ts +1030 -0
  171. package/lib/locale/hi.js +10556 -0
  172. package/lib/locale/index.d.ts +1049 -0
  173. package/lib/locale/index.js +29 -0
  174. package/lib/locale/zh.d.ts +1048 -0
  175. package/lib/locale/zh.js +10574 -0
  176. package/lib/locale/zh_tw.d.ts +1187 -0
  177. package/lib/locale/zh_tw.js +10078 -0
  178. package/lib/modules/ConditionFormat.d.ts +17 -0
  179. package/lib/modules/ConditionFormat.js +1273 -0
  180. package/lib/modules/border.d.ts +3 -0
  181. package/lib/modules/border.js +1248 -0
  182. package/lib/modules/cell.d.ts +32 -0
  183. package/lib/modules/cell.js +1085 -0
  184. package/lib/modules/clipboard.d.ts +3 -0
  185. package/lib/modules/clipboard.js +42 -0
  186. package/lib/modules/color.d.ts +1 -0
  187. package/lib/modules/color.js +7 -0
  188. package/lib/modules/comment.d.ts +97 -0
  189. package/lib/modules/comment.js +625 -0
  190. package/lib/modules/conditionalFormat.d.ts +2 -0
  191. package/lib/modules/conditionalFormat.js +447 -0
  192. package/lib/modules/cursor.d.ts +3 -0
  193. package/lib/modules/cursor.js +70 -0
  194. package/lib/modules/dataVerification.d.ts +11 -0
  195. package/lib/modules/dataVerification.js +715 -0
  196. package/lib/modules/dropCell.d.ts +10 -0
  197. package/lib/modules/dropCell.js +2282 -0
  198. package/lib/modules/filter.d.ts +45 -0
  199. package/lib/modules/filter.js +448 -0
  200. package/lib/modules/format.d.ts +6 -0
  201. package/lib/modules/format.js +334 -0
  202. package/lib/modules/formula.d.ts +54 -0
  203. package/lib/modules/formula.js +2330 -0
  204. package/lib/modules/freeze.d.ts +5 -0
  205. package/lib/modules/freeze.js +158 -0
  206. package/lib/modules/hyperlink.d.ts +21 -0
  207. package/lib/modules/hyperlink.js +232 -0
  208. package/lib/modules/iframe.d.ts +12 -0
  209. package/lib/modules/iframe.js +236 -0
  210. package/lib/modules/image.d.ts +31 -0
  211. package/lib/modules/image.js +272 -0
  212. package/lib/modules/index.d.ts +36 -0
  213. package/lib/modules/index.js +401 -0
  214. package/lib/modules/inline-string.d.ts +36 -0
  215. package/lib/modules/inline-string.js +452 -0
  216. package/lib/modules/location.d.ts +6 -0
  217. package/lib/modules/location.js +57 -0
  218. package/lib/modules/locationCondition.d.ts +21 -0
  219. package/lib/modules/locationCondition.js +229 -0
  220. package/lib/modules/merge.d.ts +3 -0
  221. package/lib/modules/merge.js +223 -0
  222. package/lib/modules/mobile.d.ts +5 -0
  223. package/lib/modules/mobile.js +41 -0
  224. package/lib/modules/moveCells.d.ts +5 -0
  225. package/lib/modules/moveCells.js +357 -0
  226. package/lib/modules/protection.d.ts +5 -0
  227. package/lib/modules/protection.js +106 -0
  228. package/lib/modules/refresh.d.ts +3 -0
  229. package/lib/modules/refresh.js +40 -0
  230. package/lib/modules/rowcol.d.ts +19 -0
  231. package/lib/modules/rowcol.js +1935 -0
  232. package/lib/modules/screenshot.d.ts +2 -0
  233. package/lib/modules/screenshot.js +96 -0
  234. package/lib/modules/searchReplace.d.ts +36 -0
  235. package/lib/modules/searchReplace.js +402 -0
  236. package/lib/modules/selection.d.ts +46 -0
  237. package/lib/modules/selection.js +1703 -0
  238. package/lib/modules/sheet.d.ts +10 -0
  239. package/lib/modules/sheet.js +250 -0
  240. package/lib/modules/sort.d.ts +7 -0
  241. package/lib/modules/sort.js +159 -0
  242. package/lib/modules/splitColumn.d.ts +5 -0
  243. package/lib/modules/splitColumn.js +136 -0
  244. package/lib/modules/ssf.js +1539 -0
  245. package/lib/modules/text.d.ts +10 -0
  246. package/lib/modules/text.js +1221 -0
  247. package/lib/modules/toolbar.d.ts +32 -0
  248. package/lib/modules/toolbar.js +1003 -0
  249. package/lib/modules/validation.d.ts +19 -0
  250. package/lib/modules/validation.js +205 -0
  251. package/lib/modules/zoom.d.ts +3 -0
  252. package/lib/modules/zoom.js +36 -0
  253. package/lib/settings.d.ts +100 -0
  254. package/lib/settings.js +42 -0
  255. package/lib/types.d.ts +371 -0
  256. package/lib/types.js +5 -0
  257. package/lib/utils/freeze.d.ts +7 -0
  258. package/lib/utils/freeze.js +92 -0
  259. package/lib/utils/index.d.ts +18 -0
  260. package/lib/utils/index.js +231 -0
  261. package/lib/utils/patch.d.ts +37 -0
  262. package/lib/utils/patch.js +392 -0
  263. package/package.json +7 -6
  264. package/dist/index.esm.js +0 -80255
  265. package/dist/index.js +0 -80601
  266. package/dist/packages/react/src/components/ChangeColor/index.d.ts +0 -7
  267. package/dist/packages/react/src/components/ConditionFormat/ConditionRules.d.ts +0 -6
  268. package/dist/packages/react/src/components/ConditionFormat/index.d.ts +0 -7
  269. package/dist/packages/react/src/components/ContextMenu/Divider.d.ts +0 -3
  270. package/dist/packages/react/src/components/ContextMenu/FilterMenu.d.ts +0 -3
  271. package/dist/packages/react/src/components/ContextMenu/Menu.d.ts +0 -8
  272. package/dist/packages/react/src/components/ContextMenu/SheetTab.d.ts +0 -4
  273. package/dist/packages/react/src/components/ContextMenu/index.d.ts +0 -5
  274. package/dist/packages/react/src/components/CustomSort/index.d.ts +0 -4
  275. package/dist/packages/react/src/components/DataVerification/DropdownList.d.ts +0 -4
  276. package/dist/packages/react/src/components/DataVerification/RangeDialog.d.ts +0 -4
  277. package/dist/packages/react/src/components/DataVerification/getDisplayedRangeTxt.d.ts +0 -2
  278. package/dist/packages/react/src/components/DataVerification/index.d.ts +0 -4
  279. package/dist/packages/react/src/components/Dialog/index.d.ts +0 -15
  280. package/dist/packages/react/src/components/DuneChartsInputModal/DuneChartsInputModal.d.ts +0 -11
  281. package/dist/packages/react/src/components/DunePreview/DunePreview.d.ts +0 -13
  282. package/dist/packages/react/src/components/FilterOption/index.d.ts +0 -5
  283. package/dist/packages/react/src/components/FormatSearch/index.d.ts +0 -6
  284. package/dist/packages/react/src/components/FormulaSearch/index.d.ts +0 -5
  285. package/dist/packages/react/src/components/FxEditor/NameBox.d.ts +0 -3
  286. package/dist/packages/react/src/components/FxEditor/index.d.ts +0 -4
  287. package/dist/packages/react/src/components/IFrameBoxs/iFrameBoxs.d.ts +0 -4
  288. package/dist/packages/react/src/components/ImgBoxs/index.d.ts +0 -3
  289. package/dist/packages/react/src/components/LinkEidtCard/index.d.ts +0 -5
  290. package/dist/packages/react/src/components/LocationCondition/index.d.ts +0 -3
  291. package/dist/packages/react/src/components/MessageBox/index.d.ts +0 -9
  292. package/dist/packages/react/src/components/NotationBoxes/index.d.ts +0 -3
  293. package/dist/packages/react/src/components/ResetColumnWidth/index.d.ts +0 -2
  294. package/dist/packages/react/src/components/SVGDefines.d.ts +0 -5
  295. package/dist/packages/react/src/components/SVGIcon.d.ts +0 -9
  296. package/dist/packages/react/src/components/SearchReplace/index.d.ts +0 -6
  297. package/dist/packages/react/src/components/Sheet/index.d.ts +0 -8
  298. package/dist/packages/react/src/components/SheetList/SheetHiddenButton.d.ts +0 -8
  299. package/dist/packages/react/src/components/SheetList/SheetListItem.d.ts +0 -9
  300. package/dist/packages/react/src/components/SheetList/index.d.ts +0 -4
  301. package/dist/packages/react/src/components/SheetOverlay/ColumnHeader.d.ts +0 -3
  302. package/dist/packages/react/src/components/SheetOverlay/ContentEditable.d.ts +0 -11
  303. package/dist/packages/react/src/components/SheetOverlay/FormulaHint/index.d.ts +0 -4
  304. package/dist/packages/react/src/components/SheetOverlay/FormulaSearch/constant.d.ts +0 -63
  305. package/dist/packages/react/src/components/SheetOverlay/FormulaSearch/index.d.ts +0 -4
  306. package/dist/packages/react/src/components/SheetOverlay/InputBox.d.ts +0 -3
  307. package/dist/packages/react/src/components/SheetOverlay/RowHeader.d.ts +0 -3
  308. package/dist/packages/react/src/components/SheetOverlay/ScrollBar/index.d.ts +0 -7
  309. package/dist/packages/react/src/components/SheetOverlay/index.d.ts +0 -4
  310. package/dist/packages/react/src/components/SheetTab/SheetItem.d.ts +0 -8
  311. package/dist/packages/react/src/components/SheetTab/index.d.ts +0 -4
  312. package/dist/packages/react/src/components/SplitColumn/index.d.ts +0 -3
  313. package/dist/packages/react/src/components/Toolbar/Button.d.ts +0 -12
  314. package/dist/packages/react/src/components/Toolbar/ColorPicker.d.ts +0 -6
  315. package/dist/packages/react/src/components/Toolbar/Combo.d.ts +0 -12
  316. package/dist/packages/react/src/components/Toolbar/CustomBorder.d.ts +0 -7
  317. package/dist/packages/react/src/components/Toolbar/CustomButton.d.ts +0 -11
  318. package/dist/packages/react/src/components/Toolbar/CustomColor.d.ts +0 -8
  319. package/dist/packages/react/src/components/Toolbar/CustomIcon.d.ts +0 -9
  320. package/dist/packages/react/src/components/Toolbar/Divider.d.ts +0 -4
  321. package/dist/packages/react/src/components/Toolbar/MoreItemsContainer.d.ts +0 -6
  322. package/dist/packages/react/src/components/Toolbar/Select.d.ts +0 -14
  323. package/dist/packages/react/src/components/Toolbar/index.d.ts +0 -10
  324. package/dist/packages/react/src/components/Workbook/api.d.ts +0 -1177
  325. package/dist/packages/react/src/components/Workbook/index.d.ts +0 -1185
  326. package/dist/packages/react/src/components/ZoomControl/index.d.ts +0 -4
  327. package/dist/packages/react/src/components/index.d.ts +0 -4
  328. package/dist/packages/react/src/constants.d.ts +0 -1
  329. package/dist/packages/react/src/context/index.d.ts +0 -25
  330. package/dist/packages/react/src/context/modal.d.ts +0 -10
  331. package/dist/packages/react/src/hooks/useAlert.d.ts +0 -4
  332. package/dist/packages/react/src/hooks/useDialog.d.ts +0 -5
  333. package/dist/packages/react/src/hooks/useOutsideClick.d.ts +0 -2
  334. package/dist/packages/react/src/hooks/usePrevious.d.ts +0 -2
  335. package/dist/packages/react/src/index.d.ts +0 -1
  336. package/dist/packages/react/src/utils/datepickerStyles.d.ts +0 -2
  337. package/dist/stories/API.stories.d.ts +0 -1210
  338. package/dist/stories/Collabration.stories.d.ts +0 -2359
  339. package/dist/stories/Features.stories.d.ts +0 -9430
  340. package/dist/stories/data/cell.d.ts +0 -983
  341. package/dist/stories/data/dataVerification.d.ts +0 -131
  342. package/dist/stories/data/empty.d.ts +0 -10
  343. package/dist/stories/data/formula.d.ts +0 -362
  344. package/dist/stories/data/freeze.d.ts +0 -34
  345. package/dist/stories/data/protected.d.ts +0 -40
  346. package/dist/stories/utils.d.ts +0 -1
@@ -0,0 +1,1003 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.autoSelectionFormula = autoSelectionFormula;
7
+ exports.cancelPaintModel = cancelPaintModel;
8
+ exports.handleBold = handleBold;
9
+ exports.handleBorder = handleBorder;
10
+ exports.handleClearFormat = handleClearFormat;
11
+ exports.handleCurrencyFormat = handleCurrencyFormat;
12
+ exports.handleFormatPainter = handleFormatPainter;
13
+ exports.handleFreeze = handleFreeze;
14
+ exports.handleHorizontalAlign = handleHorizontalAlign;
15
+ exports.handleItalic = handleItalic;
16
+ exports.handleLink = handleLink;
17
+ exports.handleMerge = handleMerge;
18
+ exports.handleNumberDecrease = handleNumberDecrease;
19
+ exports.handleNumberIncrease = handleNumberIncrease;
20
+ exports.handlePercentageFormat = handlePercentageFormat;
21
+ exports.handleSort = handleSort;
22
+ exports.handleStrikeThrough = handleStrikeThrough;
23
+ exports.handleSum = handleSum;
24
+ exports.handleTextBackground = handleTextBackground;
25
+ exports.handleTextColor = handleTextColor;
26
+ exports.handleTextSize = handleTextSize;
27
+ exports.handleUnderline = handleUnderline;
28
+ exports.handleVerticalAlign = handleVerticalAlign;
29
+ exports.toolbarItemClickHandler = toolbarItemClickHandler;
30
+ exports.toolbarItemSelectedFunc = toolbarItemSelectedFunc;
31
+ exports.updateFormat = updateFormat;
32
+ exports.updateFormatCell = updateFormatCell;
33
+ var _lodash = _interopRequireDefault(require("lodash"));
34
+ var _merge = require("./merge");
35
+ var _context = require("../context");
36
+ var _utils = require("../utils");
37
+ var _cell = require("./cell");
38
+ var _color = require("./color");
39
+ var _format = require("./format");
40
+ var _formula2 = require("./formula");
41
+ var _inlineString = require("./inline-string");
42
+ var _location = require("./location");
43
+ var _selection = require("./selection");
44
+ var _sort = require("./sort");
45
+ var _validation = require("./validation");
46
+ var _hyperlink = require("./hyperlink");
47
+ var _conditionalFormat = require("./conditionalFormat");
48
+ var _text = require("./text");
49
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
50
+ function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col_ed, canvas) {
51
+ var _a, _b;
52
+ var _c;
53
+ if (_lodash.default.isNil(d) || _lodash.default.isNil(attr)) {
54
+ return;
55
+ }
56
+ if (attr === "ct") {
57
+ for (var r = row_st; r <= row_ed; r += 1) {
58
+ if (!_lodash.default.isNil(ctx.config.rowhidden) && !_lodash.default.isNil(ctx.config.rowhidden[r])) {
59
+ continue;
60
+ }
61
+ for (var c = col_st; c <= col_ed; c += 1) {
62
+ var cell = d[r][c];
63
+ var value = void 0;
64
+ if (_lodash.default.isPlainObject(cell)) {
65
+ value = cell === null || cell === void 0 ? void 0 : cell.v;
66
+ } else {
67
+ value = cell;
68
+ }
69
+ if (foucsStatus !== "@" && (0, _validation.isRealNum)(value)) {
70
+ value = Number(value);
71
+ }
72
+ var mask = (0, _format.update)(foucsStatus, value);
73
+ var type = "n";
74
+ if ((0, _format.is_date)(foucsStatus) || foucsStatus === 14 || foucsStatus === 15 || foucsStatus === 16 || foucsStatus === 17 || foucsStatus === 18 || foucsStatus === 19 || foucsStatus === 20 || foucsStatus === 21 || foucsStatus === 22 || foucsStatus === 45 || foucsStatus === 46 || foucsStatus === 47) {
75
+ type = "d";
76
+ } else if (foucsStatus === "@" || foucsStatus === 49) {
77
+ type = "s";
78
+ } else if (foucsStatus === "General" || foucsStatus === 0) {
79
+ type = (0, _validation.isRealNum)(value) ? "n" : "g";
80
+ }
81
+ if (cell && _lodash.default.isPlainObject(cell)) {
82
+ cell.m = "".concat(mask);
83
+ if (_lodash.default.isNil(cell.ct)) {
84
+ cell.ct = {};
85
+ }
86
+ cell.ct.fa = foucsStatus;
87
+ cell.ct.t = type;
88
+ } else {
89
+ d[r][c] = {
90
+ ct: {
91
+ fa: foucsStatus,
92
+ t: type
93
+ },
94
+ v: value,
95
+ m: mask
96
+ };
97
+ }
98
+ }
99
+ }
100
+ } else {
101
+ if (attr === "ht") {
102
+ if (foucsStatus === "left") {
103
+ foucsStatus = "1";
104
+ } else if (foucsStatus === "center") {
105
+ foucsStatus = "0";
106
+ } else if (foucsStatus === "right") {
107
+ foucsStatus = "2";
108
+ }
109
+ } else if (attr === "vt") {
110
+ if (foucsStatus === "top") {
111
+ foucsStatus = "1";
112
+ } else if (foucsStatus === "middle") {
113
+ foucsStatus = "0";
114
+ } else if (foucsStatus === "bottom") {
115
+ foucsStatus = "2";
116
+ }
117
+ } else if (attr === "tb") {
118
+ if (foucsStatus === "overflow") {
119
+ foucsStatus = "1";
120
+ } else if (foucsStatus === "clip") {
121
+ foucsStatus = "0";
122
+ } else if (foucsStatus === "wrap") {
123
+ foucsStatus = "2";
124
+ }
125
+ } else if (attr === "tr") {
126
+ if (foucsStatus === "none") {
127
+ foucsStatus = "0";
128
+ } else if (foucsStatus === "angleup") {
129
+ foucsStatus = "1";
130
+ } else if (foucsStatus === "angledown") {
131
+ foucsStatus = "2";
132
+ } else if (foucsStatus === "vertical") {
133
+ foucsStatus = "3";
134
+ } else if (foucsStatus === "rotation-up") {
135
+ foucsStatus = "4";
136
+ } else if (foucsStatus === "rotation-down") {
137
+ foucsStatus = "5";
138
+ }
139
+ }
140
+ var sheetIndex = (0, _utils.getSheetIndex)(ctx, ctx.currentSheetId);
141
+ if (sheetIndex == null) {
142
+ return;
143
+ }
144
+ for (var r = row_st; r <= row_ed; r += 1) {
145
+ if (!_lodash.default.isNil(ctx.config.rowhidden) && !_lodash.default.isNil(ctx.config.rowhidden[r])) {
146
+ continue;
147
+ }
148
+ for (var c = col_st; c <= col_ed; c += 1) {
149
+ var value = d[r][c];
150
+ if (value && _lodash.default.isPlainObject(value)) {
151
+ (0, _inlineString.updateInlineStringFormatOutside)(value, attr, foucsStatus);
152
+ value[attr] = foucsStatus;
153
+ (_c = ctx.luckysheetfile[sheetIndex]).config || (_c.config = {});
154
+ var cfg = ctx.luckysheetfile[sheetIndex].config;
155
+ var cellWidth = ((_a = cfg.columnlen) === null || _a === void 0 ? void 0 : _a[c]) || ctx.luckysheetfile[sheetIndex].defaultColWidth;
156
+ if (attr === "fs" && canvas) {
157
+ var textInfo = (0, _text.getCellTextInfo)(d[r][c], canvas, ctx, {
158
+ r: r,
159
+ c: c,
160
+ cellWidth: cellWidth
161
+ });
162
+ if (!textInfo) continue;
163
+ var rowHeight = _lodash.default.round(textInfo.textHeightAll);
164
+ var currentRowHeight = ((_b = cfg.rowlen) === null || _b === void 0 ? void 0 : _b[r]) || ctx.luckysheetfile[sheetIndex].defaultRowHeight || 19;
165
+ if (!_lodash.default.isUndefined(rowHeight) && rowHeight > currentRowHeight && (!cfg.customHeight || cfg.customHeight[r] !== 1)) {
166
+ if (_lodash.default.isUndefined(cfg.rowlen)) cfg.rowlen = {};
167
+ _lodash.default.set(cfg, "rowlen.".concat(r), rowHeight);
168
+ }
169
+ }
170
+ } else {
171
+ d[r][c] = {
172
+ v: value
173
+ };
174
+ d[r][c][attr] = foucsStatus;
175
+ }
176
+ }
177
+ }
178
+ }
179
+ }
180
+ function updateFormat(ctx, $input, d, attr, foucsStatus, canvas) {
181
+ var allowEdit = (0, _utils.isAllowEdit)(ctx);
182
+ if (!allowEdit) return;
183
+ if (attr in _inlineString.inlineStyleAffectAttribute) {
184
+ if (ctx.luckysheetCellUpdate.length > 0) {
185
+ var value = $input.innerText;
186
+ if (value.substring(0, 1) !== "=") {
187
+ var cell = d[ctx.luckysheetCellUpdate[0]][ctx.luckysheetCellUpdate[1]];
188
+ if (cell) {
189
+ (0, _inlineString.updateInlineStringFormat)(ctx, cell, attr, foucsStatus, $input);
190
+ }
191
+ return;
192
+ }
193
+ }
194
+ }
195
+ var cfg = _lodash.default.cloneDeep(ctx.config);
196
+ if (_lodash.default.isNil(cfg.rowlen)) {
197
+ cfg.rowlen = {};
198
+ }
199
+ _lodash.default.forEach(ctx.luckysheet_select_save, function (selection) {
200
+ var _a = selection.row,
201
+ row_st = _a[0],
202
+ row_ed = _a[1];
203
+ var _b = selection.column,
204
+ col_st = _b[0],
205
+ col_ed = _b[1];
206
+ updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col_ed, canvas);
207
+ });
208
+ }
209
+ function toggleAttr(ctx, cellInput, attr) {
210
+ var flowdata = (0, _context.getFlowdata)(ctx);
211
+ if (!flowdata) return;
212
+ var flag = (0, _cell.isAllSelectedCellsInStatus)(ctx, attr, 1);
213
+ var foucsStatus = flag ? 0 : 1;
214
+ updateFormat(ctx, cellInput, flowdata, attr, foucsStatus);
215
+ }
216
+ function setAttr(ctx, cellInput, attr, value, canvas) {
217
+ var flowdata = (0, _context.getFlowdata)(ctx);
218
+ if (!flowdata) return;
219
+ updateFormat(ctx, cellInput, flowdata, attr, value, canvas);
220
+ }
221
+ function checkNoNullValue(cell) {
222
+ var v = cell;
223
+ if (_lodash.default.isPlainObject(v)) {
224
+ v = v.v;
225
+ }
226
+ if (!(0, _validation.isRealNull)(v) && (0, _validation.isdatatypemulti)(v).num && (cell.ct == null || cell.ct.t == null || cell.ct.t === "n" || cell.ct.t === "g")) {
227
+ return true;
228
+ }
229
+ return false;
230
+ }
231
+ function checkNoNullValueAll(cell) {
232
+ var v = cell;
233
+ if (_lodash.default.isPlainObject(v)) {
234
+ v = v.v;
235
+ }
236
+ if (!(0, _validation.isRealNull)(v)) {
237
+ return true;
238
+ }
239
+ return false;
240
+ }
241
+ function getNoNullValue(d, st_x, ed, type) {
242
+ var hasValueStart = null;
243
+ var nullNum = 0;
244
+ var nullTime = 0;
245
+ for (var r = ed - 1; r >= 0; r -= 1) {
246
+ var cell = void 0;
247
+ if (type === "c") {
248
+ cell = d[st_x][r];
249
+ } else {
250
+ cell = d[r][st_x];
251
+ }
252
+ if (checkNoNullValue(cell)) {
253
+ hasValueStart = r;
254
+ } else if (cell == null || cell.v == null || cell.v === "") {
255
+ nullNum += 1;
256
+ if (nullNum >= 40) {
257
+ if (nullTime <= 0) {
258
+ nullTime = 1;
259
+ } else {
260
+ break;
261
+ }
262
+ }
263
+ } else {
264
+ break;
265
+ }
266
+ }
267
+ return hasValueStart;
268
+ }
269
+ function activeFormulaInput(cellInput, fxInput, ctx, row_index, col_index, rowh, columnh, formula, cache, isnull) {
270
+ if (isnull == null) {
271
+ isnull = false;
272
+ }
273
+ ctx.luckysheetCellUpdate = [row_index, col_index];
274
+ cache.doNotUpdateCell = true;
275
+ if (isnull) {
276
+ var formulaTxt_1 = "<span dir=\"auto\" class=\"luckysheet-formula-text-color\">=</span><span dir=\"auto\" class=\"luckysheet-formula-text-color\">".concat(formula.toUpperCase(), "</span><span dir=\"auto\" class=\"luckysheet-formula-text-color\">(</span><span dir=\"auto\" class=\"luckysheet-formula-text-color\">)</span>");
277
+ cellInput.innerHTML = formulaTxt_1;
278
+ var spanList = cellInput.querySelectorAll("span");
279
+ (0, _formula2.setCaretPosition)(ctx, spanList[spanList.length - 2], 0, 1);
280
+ return;
281
+ }
282
+ var row_pre = (0, _location.rowLocationByIndex)(rowh[0], ctx.visibledatarow)[0];
283
+ var row = (0, _location.rowLocationByIndex)(rowh[1], ctx.visibledatarow)[1];
284
+ var col_pre = (0, _location.colLocationByIndex)(columnh[0], ctx.visibledatacolumn)[0];
285
+ var col = (0, _location.colLocationByIndex)(columnh[1], ctx.visibledatacolumn)[1];
286
+ var formulaTxt = "<span dir=\"auto\" class=\"luckysheet-formula-text-color\">=</span><span dir=\"auto\" class=\"luckysheet-formula-text-color\">".concat(formula.toUpperCase(), "</span><span dir=\"auto\" class=\"luckysheet-formula-text-color\">(</span><span class=\"fortune-formula-functionrange-cell\" rangeindex=\"0\" dir=\"auto\" style=\"color:").concat(_color.colors[0], ";\">").concat((0, _cell.getRangetxt)(ctx, ctx.currentSheetId, {
287
+ row: rowh,
288
+ column: columnh
289
+ }, ctx.currentSheetId), "</span><span dir=\"auto\" class=\"luckysheet-formula-text-color\">)</span>");
290
+ cellInput.innerHTML = formulaTxt;
291
+ (0, _formula2.israngeseleciton)(ctx);
292
+ ctx.formulaCache.rangestart = true;
293
+ ctx.formulaCache.rangedrag_column_start = false;
294
+ ctx.formulaCache.rangedrag_row_start = false;
295
+ ctx.formulaCache.rangechangeindex = 0;
296
+ (0, _formula2.rangeSetValue)(ctx, cellInput, {
297
+ row: rowh,
298
+ column: columnh
299
+ }, fxInput);
300
+ ctx.formulaCache.func_selectedrange = {
301
+ left: col_pre,
302
+ width: col - col_pre - 1,
303
+ top: row_pre,
304
+ height: row - row_pre - 1,
305
+ left_move: col_pre,
306
+ width_move: col - col_pre - 1,
307
+ top_move: row_pre,
308
+ height_move: row - row_pre - 1,
309
+ row: [row_index, row_index],
310
+ column: [col_index, col_index]
311
+ };
312
+ (0, _formula2.createFormulaRangeSelect)(ctx, {
313
+ rangeIndex: ctx.formulaCache.rangeIndex || 0,
314
+ left: col_pre,
315
+ width: col - col_pre - 1,
316
+ top: row_pre,
317
+ height: row - row_pre - 1
318
+ });
319
+ }
320
+ function backFormulaInput(d, r, c, rowh, columnh, formula, ctx) {
321
+ var _a;
322
+ var f = "=".concat(formula.toUpperCase(), "(").concat((0, _cell.getRangetxt)(ctx, ctx.currentSheetId, {
323
+ row: rowh,
324
+ column: columnh
325
+ }, ctx.currentSheetId), ")");
326
+ var v = (0, _formula2.execfunction)(ctx, f, r, c);
327
+ var value = {
328
+ v: v[1],
329
+ f: v[2]
330
+ };
331
+ (0, _cell.setCellValue)(ctx, r, c, d, value);
332
+ (_a = ctx.formulaCache).execFunctionExist || (_a.execFunctionExist = []);
333
+ ctx.formulaCache.execFunctionExist.push({
334
+ r: r,
335
+ c: c,
336
+ i: ctx.currentSheetId
337
+ });
338
+ }
339
+ function singleFormulaInput(cellInput, fxInput, ctx, d, _index, fix, st_m, ed_m, formula, type, cache, noNum, noNull) {
340
+ if (type == null) {
341
+ type = "r";
342
+ }
343
+ if (noNum == null) {
344
+ noNum = true;
345
+ }
346
+ if (noNull == null) {
347
+ noNull = true;
348
+ }
349
+ var isNull = true;
350
+ var isNum = false;
351
+ for (var c = st_m; c <= ed_m; c += 1) {
352
+ var cell = null;
353
+ if (type === "c") {
354
+ cell = d[c][fix];
355
+ } else {
356
+ cell = d[fix][c];
357
+ }
358
+ if (checkNoNullValue(cell)) {
359
+ isNull = false;
360
+ isNum = true;
361
+ } else if (checkNoNullValueAll(cell)) {
362
+ isNull = false;
363
+ }
364
+ }
365
+ if (isNull && noNull) {
366
+ var st_r_r = getNoNullValue(d, _index, fix, type);
367
+ if (st_r_r == null) {
368
+ if (type === "c") {
369
+ activeFormulaInput(cellInput, fxInput, ctx, _index, fix, null, null, formula, cache, true);
370
+ } else {
371
+ activeFormulaInput(cellInput, fxInput, ctx, fix, _index, null, null, formula, cache, true);
372
+ }
373
+ } else {
374
+ if (_index === st_m) {
375
+ for (var c = st_m; c <= ed_m; c += 1) {
376
+ st_r_r = getNoNullValue(d, c, fix, type);
377
+ if (st_r_r == null) {
378
+ break;
379
+ }
380
+ if (type === "c") {
381
+ backFormulaInput(d, c, fix, [c, c], [st_r_r, fix - 1], formula, ctx);
382
+ } else {
383
+ backFormulaInput(d, fix, c, [st_r_r, fix - 1], [c, c], formula, ctx);
384
+ }
385
+ }
386
+ } else {
387
+ for (var c = ed_m; c >= st_m; c -= 1) {
388
+ st_r_r = getNoNullValue(d, c, fix, type);
389
+ if (st_r_r == null) {
390
+ break;
391
+ }
392
+ if (type === "c") {
393
+ backFormulaInput(d, c, fix, [c, c], [st_r_r, fix - 1], formula, ctx);
394
+ } else {
395
+ backFormulaInput(d, fix, c, [st_r_r, fix - 1], [c, c], formula, ctx);
396
+ }
397
+ }
398
+ }
399
+ }
400
+ return false;
401
+ }
402
+ if (isNum && noNum) {
403
+ var cell = null;
404
+ if (type === "c") {
405
+ cell = d[ed_m + 1][fix];
406
+ } else {
407
+ cell = d[fix][ed_m + 1];
408
+ }
409
+ if (cell != null && cell.v != null && cell.v.toString().length > 0) {
410
+ var c = ed_m + 1;
411
+ if (type === "c") {
412
+ cell = d[ed_m + 1][fix];
413
+ } else {
414
+ cell = d[fix][ed_m + 1];
415
+ }
416
+ while (cell != null && cell.v != null && cell.v.toString().length > 0) {
417
+ c += 1;
418
+ var len = null;
419
+ if (type === "c") {
420
+ len = d.length;
421
+ } else {
422
+ len = d[0].length;
423
+ }
424
+ if (c >= len) {
425
+ return false;
426
+ }
427
+ if (type === "c") {
428
+ cell = d[c][fix];
429
+ } else {
430
+ cell = d[fix][c];
431
+ }
432
+ }
433
+ if (type === "c") {
434
+ backFormulaInput(d, c, fix, [st_m, ed_m], [fix, fix], formula, ctx);
435
+ } else {
436
+ backFormulaInput(d, fix, c, [fix, fix], [st_m, ed_m], formula, ctx);
437
+ }
438
+ } else {
439
+ if (type === "c") {
440
+ backFormulaInput(d, ed_m + 1, fix, [st_m, ed_m], [fix, fix], formula, ctx);
441
+ } else {
442
+ backFormulaInput(d, fix, ed_m + 1, [fix, fix], [st_m, ed_m], formula, ctx);
443
+ }
444
+ }
445
+ return false;
446
+ }
447
+ return true;
448
+ }
449
+ function autoSelectionFormula(ctx, cellInput, fxInput, formula, cache) {
450
+ var allowEdit = (0, _utils.isAllowEdit)(ctx);
451
+ if (!allowEdit) return;
452
+ var flowdata = (0, _context.getFlowdata)(ctx);
453
+ if (flowdata == null) return;
454
+ var isfalse = true;
455
+ ctx.formulaCache.execFunctionExist = [];
456
+ function execFormulaInput_c(d, st_r, ed_r, st_c, ed_c, _formula) {
457
+ var st_c_c = getNoNullValue(d, st_r, ed_c, "c");
458
+ if (st_c_c == null) {
459
+ activeFormulaInput(cellInput, fxInput, ctx, st_r, st_c, null, null, _formula, cache, true);
460
+ } else {
461
+ activeFormulaInput(cellInput, fxInput, ctx, st_r, st_c, [st_r, ed_r], [st_c_c, ed_c - 1], _formula, cache);
462
+ }
463
+ }
464
+ function execFormulaInput(d, st_r, ed_r, st_c, ed_c, _formula) {
465
+ var st_r_c = getNoNullValue(d, st_c, ed_r, "r");
466
+ if (st_r_c == null) {
467
+ execFormulaInput_c(d, st_r, ed_r, st_c, ed_c, _formula);
468
+ } else {
469
+ activeFormulaInput(cellInput, fxInput, ctx, st_r, st_c, [st_r_c, ed_r - 1], [st_c, ed_c], _formula, cache);
470
+ }
471
+ }
472
+ if (!ctx.luckysheet_select_save) return;
473
+ _lodash.default.forEach(ctx.luckysheet_select_save, function (selection) {
474
+ var _a = selection.row,
475
+ st_r = _a[0],
476
+ ed_r = _a[1];
477
+ var _b = selection.column,
478
+ st_c = _b[0],
479
+ ed_c = _b[1];
480
+ var row_index = selection.row_focus;
481
+ var col_index = selection.column_focus;
482
+ if (st_r === ed_r && st_c === ed_c) {
483
+ if (ed_r - 1 < 0 && ed_c - 1 < 0) {
484
+ activeFormulaInput(cellInput, fxInput, ctx, st_r, st_c, null, null, formula, cache, true);
485
+ return;
486
+ }
487
+ if (ed_r - 1 >= 0 && checkNoNullValue(flowdata[ed_r - 1][st_c])) {
488
+ execFormulaInput(flowdata, st_r, ed_r, st_c, ed_c, formula);
489
+ } else if (ed_c - 1 >= 0 && checkNoNullValue(flowdata[st_r][ed_c - 1])) {
490
+ execFormulaInput_c(flowdata, st_r, ed_r, st_c, ed_c, formula);
491
+ } else {
492
+ execFormulaInput(flowdata, st_r, ed_r, st_c, ed_c, formula);
493
+ }
494
+ } else if (st_r === ed_r) {
495
+ isfalse = singleFormulaInput(cellInput, fxInput, ctx, flowdata, col_index, st_r, st_c, ed_c, formula, "r", cache);
496
+ } else if (st_c === ed_c) {
497
+ isfalse = singleFormulaInput(cellInput, fxInput, ctx, flowdata, row_index, st_c, st_r, ed_r, formula, "c", cache);
498
+ } else {
499
+ var r_false = true;
500
+ for (var r = st_r; r <= ed_r; r += 1) {
501
+ r_false = singleFormulaInput(cellInput, fxInput, ctx, flowdata, col_index, r, st_c, ed_c, formula, "r", cache, true, false) && r_false;
502
+ }
503
+ var c_false = true;
504
+ for (var c = st_c; c <= ed_c; c += 1) {
505
+ c_false = singleFormulaInput(cellInput, fxInput, ctx, flowdata, row_index, c, st_r, ed_r, formula, "c", cache, true, false) && c_false;
506
+ }
507
+ isfalse = !!r_false && !!c_false;
508
+ }
509
+ isfalse = isfalse && isfalse;
510
+ });
511
+ if (!isfalse) {
512
+ ctx.formulaCache.execFunctionExist.reverse();
513
+ (0, _formula2.execFunctionGroup)(ctx, null, null, null, null, flowdata);
514
+ ctx.formulaCache.execFunctionGlobalData = null;
515
+ }
516
+ }
517
+ function cancelPaintModel(ctx) {
518
+ var _a;
519
+ if (ctx.luckysheet_copy_save === null) return;
520
+ if (((_a = ctx.luckysheet_copy_save) === null || _a === void 0 ? void 0 : _a.dataSheetId) === ctx.currentSheetId) {
521
+ ctx.luckysheet_selection_range = [];
522
+ (0, _selection.selectionCopyShow)(ctx.luckysheet_selection_range, ctx);
523
+ } else {
524
+ if (!ctx.luckysheet_copy_save) return;
525
+ var index = (0, _utils.getSheetIndex)(ctx, ctx.luckysheet_copy_save.dataSheetId);
526
+ if (!index) return;
527
+ ctx.luckysheetfile[index].luckysheet_selection_range = [];
528
+ }
529
+ ctx.luckysheet_copy_save = {
530
+ dataSheetId: "",
531
+ copyRange: [{
532
+ row: [0],
533
+ column: [0]
534
+ }],
535
+ RowlChange: false,
536
+ HasMC: false
537
+ };
538
+ ctx.luckysheetPaintModelOn = false;
539
+ }
540
+ function handleCurrencyFormat(ctx, cellInput) {
541
+ var flowdata = (0, _context.getFlowdata)(ctx);
542
+ if (!flowdata) return;
543
+ var currency = ctx.currency || "¥";
544
+ updateFormat(ctx, cellInput, flowdata, "ct", "".concat(currency, " #,##0.00"));
545
+ }
546
+ function handlePercentageFormat(ctx, cellInput) {
547
+ var flowdata = (0, _context.getFlowdata)(ctx);
548
+ if (!flowdata) return;
549
+ updateFormat(ctx, cellInput, flowdata, "ct", "0.00%");
550
+ }
551
+ function handleNumberDecrease(ctx, cellInput) {
552
+ var flowdata = (0, _context.getFlowdata)(ctx);
553
+ if (!flowdata || !ctx.luckysheet_select_save) return;
554
+ var row_index = ctx.luckysheet_select_save[0].row_focus;
555
+ var col_index = ctx.luckysheet_select_save[0].column_focus;
556
+ if (row_index === undefined || col_index === undefined) return;
557
+ var foucsStatus = (0, _cell.normalizedAttr)(flowdata, row_index, col_index, "ct");
558
+ var cell = flowdata[row_index][col_index];
559
+ if (foucsStatus == null || foucsStatus.t !== "n") {
560
+ return;
561
+ }
562
+ if (foucsStatus.fa === "General") {
563
+ if (!cell || !cell.v) return;
564
+ var mask = (0, _format.genarate)(cell.v);
565
+ if (!mask || mask.length < 2) return;
566
+ foucsStatus = mask[1];
567
+ }
568
+ var reg = /^(w|W)((0?)|(0\.0+))$/;
569
+ if (reg.test(foucsStatus.fa)) {
570
+ if (foucsStatus.fa.indexOf(".") > -1) {
571
+ if (foucsStatus.fa.substr(-2) === ".0") {
572
+ updateFormat(ctx, cellInput, flowdata, "ct", foucsStatus.fa.split(".")[0]);
573
+ } else {
574
+ updateFormat(ctx, cellInput, flowdata, "ct", foucsStatus.fa.substr(0, foucsStatus.fa.length - 1));
575
+ }
576
+ } else {
577
+ updateFormat(ctx, cellInput, flowdata, "ct", foucsStatus.fa);
578
+ }
579
+ return;
580
+ }
581
+ var prefix = "";
582
+ var main = "";
583
+ var fa = [];
584
+ if (foucsStatus.fa.indexOf(".") > -1) {
585
+ fa = foucsStatus.fa.split(".");
586
+ prefix = fa[0], main = fa[1];
587
+ } else {
588
+ return;
589
+ }
590
+ fa = main.split("");
591
+ var tail = "";
592
+ for (var i = fa.length - 1; i >= 0; i -= 1) {
593
+ var c = fa[i];
594
+ if (c !== "#" && c !== "0" && c !== "," && Number.isNaN(parseInt(c, 10))) {
595
+ tail = c + tail;
596
+ } else {
597
+ break;
598
+ }
599
+ }
600
+ var fmt = "";
601
+ if (foucsStatus.fa.indexOf(".") > -1) {
602
+ var suffix = main;
603
+ if (tail.length > 0) {
604
+ suffix = main.replace(tail, "");
605
+ }
606
+ var pos = suffix.replace(/#/g, "0");
607
+ pos = pos.substr(0, pos.length - 1);
608
+ if (pos === "") {
609
+ fmt = prefix + tail;
610
+ } else {
611
+ fmt = "".concat(prefix, ".").concat(pos).concat(tail);
612
+ }
613
+ }
614
+ updateFormat(ctx, cellInput, flowdata, "ct", fmt);
615
+ }
616
+ function handleNumberIncrease(ctx, cellInput) {
617
+ var flowdata = (0, _context.getFlowdata)(ctx);
618
+ if (!flowdata) return;
619
+ if (!ctx.luckysheet_select_save) return;
620
+ var row_index = ctx.luckysheet_select_save[0].row_focus;
621
+ var col_index = ctx.luckysheet_select_save[0].column_focus;
622
+ if (row_index === undefined || col_index === undefined) return;
623
+ var foucsStatus = (0, _cell.normalizedAttr)(flowdata, row_index, col_index, "ct");
624
+ var cell = flowdata[row_index][col_index];
625
+ if (foucsStatus == null || foucsStatus.t !== "n") {
626
+ return;
627
+ }
628
+ if (foucsStatus.fa === "General") {
629
+ if (!cell || !cell.v) return;
630
+ var mask = (0, _format.genarate)(cell.v);
631
+ if (!mask || mask.length < 2) return;
632
+ foucsStatus = mask[1];
633
+ }
634
+ if (foucsStatus.fa === "General") {
635
+ updateFormat(ctx, cellInput, flowdata, "ct", "#.0");
636
+ return;
637
+ }
638
+ var reg = /^(w|W)((0?)|(0\.0+))$/;
639
+ if (reg.test(foucsStatus.fa)) {
640
+ if (foucsStatus.fa.indexOf(".") > -1) {
641
+ updateFormat(ctx, cellInput, flowdata, "ct", "".concat(foucsStatus.fa, "0"));
642
+ } else {
643
+ if (foucsStatus.fa.substr(-1) === "0") {
644
+ updateFormat(ctx, cellInput, flowdata, "ct", "".concat(foucsStatus.fa, ".0"));
645
+ } else {
646
+ updateFormat(ctx, cellInput, flowdata, "ct", "".concat(foucsStatus.fa, "0.0"));
647
+ }
648
+ }
649
+ return;
650
+ }
651
+ var prefix = "";
652
+ var main = "";
653
+ var fa = [];
654
+ if (foucsStatus.fa.indexOf(".") > -1) {
655
+ fa = foucsStatus.fa.split(".");
656
+ prefix = fa[0], main = fa[1];
657
+ } else {
658
+ main = foucsStatus.fa;
659
+ }
660
+ fa = main.split("");
661
+ var tail = "";
662
+ for (var i = fa.length - 1; i >= 0; i -= 1) {
663
+ var c = fa[i];
664
+ if (c !== "#" && c !== "0" && c !== "," && Number.isNaN(parseInt(c, 10))) {
665
+ tail = c + tail;
666
+ } else {
667
+ break;
668
+ }
669
+ }
670
+ var fmt = "";
671
+ if (foucsStatus.fa.indexOf(".") > -1) {
672
+ var suffix = main;
673
+ if (tail.length > 0) {
674
+ suffix = main.replace(tail, "");
675
+ }
676
+ var pos = suffix.replace(/#/g, "0");
677
+ pos += "0";
678
+ fmt = "".concat(prefix, ".").concat(pos).concat(tail);
679
+ } else {
680
+ if (tail.length > 0) {
681
+ fmt = "".concat(main.replace(tail, ""), ".0").concat(tail);
682
+ } else {
683
+ fmt = "".concat(main, ".0").concat(tail);
684
+ }
685
+ }
686
+ updateFormat(ctx, cellInput, flowdata, "ct", fmt);
687
+ }
688
+ function handleBold(ctx, cellInput) {
689
+ toggleAttr(ctx, cellInput, "bl");
690
+ }
691
+ function handleItalic(ctx, cellInput) {
692
+ toggleAttr(ctx, cellInput, "it");
693
+ }
694
+ function handleStrikeThrough(ctx, cellInput) {
695
+ toggleAttr(ctx, cellInput, "cl");
696
+ }
697
+ function handleUnderline(ctx, cellInput) {
698
+ toggleAttr(ctx, cellInput, "un");
699
+ }
700
+ function handleHorizontalAlign(ctx, cellInput, value) {
701
+ setAttr(ctx, cellInput, "ht", value);
702
+ }
703
+ function handleVerticalAlign(ctx, cellInput, value) {
704
+ setAttr(ctx, cellInput, "vt", value);
705
+ }
706
+ function handleFormatPainter(ctx) {
707
+ var allowEdit = (0, _utils.isAllowEdit)(ctx);
708
+ if (!allowEdit) return;
709
+ if (ctx.luckysheet_select_save == null || ctx.luckysheet_select_save.length === 0) {
710
+ return;
711
+ }
712
+ if (ctx.luckysheet_select_save.length > 1) {
713
+ return;
714
+ }
715
+ var has_PartMC = false;
716
+ var r1 = ctx.luckysheet_select_save[0].row[0];
717
+ var r2 = ctx.luckysheet_select_save[0].row[1];
718
+ var c1 = ctx.luckysheet_select_save[0].column[0];
719
+ var c2 = ctx.luckysheet_select_save[0].column[1];
720
+ has_PartMC = (0, _validation.hasPartMC)(ctx, ctx.config, r1, r2, c1, c2);
721
+ if (has_PartMC) {
722
+ return;
723
+ }
724
+ cancelPaintModel(ctx);
725
+ ctx.luckysheet_selection_range = [{
726
+ row: ctx.luckysheet_select_save[0].row,
727
+ column: ctx.luckysheet_select_save[0].column
728
+ }];
729
+ (0, _selection.selectionCopyShow)(ctx.luckysheet_selection_range, ctx);
730
+ var RowlChange = false;
731
+ var HasMC = false;
732
+ for (var r = ctx.luckysheet_select_save[0].row[0]; r <= ctx.luckysheet_select_save[0].row[1]; r += 1) {
733
+ if (ctx.config.rowhidden != null && ctx.config.rowhidden[r] != null) {
734
+ continue;
735
+ }
736
+ if (ctx.config.rowlen != null && r in ctx.config.rowlen) {
737
+ RowlChange = true;
738
+ }
739
+ for (var c = ctx.luckysheet_select_save[0].column[0]; c <= ctx.luckysheet_select_save[0].column[1]; c += 1) {
740
+ var flowdata = (0, _context.getFlowdata)(ctx);
741
+ if (!flowdata) return;
742
+ var cell = flowdata[r][c];
743
+ if (cell != null && cell.mc != null && cell.mc.rs != null) {
744
+ HasMC = true;
745
+ }
746
+ }
747
+ }
748
+ ctx.luckysheet_copy_save = {
749
+ dataSheetId: ctx.currentSheetId,
750
+ copyRange: [{
751
+ row: ctx.luckysheet_select_save[0].row,
752
+ column: ctx.luckysheet_select_save[0].column
753
+ }],
754
+ RowlChange: RowlChange,
755
+ HasMC: HasMC
756
+ };
757
+ ctx.luckysheetPaintModelOn = true;
758
+ ctx.luckysheetPaintSingle = true;
759
+ }
760
+ function handleClearFormat(ctx) {
761
+ var _a;
762
+ if (ctx.allowEdit === false) return;
763
+ var flowdata = (0, _context.getFlowdata)(ctx);
764
+ if (!flowdata) return;
765
+ (_a = ctx.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a.every(function (selection) {
766
+ var _a = selection.row,
767
+ rowSt = _a[0],
768
+ rowEd = _a[1];
769
+ var _b = selection.column,
770
+ colSt = _b[0],
771
+ colEd = _b[1];
772
+ for (var r = rowSt; r <= rowEd; r += 1) {
773
+ if (!_lodash.default.isNil(ctx.config.rowhidden) && !_lodash.default.isNil(ctx.config.rowhidden[r])) {
774
+ continue;
775
+ }
776
+ for (var c = colSt; c <= colEd; c += 1) {
777
+ var cell = flowdata[r][c];
778
+ if (!cell) continue;
779
+ flowdata[r][c] = _lodash.default.pick(cell, "v", "m", "mc", "f", "ct");
780
+ }
781
+ }
782
+ var index = (0, _utils.getSheetIndex)(ctx, ctx.currentSheetId);
783
+ if (index == null) return false;
784
+ if (ctx.config.borderInfo == null) return false;
785
+ var cfg = ctx.config || {};
786
+ if (cfg.borderInfo && cfg.borderInfo.length > 0) {
787
+ var source_borderInfo = [];
788
+ for (var i = 0; i < cfg.borderInfo.length; i += 1) {
789
+ var bd_rangeType = cfg.borderInfo[i].rangeType;
790
+ if (bd_rangeType === "range" && cfg.borderInfo[i].borderType !== "border-slash") {
791
+ var bd_range = cfg.borderInfo[i].range;
792
+ var bd_emptyRange = [];
793
+ for (var j = 0; j < bd_range.length; j += 1) {
794
+ bd_emptyRange = bd_emptyRange.concat((0, _conditionalFormat.cfSplitRange)(bd_range[j], {
795
+ row: [rowSt, rowEd],
796
+ column: [colSt, colEd]
797
+ }, {
798
+ row: [rowSt, rowEd],
799
+ column: [colSt, colEd]
800
+ }, "restPart"));
801
+ }
802
+ cfg.borderInfo[i].range = bd_emptyRange;
803
+ source_borderInfo.push(cfg.borderInfo[i]);
804
+ } else if (bd_rangeType === "cell") {
805
+ var bd_r = cfg.borderInfo[i].value.row_index;
806
+ var bd_c = cfg.borderInfo[i].value.col_index;
807
+ if (!(bd_r >= rowSt && bd_r <= rowEd && bd_c >= colSt && bd_c <= colEd)) {
808
+ source_borderInfo.push(cfg.borderInfo[i]);
809
+ }
810
+ } else if (bd_rangeType === "range" && cfg.borderInfo[i].borderType === "border-slash" && !(cfg.borderInfo[i].range[0].row[0] >= rowSt && cfg.borderInfo[i].range[0].row[0] <= rowEd && cfg.borderInfo[i].range[0].column[0] >= colSt && cfg.borderInfo[i].range[0].column[0] <= colEd)) {
811
+ source_borderInfo.push(cfg.borderInfo[i]);
812
+ }
813
+ }
814
+ ctx.luckysheetfile[index].config.borderInfo = source_borderInfo;
815
+ }
816
+ return true;
817
+ });
818
+ }
819
+ function handleTextColor(ctx, cellInput, color) {
820
+ setAttr(ctx, cellInput, "fc", color);
821
+ }
822
+ function handleTextBackground(ctx, cellInput, color) {
823
+ setAttr(ctx, cellInput, "bg", color);
824
+ }
825
+ function handleBorder(ctx, type, borderColor, borderStyle) {
826
+ var allowEdit = (0, _utils.isAllowEdit)(ctx);
827
+ if (!allowEdit) return;
828
+ if (type == null) {
829
+ type = "border-all";
830
+ }
831
+ var color = borderColor;
832
+ var style = borderStyle;
833
+ if (color == null || color === "") {
834
+ color = "#000";
835
+ }
836
+ if (style == null || style === "") {
837
+ style = "1";
838
+ }
839
+ var cfg = ctx.config;
840
+ if (cfg.borderInfo == null) {
841
+ cfg.borderInfo = [];
842
+ }
843
+ if (type !== "border-slash") {
844
+ var borderInfo = {
845
+ rangeType: "range",
846
+ borderType: type,
847
+ color: color,
848
+ style: style,
849
+ range: _lodash.default.cloneDeep(ctx.luckysheet_select_save) || []
850
+ };
851
+ cfg.borderInfo.push(borderInfo);
852
+ } else {
853
+ var rangeList_1 = [];
854
+ _lodash.default.forEach(ctx.luckysheet_select_save, function (selection) {
855
+ for (var r = selection.row[0]; r <= selection.row[1]; r += 1) {
856
+ for (var c = selection.column[0]; c <= selection.column[1]; c += 1) {
857
+ var range = "".concat(r, "_").concat(c);
858
+ if (_lodash.default.includes(rangeList_1, range)) continue;
859
+ var borderInfo = {
860
+ rangeType: "range",
861
+ borderType: type,
862
+ color: color,
863
+ style: style,
864
+ range: (0, _selection.normalizeSelection)(ctx, [{
865
+ row: [r, r],
866
+ column: [c, c]
867
+ }])
868
+ };
869
+ cfg.borderInfo.push(borderInfo);
870
+ rangeList_1.push(range);
871
+ }
872
+ }
873
+ });
874
+ }
875
+ var index = (0, _utils.getSheetIndex)(ctx, ctx.currentSheetId);
876
+ if (index == null) return;
877
+ ctx.luckysheetfile[index].config = ctx.config;
878
+ }
879
+ function handleMerge(ctx, type) {
880
+ var allowEdit = (0, _utils.isAllowEdit)(ctx);
881
+ if (!allowEdit) return;
882
+ if ((0, _selection.selectIsOverlap)(ctx)) {
883
+ return;
884
+ }
885
+ if (ctx.config.merge != null) {
886
+ var has_PartMC = false;
887
+ if (!ctx.luckysheet_select_save) return;
888
+ for (var s = 0; s < ctx.luckysheet_select_save.length; s += 1) {
889
+ var r1 = ctx.luckysheet_select_save[s].row[0];
890
+ var r2 = ctx.luckysheet_select_save[s].row[1];
891
+ var c1 = ctx.luckysheet_select_save[s].column[0];
892
+ var c2 = ctx.luckysheet_select_save[s].column[1];
893
+ has_PartMC = (0, _validation.hasPartMC)(ctx, ctx.config, r1, r2, c1, c2);
894
+ if (has_PartMC) {
895
+ break;
896
+ }
897
+ }
898
+ if (has_PartMC) {
899
+ return;
900
+ }
901
+ }
902
+ var flowdata = (0, _context.getFlowdata)(ctx);
903
+ if (!flowdata) return;
904
+ if (!ctx.luckysheet_select_save) return;
905
+ (0, _merge.mergeCells)(ctx, ctx.currentSheetId, ctx.luckysheet_select_save, type);
906
+ }
907
+ function handleSort(ctx, isAsc) {
908
+ (0, _sort.sortSelection)(ctx, isAsc);
909
+ }
910
+ function handleFreeze(ctx, type) {
911
+ var _a, _b;
912
+ var allowEdit = (0, _utils.isAllowEdit)(ctx);
913
+ if (!allowEdit) return;
914
+ var file = ctx.luckysheetfile[(0, _utils.getSheetIndex)(ctx, ctx.currentSheetId)];
915
+ if (!file) return;
916
+ if (type === "freeze-cancel") {
917
+ delete file.frozen;
918
+ return;
919
+ }
920
+ var firstSelection = (_a = ctx.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[0];
921
+ if (!firstSelection) return;
922
+ var row_focus = firstSelection.row_focus,
923
+ column_focus = firstSelection.column_focus;
924
+ if (row_focus == null || column_focus == null) return;
925
+ var m = (_b = ctx.config.merge) === null || _b === void 0 ? void 0 : _b["".concat(row_focus, "_").concat(column_focus)];
926
+ if (m) {
927
+ row_focus = m.r + m.rs - 1;
928
+ column_focus = m.c + m.cs - 1;
929
+ }
930
+ file.frozen = {
931
+ type: "both",
932
+ range: {
933
+ row_focus: row_focus,
934
+ column_focus: column_focus
935
+ }
936
+ };
937
+ if (type === "freeze-row") {
938
+ file.frozen.type = "rangeRow";
939
+ } else if (type === "freeze-col") {
940
+ file.frozen.type = "rangeColumn";
941
+ }
942
+ }
943
+ function handleTextSize(ctx, cellInput, size, canvas) {
944
+ setAttr(ctx, cellInput, "fs", size, canvas);
945
+ }
946
+ function handleSum(ctx, cellInput, fxInput, cache) {
947
+ autoSelectionFormula(ctx, cellInput, fxInput, "SUM", cache);
948
+ }
949
+ function handleLink(ctx) {
950
+ var _a;
951
+ var allowEdit = (0, _utils.isAllowEdit)(ctx);
952
+ if (!allowEdit) return;
953
+ var selection = (_a = ctx.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[0];
954
+ var flowdata = (0, _context.getFlowdata)(ctx);
955
+ if (flowdata != null && selection != null) {
956
+ (0, _hyperlink.showLinkCard)(ctx, selection.row[0], selection.column[0], true);
957
+ }
958
+ }
959
+ var handlerMap = {
960
+ "currency-format": handleCurrencyFormat,
961
+ "percentage-format": handlePercentageFormat,
962
+ "number-decrease": handleNumberDecrease,
963
+ "number-increase": handleNumberIncrease,
964
+ "sort-cell": function sortCell(ctx) {
965
+ return handleSort(ctx, true);
966
+ },
967
+ "merge-all": function mergeAll(ctx) {
968
+ return handleMerge(ctx, "mergeAll");
969
+ },
970
+ "border-all": function borderAll(ctx) {
971
+ return handleBorder(ctx, "border-all");
972
+ },
973
+ bold: handleBold,
974
+ italic: handleItalic,
975
+ "strike-through": handleStrikeThrough,
976
+ underline: handleUnderline,
977
+ "clear-format": handleClearFormat,
978
+ "format-painter": handleFormatPainter,
979
+ search: function search(ctx) {
980
+ ctx.showSearch = true;
981
+ },
982
+ link: handleLink
983
+ };
984
+ var selectedMap = {
985
+ bold: function bold(cell) {
986
+ return (cell === null || cell === void 0 ? void 0 : cell.bl) === 1;
987
+ },
988
+ italic: function italic(cell) {
989
+ return (cell === null || cell === void 0 ? void 0 : cell.it) === 1;
990
+ },
991
+ "strike-through": function strikeThrough(cell) {
992
+ return (cell === null || cell === void 0 ? void 0 : cell.cl) === 1;
993
+ },
994
+ underline: function underline(cell) {
995
+ return (cell === null || cell === void 0 ? void 0 : cell.un) === 1;
996
+ }
997
+ };
998
+ function toolbarItemClickHandler(name) {
999
+ return handlerMap[name];
1000
+ }
1001
+ function toolbarItemSelectedFunc(name) {
1002
+ return selectedMap[name];
1003
+ }