@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
package/es/api/rowcol.js DELETED
@@ -1,207 +0,0 @@
1
- import _ from "lodash";
2
- import { deleteRowCol, insertRowCol } from "../modules";
3
- import { getSheet } from "./common";
4
- import { INVALID_PARAMS } from "./errors";
5
- import { getSheetIndex } from "../utils";
6
- export function freeze(ctx, type, range, options) {
7
- if (options === void 0) {
8
- options = {};
9
- }
10
- var sheet = getSheet(ctx, options);
11
- var typeMap = {
12
- row: "rangeRow",
13
- column: "rangeColumn",
14
- both: "rangeBoth"
15
- };
16
- var innerType = typeMap[type];
17
- sheet.frozen = {
18
- type: innerType,
19
- range: {
20
- column_focus: range.column,
21
- row_focus: range.row
22
- }
23
- };
24
- }
25
- export function insertRowOrColumn(ctx, type, index, count, direction, options) {
26
- if (options === void 0) {
27
- options = {};
28
- }
29
- if (!["row", "column"].includes(type) || !_.isNumber(index) || !_.isNumber(count) || !["lefttop", "rightbottom"].includes(direction)) {
30
- throw INVALID_PARAMS;
31
- }
32
- var sheet = getSheet(ctx, options);
33
- try {
34
- insertRowCol(ctx, {
35
- type: type,
36
- index: index,
37
- count: count,
38
- direction: direction,
39
- id: sheet.id
40
- });
41
- } catch (e) {
42
- console.error(e);
43
- }
44
- }
45
- export function deleteRowOrColumn(ctx, type, start, end, options) {
46
- if (options === void 0) {
47
- options = {};
48
- }
49
- if (!["row", "column"].includes(type) || !_.isNumber(start) || !_.isNumber(end)) {
50
- throw INVALID_PARAMS;
51
- }
52
- var sheet = getSheet(ctx, options);
53
- deleteRowCol(ctx, {
54
- type: type,
55
- start: start,
56
- end: end,
57
- id: sheet.id
58
- });
59
- }
60
- export function hideRowOrColumn(ctx, rowColInfo, type) {
61
- var _a, _b;
62
- if (!["row", "column"].includes(type)) {
63
- throw INVALID_PARAMS;
64
- }
65
- if (!ctx || !ctx.config) return;
66
- var index = getSheetIndex(ctx, ctx.currentSheetId);
67
- if (type === "row") {
68
- var rowhidden_1 = (_a = ctx.config.rowhidden) !== null && _a !== void 0 ? _a : {};
69
- rowColInfo.forEach(function (r) {
70
- rowhidden_1[r] = 0;
71
- });
72
- ctx.config.rowhidden = rowhidden_1;
73
- } else if (type === "column") {
74
- var colhidden_1 = (_b = ctx.config.colhidden) !== null && _b !== void 0 ? _b : {};
75
- rowColInfo.forEach(function (r) {
76
- colhidden_1[r] = 0;
77
- });
78
- ctx.config.colhidden = colhidden_1;
79
- }
80
- ctx.luckysheetfile[index].config = ctx.config;
81
- }
82
- export function showRowOrColumn(ctx, rowColInfo, type) {
83
- var _a, _b;
84
- if (!["row", "column"].includes(type)) {
85
- throw INVALID_PARAMS;
86
- }
87
- if (!ctx || !ctx.config) return;
88
- var index = getSheetIndex(ctx, ctx.currentSheetId);
89
- if (type === "row") {
90
- var rowhidden_2 = (_a = ctx.config.rowhidden) !== null && _a !== void 0 ? _a : {};
91
- rowColInfo.forEach(function (r) {
92
- delete rowhidden_2[r];
93
- });
94
- ctx.config.rowhidden = rowhidden_2;
95
- } else if (type === "column") {
96
- var colhidden_2 = (_b = ctx.config.colhidden) !== null && _b !== void 0 ? _b : {};
97
- rowColInfo.forEach(function (r) {
98
- delete colhidden_2[r];
99
- });
100
- ctx.config.colhidden = colhidden_2;
101
- }
102
- ctx.luckysheetfile[index].config = ctx.config;
103
- }
104
- export function setRowHeight(ctx, rowInfo, options, custom) {
105
- if (options === void 0) {
106
- options = {};
107
- }
108
- if (custom === void 0) {
109
- custom = false;
110
- }
111
- if (!_.isPlainObject(rowInfo)) {
112
- throw INVALID_PARAMS;
113
- }
114
- var sheet = getSheet(ctx, options);
115
- var cfg = sheet.config || {};
116
- if (cfg.rowlen == null) {
117
- cfg.rowlen = {};
118
- }
119
- _.forEach(rowInfo, function (len, r) {
120
- var _a;
121
- if (Number(r) >= 0) {
122
- if (Number(len) >= 0) {
123
- cfg.rowlen[Number(r)] = Number(len);
124
- if (custom && _.isUndefined(cfg.customHeight)) {
125
- cfg.customHeight = (_a = {}, _a[r] = 1, _a);
126
- } else if (custom) {
127
- cfg.customHeight[r] = 1;
128
- }
129
- }
130
- }
131
- });
132
- sheet.config = cfg;
133
- if (ctx.currentSheetId === sheet.id) {
134
- ctx.config = cfg;
135
- }
136
- }
137
- export function setColumnWidth(ctx, columnInfo, options, custom) {
138
- if (options === void 0) {
139
- options = {};
140
- }
141
- if (custom === void 0) {
142
- custom = false;
143
- }
144
- if (!_.isPlainObject(columnInfo)) {
145
- throw INVALID_PARAMS;
146
- }
147
- var sheet = getSheet(ctx, options);
148
- var cfg = sheet.config || {};
149
- if (cfg.columnlen == null) {
150
- cfg.columnlen = {};
151
- }
152
- _.forEach(columnInfo, function (len, c) {
153
- var _a;
154
- if (Number(c) >= 0) {
155
- if (Number(len) >= 0) {
156
- cfg.columnlen[Number(c)] = Number(len);
157
- if (custom && _.isUndefined(cfg.customWidth)) {
158
- cfg.customWidth = (_a = {}, _a[c] = 1, _a);
159
- } else if (custom) {
160
- cfg.customWidth[c] = 1;
161
- }
162
- }
163
- }
164
- });
165
- sheet.config = cfg;
166
- if (ctx.currentSheetId === sheet.id) {
167
- ctx.config = cfg;
168
- }
169
- }
170
- export function getRowHeight(ctx, rows, options) {
171
- if (options === void 0) {
172
- options = {};
173
- }
174
- if (!_.isArray(rows) || rows.length === 0) {
175
- throw INVALID_PARAMS;
176
- }
177
- var sheet = getSheet(ctx, options);
178
- var cfg = sheet.config || {};
179
- var rowlen = cfg.rowlen || {};
180
- var rowlenObj = {};
181
- rows.forEach(function (item) {
182
- if (Number(item) >= 0) {
183
- var size = rowlen[Number(item)] || ctx.defaultrowlen;
184
- rowlenObj[Number(item)] = size;
185
- }
186
- });
187
- return rowlenObj;
188
- }
189
- export function getColumnWidth(ctx, columns, options) {
190
- if (options === void 0) {
191
- options = {};
192
- }
193
- if (!_.isArray(columns) || columns.length === 0) {
194
- throw INVALID_PARAMS;
195
- }
196
- var sheet = getSheet(ctx, options);
197
- var cfg = sheet.config || {};
198
- var columnlen = cfg.columnlen || {};
199
- var columnlenObj = {};
200
- columns.forEach(function (item) {
201
- if (Number(item) >= 0) {
202
- var size = columnlen[Number(item)] || ctx.defaultcollen;
203
- columnlenObj[Number(item)] = size;
204
- }
205
- });
206
- return columnlenObj;
207
- }
package/es/api/sheet.d.ts DELETED
@@ -1,10 +0,0 @@
1
- import { getSheet } from "./common";
2
- import { Context } from "../context";
3
- import { CellMatrix, Sheet } from "../types";
4
- export declare function getAllSheets(ctx: Context): Sheet[];
5
- export { getSheet };
6
- export declare function initSheetData(draftCtx: Context, index: number, newData: Sheet): CellMatrix | null;
7
- export declare function hideSheet(ctx: Context, sheetId: string): void;
8
- export declare function showSheet(ctx: Context, sheetId: string): void;
9
- export declare function copySheet(ctx: Context, sheetId: string): void;
10
- export declare function calculateSheetFromula(ctx: Context, id: string): void;
package/es/api/sheet.js DELETED
@@ -1,128 +0,0 @@
1
- import _ from "lodash";
2
- import { v4 as uuidv4 } from "uuid";
3
- import { dataToCelldata, getSheet } from "./common";
4
- import { getSheetIndex } from "../utils";
5
- import { api, execfunction, insertUpdateFunctionGroup, locale } from "..";
6
- export function getAllSheets(ctx) {
7
- return ctx.luckysheetfile;
8
- }
9
- export { getSheet };
10
- export function initSheetData(draftCtx, index, newData) {
11
- var _a, _b;
12
- var celldata = newData.celldata,
13
- row = newData.row,
14
- column = newData.column;
15
- var lastRow = _.maxBy(celldata, "r");
16
- var lastCol = _.maxBy(celldata, "c");
17
- var lastRowNum = ((_a = lastRow === null || lastRow === void 0 ? void 0 : lastRow.r) !== null && _a !== void 0 ? _a : 0) + 1;
18
- var lastColNum = ((_b = lastCol === null || lastCol === void 0 ? void 0 : lastCol.c) !== null && _b !== void 0 ? _b : 0) + 1;
19
- if (row != null && column != null && row > 0 && column > 0) {
20
- lastRowNum = Math.max(lastRowNum, row);
21
- lastColNum = Math.max(lastColNum, column);
22
- } else {
23
- lastRowNum = Math.max(lastRowNum, draftCtx.defaultrowNum);
24
- lastColNum = Math.max(lastColNum, draftCtx.defaultcolumnNum);
25
- }
26
- if (lastRowNum && lastColNum) {
27
- var expandedData_1 = _.times(lastRowNum, function () {
28
- return _.times(lastColNum, function () {
29
- return null;
30
- });
31
- });
32
- celldata === null || celldata === void 0 ? void 0 : celldata.forEach(function (d) {
33
- expandedData_1[d.r][d.c] = d.v;
34
- });
35
- if (draftCtx.luckysheetfile[index] == null) {
36
- newData.data = expandedData_1;
37
- delete newData.celldata;
38
- draftCtx.luckysheetfile.push(newData);
39
- } else {
40
- draftCtx.luckysheetfile[index].data = expandedData_1;
41
- delete draftCtx.luckysheetfile[index].celldata;
42
- }
43
- return expandedData_1;
44
- }
45
- return null;
46
- }
47
- export function hideSheet(ctx, sheetId) {
48
- var index = getSheetIndex(ctx, sheetId);
49
- ctx.luckysheetfile[index].hide = 1;
50
- ctx.luckysheetfile[index].status = 0;
51
- var shownSheets = ctx.luckysheetfile.filter(function (sheet) {
52
- return _.isUndefined(sheet.hide) || (sheet === null || sheet === void 0 ? void 0 : sheet.hide) !== 1;
53
- });
54
- ctx.currentSheetId = shownSheets[0].id;
55
- }
56
- export function showSheet(ctx, sheetId) {
57
- var index = getSheetIndex(ctx, sheetId);
58
- ctx.luckysheetfile[index].hide = undefined;
59
- }
60
- function generateCopySheetName(ctx, sheetId) {
61
- var info = locale(ctx).info;
62
- var copyWord = "(".concat(info.copy);
63
- var SheetIndex = getSheetIndex(ctx, sheetId);
64
- var sheetName = ctx.luckysheetfile[SheetIndex].name;
65
- var copy_i = sheetName.indexOf(copyWord);
66
- var index = 0;
67
- if (copy_i !== -1) {
68
- sheetName = sheetName.toString().substring(0, copy_i);
69
- }
70
- var nameCopy = sheetName + copyWord;
71
- var sheetNames = [];
72
- for (var i = 0; i < ctx.luckysheetfile.length; i += 1) {
73
- var fileName = ctx.luckysheetfile[i].name;
74
- sheetNames.push(fileName);
75
- var st_i = fileName.indexOf(nameCopy);
76
- if (st_i === 0) {
77
- index = index || 2;
78
- var ed_i = fileName.indexOf(")", st_i + nameCopy.length);
79
- var num = fileName.substring(st_i + nameCopy.length, ed_i);
80
- if (_.isNumber(num)) {
81
- if (Number.parseInt(num, 10) >= index) {
82
- index = Number.parseInt(num, 10) + 1;
83
- }
84
- }
85
- }
86
- }
87
- var sheetCopyName;
88
- do {
89
- var postfix = "".concat(copyWord + (index || ""), ")");
90
- var lengthLimit = 31 - postfix.length;
91
- sheetCopyName = sheetName;
92
- if (sheetCopyName.length > lengthLimit) {
93
- sheetCopyName = "".concat(sheetCopyName.slice(0, lengthLimit - 1), "\u2026");
94
- }
95
- sheetCopyName += postfix;
96
- index = (index || 1) + 1;
97
- } while (sheetNames.indexOf(sheetCopyName) !== -1);
98
- return sheetCopyName;
99
- }
100
- export function copySheet(ctx, sheetId) {
101
- var index = getSheetIndex(ctx, sheetId);
102
- var order = ctx.luckysheetfile[index].order + 1;
103
- var sheetName = generateCopySheetName(ctx, sheetId);
104
- var sheetData = _.cloneDeep(ctx.luckysheetfile[index]);
105
- delete sheetData.id;
106
- delete sheetData.status;
107
- sheetData.celldata = dataToCelldata(sheetData.data);
108
- delete sheetData.data;
109
- api.addSheet(ctx, undefined, uuidv4(), ctx.luckysheetfile[index].isPivotTable, sheetName, sheetData);
110
- var sheetOrderList = {};
111
- sheetOrderList[ctx.luckysheetfile[ctx.luckysheetfile.length - 1].id] = order;
112
- api.setSheetOrder(ctx, sheetOrderList);
113
- }
114
- export function calculateSheetFromula(ctx, id) {
115
- var _a, _b;
116
- var index = getSheetIndex(ctx, id);
117
- if (!ctx.luckysheetfile[index].data) return;
118
- for (var r = 0; r < ctx.luckysheetfile[index].data.length; r += 1) {
119
- for (var c = 0; c < ctx.luckysheetfile[index].data[r].length; c += 1) {
120
- if (!((_a = ctx.luckysheetfile[index].data[r][c]) === null || _a === void 0 ? void 0 : _a.f)) {
121
- continue;
122
- }
123
- var result = execfunction(ctx, (_b = ctx.luckysheetfile[index].data[r][c]) === null || _b === void 0 ? void 0 : _b.f, r, c, id);
124
- api.setCellValue(ctx, r, c, result[1], null);
125
- insertUpdateFunctionGroup(ctx, r, c, id);
126
- }
127
- }
128
- }
@@ -1,15 +0,0 @@
1
- import { Context, Sheet } from "..";
2
- import { Settings } from "../settings";
3
- import { CommonOptions } from "./common";
4
- export declare function addSheet(ctx: Context, settings?: Required<Settings>, newSheetID?: string, isPivotTable?: boolean, sheetname?: string | undefined, sheetData?: Sheet | undefined): void;
5
- export declare function deleteSheet(ctx: Context, options?: CommonOptions): void;
6
- export declare function updateSheet(ctx: Context, data: Sheet[]): void;
7
- export declare function activateSheet(ctx: Context, options?: CommonOptions): void;
8
- export declare function setSheetName(ctx: Context, name: string, options?: CommonOptions): void;
9
- export declare function setSheetOrder(ctx: Context, orderList: Record<string, number>): void;
10
- export declare function scroll(ctx: Context, scrollbarX: HTMLDivElement | null, scrollbarY: HTMLDivElement | null, options: {
11
- scrollLeft?: number;
12
- scrollTop?: number;
13
- targetRow?: number;
14
- targetColumn?: number;
15
- }): void;
@@ -1,85 +0,0 @@
1
- import _ from "lodash";
2
- import { addSheet as addSheetInternal, deleteSheet as deleteSheetInternal, updateSheet as updateSheetInternal } from "../modules";
3
- import { getSheet } from "./common";
4
- import { INVALID_PARAMS } from "./errors";
5
- export function addSheet(ctx, settings, newSheetID, isPivotTable, sheetname, sheetData) {
6
- if (isPivotTable === void 0) {
7
- isPivotTable = false;
8
- }
9
- if (sheetname === void 0) {
10
- sheetname = undefined;
11
- }
12
- if (sheetData === void 0) {
13
- sheetData = undefined;
14
- }
15
- addSheetInternal(ctx, settings, newSheetID, isPivotTable, sheetname, sheetData);
16
- }
17
- export function deleteSheet(ctx, options) {
18
- if (options === void 0) {
19
- options = {};
20
- }
21
- var sheet = getSheet(ctx, options);
22
- deleteSheetInternal(ctx, sheet.id);
23
- }
24
- export function updateSheet(ctx, data) {
25
- updateSheetInternal(ctx, data);
26
- }
27
- export function activateSheet(ctx, options) {
28
- if (options === void 0) {
29
- options = {};
30
- }
31
- var sheet = getSheet(ctx, options);
32
- ctx.currentSheetId = sheet.id;
33
- }
34
- export function setSheetName(ctx, name, options) {
35
- if (options === void 0) {
36
- options = {};
37
- }
38
- var sheet = getSheet(ctx, options);
39
- sheet.name = name;
40
- }
41
- export function setSheetOrder(ctx, orderList) {
42
- var _a;
43
- (_a = ctx.luckysheetfile) === null || _a === void 0 ? void 0 : _a.forEach(function (sheet) {
44
- if (sheet.id in orderList) {
45
- sheet.order = orderList[sheet.id];
46
- }
47
- });
48
- _.sortBy(ctx.luckysheetfile, ["order"]).forEach(function (sheet, i) {
49
- sheet.order = i;
50
- });
51
- }
52
- export function scroll(ctx, scrollbarX, scrollbarY, options) {
53
- if (options.scrollLeft != null) {
54
- if (!_.isNumber(options.scrollLeft)) {
55
- throw INVALID_PARAMS;
56
- }
57
- if (scrollbarX) {
58
- scrollbarX.scrollLeft = options.scrollLeft;
59
- }
60
- } else if (options.targetColumn != null) {
61
- if (!_.isNumber(options.targetColumn)) {
62
- throw INVALID_PARAMS;
63
- }
64
- var col_pre = options.targetColumn <= 0 ? 0 : ctx.visibledatacolumn[options.targetColumn - 1];
65
- if (scrollbarX) {
66
- scrollbarX.scrollLeft = col_pre;
67
- }
68
- }
69
- if (options.scrollTop != null) {
70
- if (!_.isNumber(options.scrollTop)) {
71
- throw INVALID_PARAMS;
72
- }
73
- if (scrollbarY) {
74
- scrollbarY.scrollTop = options.scrollTop;
75
- }
76
- } else if (options.targetRow != null) {
77
- if (!_.isNumber(options.targetRow)) {
78
- throw INVALID_PARAMS;
79
- }
80
- var row_pre = options.targetRow <= 0 ? 0 : ctx.visibledatarow[options.targetRow - 1];
81
- if (scrollbarY) {
82
- scrollbarY.scrollTop = row_pre;
83
- }
84
- }
85
- }
package/es/canvas.d.ts DELETED
@@ -1,46 +0,0 @@
1
- import { defaultContext } from "./context";
2
- export declare const defaultStyle: {
3
- fillStyle: string;
4
- textBaseline: string;
5
- strokeStyle: string;
6
- rowFillStyle: string;
7
- textAlign: string;
8
- };
9
- export declare class Canvas {
10
- canvasElement: HTMLCanvasElement;
11
- sheetCtx: ReturnType<typeof defaultContext>;
12
- measureTextCacheTimeOut: any;
13
- cellOverflowMapCache: any;
14
- constructor(canvasElement: HTMLCanvasElement, ctx: ReturnType<typeof defaultContext>);
15
- drawRowHeader(scrollHeight: number, drawHeight?: number, offsetTop?: number): void;
16
- drawColumnHeader(scrollWidth: number, drawWidth?: number, offsetLeft?: number): void;
17
- drawMain({ scrollWidth, scrollHeight, drawWidth, drawHeight, offsetLeft, offsetTop, columnOffsetCell, rowOffsetCell, clear, }: {
18
- scrollWidth: number;
19
- scrollHeight: number;
20
- drawWidth?: number;
21
- drawHeight?: number;
22
- offsetLeft?: number;
23
- offsetTop?: number;
24
- columnOffsetCell?: number;
25
- rowOffsetCell?: number;
26
- clear?: boolean;
27
- }): void;
28
- getCellOverflowMap(canvas: CanvasRenderingContext2D, colStart: number, colEnd: number, rowStart: number, rowEnd: number): any;
29
- nullCellRender(r: number, c: number, startY: number, startX: number, endY: number, endX: number, renderCtx: CanvasRenderingContext2D, afCompute: any, cfCompute: any, offsetLeft: number, offsetTop: number, dynamicArrayCompute: any, cellOverflowMap: any, colStart: number, colEnd: number, scrollHeight: number, scrollWidth: number, bodrder05: any, isMerge?: boolean): void;
30
- cellRender(r: number, c: number, startY: number, startX: number, endY: number, endX: number, value: any, renderCtx: CanvasRenderingContext2D, afCompute: any, cfCompute: any, offsetLeft: number, offsetTop: number, dynamicArrayCompute: any, cellOverflowMap: any, colStart: number, colEnd: number, scrollHeight: number, scrollWidth: number, bodrder05: number, isMerge?: boolean): void;
31
- cellOverflowRender(r: number, c: number, stc: number, edc: number, renderCtx: CanvasRenderingContext2D, scrollHeight: number, scrollWidth: number, offsetLeft: number, offsetTop: number, afCompute: any, cfCompute: any): void;
32
- cellOverflow_trace(r: number, curC: number, traceC: number, traceDir: string, horizonAlign: string, textMetrics: number): any;
33
- cellOverflow_colIn(map: any, r: number, c: number, col_st: number, col_ed: number): {
34
- colIn: boolean;
35
- colLast: boolean;
36
- rowIndex: number | undefined;
37
- colIndex: number | undefined;
38
- stc: number | undefined;
39
- edc: number | undefined;
40
- };
41
- cellTextRender(textInfo: any, ctx: CanvasRenderingContext2D, option: any): void;
42
- drawFreezeLine({ horizontalTop, verticalLeft, }: {
43
- horizontalTop?: number;
44
- verticalLeft?: number;
45
- }): void;
46
- }