@fileverse-dev/fortune-core 1.0.26 → 2.0.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 (346) hide show
  1. package/dist/index.esm.js +80254 -0
  2. package/dist/index.js +80600 -0
  3. package/{es → dist/packages/core/src}/api/cell.d.ts +10 -10
  4. package/{lib → dist/packages/core/src}/api/common.d.ts +66 -71
  5. package/{es → dist/packages/core/src}/api/errors.d.ts +2 -2
  6. package/{es → dist/packages/core/src}/api/index.d.ts +9 -9
  7. package/{es → dist/packages/core/src}/api/merge.d.ts +5 -5
  8. package/{lib → dist/packages/core/src}/api/range.d.ts +22 -22
  9. package/{lib → dist/packages/core/src}/api/rowcol.d.ts +14 -14
  10. package/{lib → dist/packages/core/src}/api/sheet.d.ts +10 -10
  11. package/{lib → dist/packages/core/src}/api/workbook.d.ts +15 -15
  12. package/{lib → dist/packages/core/src}/canvas.d.ts +46 -46
  13. package/{es → dist/packages/core/src}/context.d.ts +197 -198
  14. package/{es → dist/packages/core/src}/events/copy.d.ts +2 -2
  15. package/{lib → dist/packages/core/src}/events/index.d.ts +4 -4
  16. package/{lib → dist/packages/core/src}/events/keyboard.d.ts +6 -6
  17. package/{es → dist/packages/core/src}/events/mouse.d.ts +22 -22
  18. package/{es → dist/packages/core/src}/events/paste.d.ts +3 -3
  19. package/{lib → dist/packages/core/src}/index.d.ts +10 -10
  20. package/{lib → dist/packages/core/src}/locale/en.d.ts +992 -992
  21. package/{lib → dist/packages/core/src}/locale/es.d.ts +1134 -1134
  22. package/{lib → dist/packages/core/src}/locale/hi.d.ts +1030 -1030
  23. package/{lib → dist/packages/core/src}/locale/index.d.ts +1049 -1049
  24. package/{es → dist/packages/core/src}/locale/zh.d.ts +1048 -1048
  25. package/{lib → dist/packages/core/src}/locale/zh_tw.d.ts +1187 -1187
  26. package/{lib → dist/packages/core/src}/modules/ConditionFormat.d.ts +17 -17
  27. package/{lib → dist/packages/core/src}/modules/border.d.ts +3 -3
  28. package/{lib → dist/packages/core/src}/modules/cell.d.ts +32 -32
  29. package/{es → dist/packages/core/src}/modules/clipboard.d.ts +3 -3
  30. package/{es → dist/packages/core/src}/modules/color.d.ts +1 -1
  31. package/{lib → dist/packages/core/src}/modules/comment.d.ts +97 -97
  32. package/{es → dist/packages/core/src}/modules/conditionalFormat.d.ts +2 -2
  33. package/{es → dist/packages/core/src}/modules/cursor.d.ts +3 -3
  34. package/{es → dist/packages/core/src}/modules/dataVerification.d.ts +11 -11
  35. package/{es → dist/packages/core/src}/modules/dropCell.d.ts +10 -10
  36. package/{lib → dist/packages/core/src}/modules/filter.d.ts +45 -45
  37. package/{es → dist/packages/core/src}/modules/format.d.ts +6 -6
  38. package/{lib → dist/packages/core/src}/modules/formula.d.ts +54 -54
  39. package/{es → dist/packages/core/src}/modules/freeze.d.ts +5 -5
  40. package/{es → dist/packages/core/src}/modules/hyperlink.d.ts +21 -21
  41. package/{lib → dist/packages/core/src}/modules/iframe.d.ts +12 -12
  42. package/{es → dist/packages/core/src}/modules/image.d.ts +31 -31
  43. package/{es → dist/packages/core/src}/modules/index.d.ts +36 -36
  44. package/{lib → dist/packages/core/src}/modules/inline-string.d.ts +36 -36
  45. package/{es → dist/packages/core/src}/modules/location.d.ts +6 -6
  46. package/{es → dist/packages/core/src}/modules/locationCondition.d.ts +21 -21
  47. package/{es → dist/packages/core/src}/modules/merge.d.ts +3 -3
  48. package/{es → dist/packages/core/src}/modules/mobile.d.ts +5 -5
  49. package/{lib → dist/packages/core/src}/modules/moveCells.d.ts +5 -5
  50. package/{lib → dist/packages/core/src}/modules/protection.d.ts +5 -5
  51. package/{lib → dist/packages/core/src}/modules/refresh.d.ts +3 -3
  52. package/{es → dist/packages/core/src}/modules/rowcol.d.ts +19 -19
  53. package/{lib → dist/packages/core/src}/modules/screenshot.d.ts +2 -2
  54. package/{es → dist/packages/core/src}/modules/searchReplace.d.ts +36 -36
  55. package/{lib → dist/packages/core/src}/modules/selection.d.ts +46 -46
  56. package/{es → dist/packages/core/src}/modules/sheet.d.ts +10 -10
  57. package/{es → dist/packages/core/src}/modules/sort.d.ts +7 -7
  58. package/{es → dist/packages/core/src}/modules/splitColumn.d.ts +5 -5
  59. package/{es → dist/packages/core/src}/modules/text.d.ts +10 -10
  60. package/{lib → dist/packages/core/src}/modules/toolbar.d.ts +32 -32
  61. package/{es → dist/packages/core/src}/modules/validation.d.ts +19 -19
  62. package/{es → dist/packages/core/src}/modules/zoom.d.ts +3 -3
  63. package/{es → dist/packages/core/src}/settings.d.ts +100 -100
  64. package/{es → dist/packages/core/src}/types.d.ts +371 -376
  65. package/{es → dist/packages/core/src}/utils/freeze.d.ts +7 -7
  66. package/{es → dist/packages/core/src}/utils/index.d.ts +18 -19
  67. package/{lib → dist/packages/core/src}/utils/patch.d.ts +37 -37
  68. package/dist/packages/react/src/components/ChangeColor/index.d.ts +7 -0
  69. package/dist/packages/react/src/components/ConditionFormat/ConditionRules.d.ts +6 -0
  70. package/dist/packages/react/src/components/ConditionFormat/index.d.ts +7 -0
  71. package/dist/packages/react/src/components/ContextMenu/Divider.d.ts +3 -0
  72. package/dist/packages/react/src/components/ContextMenu/FilterMenu.d.ts +3 -0
  73. package/dist/packages/react/src/components/ContextMenu/Menu.d.ts +8 -0
  74. package/dist/packages/react/src/components/ContextMenu/SheetTab.d.ts +4 -0
  75. package/dist/packages/react/src/components/ContextMenu/index.d.ts +5 -0
  76. package/dist/packages/react/src/components/CustomSort/index.d.ts +4 -0
  77. package/dist/packages/react/src/components/DataVerification/DropdownList.d.ts +4 -0
  78. package/dist/packages/react/src/components/DataVerification/RangeDialog.d.ts +4 -0
  79. package/dist/packages/react/src/components/DataVerification/getDisplayedRangeTxt.d.ts +2 -0
  80. package/dist/packages/react/src/components/DataVerification/index.d.ts +4 -0
  81. package/dist/packages/react/src/components/Dialog/index.d.ts +15 -0
  82. package/dist/packages/react/src/components/DuneChartsInputModal/DuneChartsInputModal.d.ts +11 -0
  83. package/dist/packages/react/src/components/DunePreview/DunePreview.d.ts +13 -0
  84. package/dist/packages/react/src/components/FilterOption/index.d.ts +5 -0
  85. package/dist/packages/react/src/components/FormatSearch/index.d.ts +6 -0
  86. package/dist/packages/react/src/components/FormulaSearch/index.d.ts +5 -0
  87. package/dist/packages/react/src/components/FxEditor/NameBox.d.ts +3 -0
  88. package/dist/packages/react/src/components/FxEditor/index.d.ts +4 -0
  89. package/dist/packages/react/src/components/IFrameBoxs/iFrameBoxs.d.ts +4 -0
  90. package/dist/packages/react/src/components/ImgBoxs/index.d.ts +3 -0
  91. package/dist/packages/react/src/components/LinkEidtCard/index.d.ts +5 -0
  92. package/dist/packages/react/src/components/LocationCondition/index.d.ts +3 -0
  93. package/dist/packages/react/src/components/MessageBox/index.d.ts +9 -0
  94. package/dist/packages/react/src/components/NotationBoxes/index.d.ts +3 -0
  95. package/dist/packages/react/src/components/ResetColumnWidth/index.d.ts +2 -0
  96. package/dist/packages/react/src/components/SVGDefines.d.ts +5 -0
  97. package/dist/packages/react/src/components/SVGIcon.d.ts +9 -0
  98. package/dist/packages/react/src/components/SearchReplace/index.d.ts +6 -0
  99. package/dist/packages/react/src/components/Sheet/index.d.ts +8 -0
  100. package/dist/packages/react/src/components/SheetList/SheetHiddenButton.d.ts +8 -0
  101. package/dist/packages/react/src/components/SheetList/SheetListItem.d.ts +9 -0
  102. package/dist/packages/react/src/components/SheetList/index.d.ts +4 -0
  103. package/dist/packages/react/src/components/SheetOverlay/ColumnHeader.d.ts +3 -0
  104. package/dist/packages/react/src/components/SheetOverlay/ContentEditable.d.ts +11 -0
  105. package/dist/packages/react/src/components/SheetOverlay/FormulaHint/index.d.ts +4 -0
  106. package/dist/packages/react/src/components/SheetOverlay/FormulaSearch/constant.d.ts +63 -0
  107. package/dist/packages/react/src/components/SheetOverlay/FormulaSearch/index.d.ts +4 -0
  108. package/dist/packages/react/src/components/SheetOverlay/InputBox.d.ts +3 -0
  109. package/dist/packages/react/src/components/SheetOverlay/RowHeader.d.ts +3 -0
  110. package/dist/packages/react/src/components/SheetOverlay/ScrollBar/index.d.ts +7 -0
  111. package/dist/packages/react/src/components/SheetOverlay/index.d.ts +4 -0
  112. package/dist/packages/react/src/components/SheetTab/SheetItem.d.ts +8 -0
  113. package/dist/packages/react/src/components/SheetTab/index.d.ts +4 -0
  114. package/dist/packages/react/src/components/SplitColumn/index.d.ts +3 -0
  115. package/dist/packages/react/src/components/Toolbar/Button.d.ts +12 -0
  116. package/dist/packages/react/src/components/Toolbar/ColorPicker.d.ts +6 -0
  117. package/dist/packages/react/src/components/Toolbar/Combo.d.ts +12 -0
  118. package/dist/packages/react/src/components/Toolbar/CustomBorder.d.ts +7 -0
  119. package/dist/packages/react/src/components/Toolbar/CustomButton.d.ts +11 -0
  120. package/dist/packages/react/src/components/Toolbar/CustomColor.d.ts +8 -0
  121. package/dist/packages/react/src/components/Toolbar/CustomIcon.d.ts +9 -0
  122. package/dist/packages/react/src/components/Toolbar/Divider.d.ts +4 -0
  123. package/dist/packages/react/src/components/Toolbar/MoreItemsContainer.d.ts +6 -0
  124. package/dist/packages/react/src/components/Toolbar/Select.d.ts +14 -0
  125. package/dist/packages/react/src/components/Toolbar/index.d.ts +10 -0
  126. package/dist/packages/react/src/components/Workbook/api.d.ts +1177 -0
  127. package/dist/packages/react/src/components/Workbook/index.d.ts +1185 -0
  128. package/dist/packages/react/src/components/ZoomControl/index.d.ts +4 -0
  129. package/dist/packages/react/src/components/index.d.ts +4 -0
  130. package/dist/packages/react/src/constants.d.ts +1 -0
  131. package/dist/packages/react/src/context/index.d.ts +25 -0
  132. package/dist/packages/react/src/context/modal.d.ts +10 -0
  133. package/dist/packages/react/src/hooks/useAlert.d.ts +4 -0
  134. package/dist/packages/react/src/hooks/useDialog.d.ts +5 -0
  135. package/dist/packages/react/src/hooks/useOutsideClick.d.ts +2 -0
  136. package/dist/packages/react/src/hooks/usePrevious.d.ts +2 -0
  137. package/dist/packages/react/src/index.d.ts +1 -0
  138. package/dist/packages/react/src/utils/datepickerStyles.d.ts +2 -0
  139. package/dist/stories/API.stories.d.ts +1210 -0
  140. package/dist/stories/Collabration.stories.d.ts +2359 -0
  141. package/dist/stories/Features.stories.d.ts +9430 -0
  142. package/dist/stories/data/cell.d.ts +983 -0
  143. package/dist/stories/data/dataVerification.d.ts +131 -0
  144. package/dist/stories/data/empty.d.ts +10 -0
  145. package/dist/stories/data/formula.d.ts +362 -0
  146. package/dist/stories/data/freeze.d.ts +34 -0
  147. package/dist/stories/data/protected.d.ts +40 -0
  148. package/dist/stories/utils.d.ts +1 -0
  149. package/package.json +6 -7
  150. package/es/api/cell.js +0 -204
  151. package/es/api/common.d.ts +0 -71
  152. package/es/api/common.js +0 -79
  153. package/es/api/errors.js +0 -2
  154. package/es/api/index.js +0 -8
  155. package/es/api/merge.js +0 -15
  156. package/es/api/range.d.ts +0 -22
  157. package/es/api/range.js +0 -123
  158. package/es/api/rowcol.d.ts +0 -14
  159. package/es/api/rowcol.js +0 -207
  160. package/es/api/sheet.d.ts +0 -10
  161. package/es/api/sheet.js +0 -128
  162. package/es/api/workbook.d.ts +0 -15
  163. package/es/api/workbook.js +0 -85
  164. package/es/canvas.d.ts +0 -46
  165. package/es/canvas.js +0 -1350
  166. package/es/context.js +0 -381
  167. package/es/events/copy.js +0 -78
  168. package/es/events/index.d.ts +0 -4
  169. package/es/events/index.js +0 -4
  170. package/es/events/keyboard.d.ts +0 -6
  171. package/es/events/keyboard.js +0 -332
  172. package/es/events/mouse.js +0 -1725
  173. package/es/events/paste.js +0 -1378
  174. package/es/index.d.ts +0 -10
  175. package/es/index.js +0 -10
  176. package/es/locale/en.d.ts +0 -992
  177. package/es/locale/en.js +0 -10564
  178. package/es/locale/es.d.ts +0 -1134
  179. package/es/locale/es.js +0 -10010
  180. package/es/locale/hi.d.ts +0 -1030
  181. package/es/locale/hi.js +0 -10550
  182. package/es/locale/index.d.ts +0 -1049
  183. package/es/locale/index.js +0 -23
  184. package/es/locale/zh.js +0 -10568
  185. package/es/locale/zh_tw.d.ts +0 -1187
  186. package/es/locale/zh_tw.js +0 -10072
  187. package/es/modules/ConditionFormat.d.ts +0 -17
  188. package/es/modules/ConditionFormat.js +0 -1258
  189. package/es/modules/border.d.ts +0 -3
  190. package/es/modules/border.js +0 -1240
  191. package/es/modules/cell.d.ts +0 -32
  192. package/es/modules/cell.js +0 -1055
  193. package/es/modules/clipboard.js +0 -36
  194. package/es/modules/color.js +0 -1
  195. package/es/modules/comment.d.ts +0 -97
  196. package/es/modules/comment.js +0 -597
  197. package/es/modules/conditionalFormat.js +0 -441
  198. package/es/modules/cursor.js +0 -62
  199. package/es/modules/dataVerification.js +0 -701
  200. package/es/modules/dropCell.js +0 -2267
  201. package/es/modules/filter.d.ts +0 -45
  202. package/es/modules/filter.js +0 -434
  203. package/es/modules/format.js +0 -323
  204. package/es/modules/formula.d.ts +0 -54
  205. package/es/modules/formula.js +0 -2301
  206. package/es/modules/freeze.js +0 -148
  207. package/es/modules/hyperlink.js +0 -216
  208. package/es/modules/iframe.d.ts +0 -12
  209. package/es/modules/iframe.js +0 -220
  210. package/es/modules/image.js +0 -253
  211. package/es/modules/index.js +0 -36
  212. package/es/modules/inline-string.d.ts +0 -36
  213. package/es/modules/inline-string.js +0 -437
  214. package/es/modules/location.js +0 -46
  215. package/es/modules/locationCondition.js +0 -218
  216. package/es/modules/merge.js +0 -216
  217. package/es/modules/mobile.js +0 -33
  218. package/es/modules/moveCells.d.ts +0 -5
  219. package/es/modules/moveCells.js +0 -348
  220. package/es/modules/protection.d.ts +0 -5
  221. package/es/modules/protection.js +0 -96
  222. package/es/modules/refresh.d.ts +0 -3
  223. package/es/modules/refresh.js +0 -34
  224. package/es/modules/rowcol.js +0 -1922
  225. package/es/modules/screenshot.d.ts +0 -2
  226. package/es/modules/screenshot.js +0 -90
  227. package/es/modules/searchReplace.js +0 -388
  228. package/es/modules/selection.d.ts +0 -46
  229. package/es/modules/selection.js +0 -1674
  230. package/es/modules/sheet.js +0 -237
  231. package/es/modules/sort.js +0 -134
  232. package/es/modules/splitColumn.js +0 -126
  233. package/es/modules/ssf.js +0 -1533
  234. package/es/modules/text.js +0 -1207
  235. package/es/modules/toolbar.d.ts +0 -32
  236. package/es/modules/toolbar.js +0 -970
  237. package/es/modules/validation.js +0 -190
  238. package/es/modules/zoom.js +0 -29
  239. package/es/settings.js +0 -36
  240. package/es/types.js +0 -1
  241. package/es/utils/freeze.js +0 -86
  242. package/es/utils/index.js +0 -198
  243. package/es/utils/patch.d.ts +0 -37
  244. package/es/utils/patch.js +0 -381
  245. package/lib/api/cell.d.ts +0 -10
  246. package/lib/api/cell.js +0 -215
  247. package/lib/api/common.js +0 -88
  248. package/lib/api/errors.d.ts +0 -2
  249. package/lib/api/errors.js +0 -8
  250. package/lib/api/index.d.ts +0 -9
  251. package/lib/api/index.js +0 -101
  252. package/lib/api/merge.d.ts +0 -5
  253. package/lib/api/merge.js +0 -22
  254. package/lib/api/range.js +0 -138
  255. package/lib/api/rowcol.js +0 -222
  256. package/lib/api/sheet.js +0 -145
  257. package/lib/api/workbook.js +0 -98
  258. package/lib/canvas.js +0 -1356
  259. package/lib/context.d.ts +0 -198
  260. package/lib/context.js +0 -393
  261. package/lib/events/copy.d.ts +0 -2
  262. package/lib/events/copy.js +0 -85
  263. package/lib/events/index.js +0 -49
  264. package/lib/events/keyboard.js +0 -342
  265. package/lib/events/mouse.d.ts +0 -22
  266. package/lib/events/mouse.js +0 -1744
  267. package/lib/events/paste.d.ts +0 -3
  268. package/lib/events/paste.js +0 -1386
  269. package/lib/index.js +0 -109
  270. package/lib/locale/en.js +0 -10570
  271. package/lib/locale/es.js +0 -10016
  272. package/lib/locale/hi.js +0 -10556
  273. package/lib/locale/index.js +0 -29
  274. package/lib/locale/zh.d.ts +0 -1048
  275. package/lib/locale/zh.js +0 -10574
  276. package/lib/locale/zh_tw.js +0 -10078
  277. package/lib/modules/ConditionFormat.js +0 -1273
  278. package/lib/modules/border.js +0 -1248
  279. package/lib/modules/cell.js +0 -1085
  280. package/lib/modules/clipboard.d.ts +0 -3
  281. package/lib/modules/clipboard.js +0 -42
  282. package/lib/modules/color.d.ts +0 -1
  283. package/lib/modules/color.js +0 -7
  284. package/lib/modules/comment.js +0 -625
  285. package/lib/modules/conditionalFormat.d.ts +0 -2
  286. package/lib/modules/conditionalFormat.js +0 -447
  287. package/lib/modules/cursor.d.ts +0 -3
  288. package/lib/modules/cursor.js +0 -70
  289. package/lib/modules/dataVerification.d.ts +0 -11
  290. package/lib/modules/dataVerification.js +0 -716
  291. package/lib/modules/dropCell.d.ts +0 -10
  292. package/lib/modules/dropCell.js +0 -2283
  293. package/lib/modules/filter.js +0 -448
  294. package/lib/modules/format.d.ts +0 -6
  295. package/lib/modules/format.js +0 -334
  296. package/lib/modules/formula.js +0 -2330
  297. package/lib/modules/freeze.d.ts +0 -5
  298. package/lib/modules/freeze.js +0 -158
  299. package/lib/modules/hyperlink.d.ts +0 -21
  300. package/lib/modules/hyperlink.js +0 -232
  301. package/lib/modules/iframe.js +0 -236
  302. package/lib/modules/image.d.ts +0 -31
  303. package/lib/modules/image.js +0 -272
  304. package/lib/modules/index.d.ts +0 -36
  305. package/lib/modules/index.js +0 -401
  306. package/lib/modules/inline-string.js +0 -452
  307. package/lib/modules/location.d.ts +0 -6
  308. package/lib/modules/location.js +0 -57
  309. package/lib/modules/locationCondition.d.ts +0 -21
  310. package/lib/modules/locationCondition.js +0 -229
  311. package/lib/modules/merge.d.ts +0 -3
  312. package/lib/modules/merge.js +0 -223
  313. package/lib/modules/mobile.d.ts +0 -5
  314. package/lib/modules/mobile.js +0 -41
  315. package/lib/modules/moveCells.js +0 -357
  316. package/lib/modules/protection.js +0 -106
  317. package/lib/modules/refresh.js +0 -40
  318. package/lib/modules/rowcol.d.ts +0 -19
  319. package/lib/modules/rowcol.js +0 -1935
  320. package/lib/modules/screenshot.js +0 -96
  321. package/lib/modules/searchReplace.d.ts +0 -36
  322. package/lib/modules/searchReplace.js +0 -402
  323. package/lib/modules/selection.js +0 -1703
  324. package/lib/modules/sheet.d.ts +0 -10
  325. package/lib/modules/sheet.js +0 -250
  326. package/lib/modules/sort.d.ts +0 -7
  327. package/lib/modules/sort.js +0 -143
  328. package/lib/modules/splitColumn.d.ts +0 -5
  329. package/lib/modules/splitColumn.js +0 -136
  330. package/lib/modules/ssf.js +0 -1539
  331. package/lib/modules/text.d.ts +0 -10
  332. package/lib/modules/text.js +0 -1221
  333. package/lib/modules/toolbar.js +0 -1003
  334. package/lib/modules/validation.d.ts +0 -19
  335. package/lib/modules/validation.js +0 -205
  336. package/lib/modules/zoom.d.ts +0 -3
  337. package/lib/modules/zoom.js +0 -36
  338. package/lib/settings.d.ts +0 -100
  339. package/lib/settings.js +0 -42
  340. package/lib/types.d.ts +0 -376
  341. package/lib/types.js +0 -5
  342. package/lib/utils/freeze.d.ts +0 -7
  343. package/lib/utils/freeze.js +0 -92
  344. package/lib/utils/index.d.ts +0 -19
  345. package/lib/utils/index.js +0 -258
  346. package/lib/utils/patch.js +0 -392
@@ -1,1003 +0,0 @@
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
- }