@fileverse-dev/fortune-core 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (346) hide show
  1. package/{dist/packages/core/src → es}/api/cell.d.ts +10 -10
  2. package/es/api/cell.js +204 -0
  3. package/{dist/packages/core/src → es}/api/common.d.ts +71 -66
  4. package/es/api/common.js +79 -0
  5. package/{dist/packages/core/src → es}/api/errors.d.ts +2 -2
  6. package/es/api/errors.js +2 -0
  7. package/{dist/packages/core/src → es}/api/index.d.ts +9 -9
  8. package/es/api/index.js +8 -0
  9. package/{dist/packages/core/src → es}/api/merge.d.ts +5 -5
  10. package/es/api/merge.js +15 -0
  11. package/{dist/packages/core/src → es}/api/range.d.ts +22 -22
  12. package/es/api/range.js +123 -0
  13. package/{dist/packages/core/src → es}/api/rowcol.d.ts +14 -14
  14. package/es/api/rowcol.js +207 -0
  15. package/{dist/packages/core/src → es}/api/sheet.d.ts +10 -10
  16. package/es/api/sheet.js +128 -0
  17. package/{dist/packages/core/src → es}/api/workbook.d.ts +15 -15
  18. package/es/api/workbook.js +85 -0
  19. package/{dist/packages/core/src → es}/canvas.d.ts +46 -46
  20. package/es/canvas.js +1350 -0
  21. package/{dist/packages/core/src → es}/context.d.ts +198 -197
  22. package/es/context.js +381 -0
  23. package/{dist/packages/core/src → es}/events/copy.d.ts +2 -2
  24. package/es/events/copy.js +78 -0
  25. package/{dist/packages/core/src → es}/events/index.d.ts +4 -4
  26. package/es/events/index.js +4 -0
  27. package/{dist/packages/core/src → es}/events/keyboard.d.ts +6 -6
  28. package/es/events/keyboard.js +360 -0
  29. package/{dist/packages/core/src → es}/events/mouse.d.ts +22 -22
  30. package/es/events/mouse.js +1725 -0
  31. package/{dist/packages/core/src → es}/events/paste.d.ts +4 -3
  32. package/es/events/paste.js +1416 -0
  33. package/{dist/packages/core/src → es}/index.d.ts +10 -10
  34. package/es/index.js +10 -0
  35. package/{dist/packages/core/src → es}/locale/en.d.ts +993 -992
  36. package/es/locale/en.js +10140 -0
  37. package/{dist/packages/core/src → es}/locale/es.d.ts +1134 -1134
  38. package/es/locale/es.js +10010 -0
  39. package/{dist/packages/core/src → es}/locale/hi.d.ts +1030 -1030
  40. package/es/locale/hi.js +10550 -0
  41. package/{dist/packages/core/src → es}/locale/index.d.ts +1049 -1049
  42. package/es/locale/index.js +23 -0
  43. package/{dist/packages/core/src → es}/locale/zh.d.ts +1048 -1048
  44. package/es/locale/zh.js +10568 -0
  45. package/{dist/packages/core/src → es}/locale/zh_tw.d.ts +1187 -1187
  46. package/es/locale/zh_tw.js +10072 -0
  47. package/{dist/packages/core/src → es}/modules/ConditionFormat.d.ts +17 -17
  48. package/es/modules/ConditionFormat.js +1258 -0
  49. package/{dist/packages/core/src → es}/modules/border.d.ts +3 -3
  50. package/es/modules/border.js +1240 -0
  51. package/{dist/packages/core/src → es}/modules/cell.d.ts +32 -32
  52. package/es/modules/cell.js +1092 -0
  53. package/{dist/packages/core/src → es}/modules/clipboard.d.ts +3 -3
  54. package/es/modules/clipboard.js +36 -0
  55. package/{dist/packages/core/src → es}/modules/color.d.ts +1 -1
  56. package/es/modules/color.js +1 -0
  57. package/{dist/packages/core/src → es}/modules/comment.d.ts +97 -97
  58. package/es/modules/comment.js +597 -0
  59. package/{dist/packages/core/src → es}/modules/conditionalFormat.d.ts +2 -2
  60. package/es/modules/conditionalFormat.js +441 -0
  61. package/{dist/packages/core/src → es}/modules/cursor.d.ts +3 -3
  62. package/es/modules/cursor.js +62 -0
  63. package/{dist/packages/core/src → es}/modules/dataVerification.d.ts +11 -11
  64. package/es/modules/dataVerification.js +701 -0
  65. package/{dist/packages/core/src → es}/modules/dropCell.d.ts +10 -10
  66. package/es/modules/dropCell.js +2267 -0
  67. package/{dist/packages/core/src → es}/modules/filter.d.ts +45 -45
  68. package/es/modules/filter.js +434 -0
  69. package/{dist/packages/core/src → es}/modules/format.d.ts +6 -6
  70. package/es/modules/format.js +323 -0
  71. package/{dist/packages/core/src → es}/modules/formula.d.ts +54 -54
  72. package/es/modules/formula.js +2346 -0
  73. package/{dist/packages/core/src → es}/modules/freeze.d.ts +5 -5
  74. package/es/modules/freeze.js +148 -0
  75. package/{dist/packages/core/src → es}/modules/hyperlink.d.ts +21 -21
  76. package/es/modules/hyperlink.js +216 -0
  77. package/{dist/packages/core/src → es}/modules/iframe.d.ts +12 -12
  78. package/es/modules/iframe.js +220 -0
  79. package/{dist/packages/core/src → es}/modules/image.d.ts +31 -31
  80. package/es/modules/image.js +253 -0
  81. package/{dist/packages/core/src → es}/modules/index.d.ts +36 -36
  82. package/es/modules/index.js +36 -0
  83. package/{dist/packages/core/src → es}/modules/inline-string.d.ts +36 -36
  84. package/es/modules/inline-string.js +437 -0
  85. package/{dist/packages/core/src → es}/modules/location.d.ts +6 -6
  86. package/es/modules/location.js +46 -0
  87. package/{dist/packages/core/src → es}/modules/locationCondition.d.ts +21 -21
  88. package/es/modules/locationCondition.js +218 -0
  89. package/{dist/packages/core/src → es}/modules/merge.d.ts +3 -3
  90. package/es/modules/merge.js +216 -0
  91. package/{dist/packages/core/src → es}/modules/mobile.d.ts +5 -5
  92. package/es/modules/mobile.js +33 -0
  93. package/{dist/packages/core/src → es}/modules/moveCells.d.ts +5 -5
  94. package/es/modules/moveCells.js +348 -0
  95. package/{dist/packages/core/src → es}/modules/protection.d.ts +5 -5
  96. package/es/modules/protection.js +96 -0
  97. package/{dist/packages/core/src → es}/modules/refresh.d.ts +3 -3
  98. package/es/modules/refresh.js +34 -0
  99. package/{dist/packages/core/src → es}/modules/rowcol.d.ts +19 -19
  100. package/es/modules/rowcol.js +1922 -0
  101. package/{dist/packages/core/src → es}/modules/screenshot.d.ts +2 -2
  102. package/es/modules/screenshot.js +90 -0
  103. package/{dist/packages/core/src → es}/modules/searchReplace.d.ts +36 -36
  104. package/es/modules/searchReplace.js +388 -0
  105. package/{dist/packages/core/src → es}/modules/selection.d.ts +50 -46
  106. package/es/modules/selection.js +1856 -0
  107. package/{dist/packages/core/src → es}/modules/sheet.d.ts +10 -10
  108. package/es/modules/sheet.js +237 -0
  109. package/{dist/packages/core/src → es}/modules/sort.d.ts +7 -7
  110. package/es/modules/sort.js +134 -0
  111. package/{dist/packages/core/src → es}/modules/splitColumn.d.ts +5 -5
  112. package/es/modules/splitColumn.js +126 -0
  113. package/es/modules/ssf.js +1533 -0
  114. package/{dist/packages/core/src → es}/modules/text.d.ts +10 -10
  115. package/es/modules/text.js +1207 -0
  116. package/{dist/packages/core/src → es}/modules/toolbar.d.ts +32 -32
  117. package/es/modules/toolbar.js +970 -0
  118. package/{dist/packages/core/src → es}/modules/validation.d.ts +19 -19
  119. package/es/modules/validation.js +190 -0
  120. package/{dist/packages/core/src → es}/modules/zoom.d.ts +3 -3
  121. package/es/modules/zoom.js +29 -0
  122. package/{dist/packages/core/src → es}/settings.d.ts +100 -100
  123. package/es/settings.js +36 -0
  124. package/{dist/packages/core/src → es}/types.d.ts +380 -371
  125. package/es/types.js +1 -0
  126. package/{dist/packages/core/src → es}/utils/freeze.d.ts +7 -7
  127. package/es/utils/freeze.js +86 -0
  128. package/{dist/packages/core/src → es}/utils/index.d.ts +19 -18
  129. package/es/utils/index.js +198 -0
  130. package/{dist/packages/core/src → es}/utils/patch.d.ts +37 -37
  131. package/es/utils/patch.js +381 -0
  132. package/lib/api/cell.d.ts +10 -0
  133. package/lib/api/cell.js +215 -0
  134. package/lib/api/common.d.ts +71 -0
  135. package/lib/api/common.js +88 -0
  136. package/lib/api/errors.d.ts +2 -0
  137. package/lib/api/errors.js +8 -0
  138. package/lib/api/index.d.ts +9 -0
  139. package/lib/api/index.js +101 -0
  140. package/lib/api/merge.d.ts +5 -0
  141. package/lib/api/merge.js +22 -0
  142. package/lib/api/range.d.ts +22 -0
  143. package/lib/api/range.js +138 -0
  144. package/lib/api/rowcol.d.ts +14 -0
  145. package/lib/api/rowcol.js +222 -0
  146. package/lib/api/sheet.d.ts +10 -0
  147. package/lib/api/sheet.js +145 -0
  148. package/lib/api/workbook.d.ts +15 -0
  149. package/lib/api/workbook.js +98 -0
  150. package/lib/canvas.d.ts +46 -0
  151. package/lib/canvas.js +1356 -0
  152. package/lib/context.d.ts +198 -0
  153. package/lib/context.js +393 -0
  154. package/lib/events/copy.d.ts +2 -0
  155. package/lib/events/copy.js +85 -0
  156. package/lib/events/index.d.ts +4 -0
  157. package/lib/events/index.js +49 -0
  158. package/lib/events/keyboard.d.ts +6 -0
  159. package/lib/events/keyboard.js +370 -0
  160. package/lib/events/mouse.d.ts +22 -0
  161. package/lib/events/mouse.js +1744 -0
  162. package/lib/events/paste.d.ts +4 -0
  163. package/lib/events/paste.js +1425 -0
  164. package/lib/index.d.ts +10 -0
  165. package/lib/index.js +109 -0
  166. package/lib/locale/en.d.ts +993 -0
  167. package/lib/locale/en.js +10146 -0
  168. package/lib/locale/es.d.ts +1134 -0
  169. package/lib/locale/es.js +10016 -0
  170. package/lib/locale/hi.d.ts +1030 -0
  171. package/lib/locale/hi.js +10556 -0
  172. package/lib/locale/index.d.ts +1049 -0
  173. package/lib/locale/index.js +29 -0
  174. package/lib/locale/zh.d.ts +1048 -0
  175. package/lib/locale/zh.js +10574 -0
  176. package/lib/locale/zh_tw.d.ts +1187 -0
  177. package/lib/locale/zh_tw.js +10078 -0
  178. package/lib/modules/ConditionFormat.d.ts +17 -0
  179. package/lib/modules/ConditionFormat.js +1273 -0
  180. package/lib/modules/border.d.ts +3 -0
  181. package/lib/modules/border.js +1248 -0
  182. package/lib/modules/cell.d.ts +32 -0
  183. package/lib/modules/cell.js +1122 -0
  184. package/lib/modules/clipboard.d.ts +3 -0
  185. package/lib/modules/clipboard.js +42 -0
  186. package/lib/modules/color.d.ts +1 -0
  187. package/lib/modules/color.js +7 -0
  188. package/lib/modules/comment.d.ts +97 -0
  189. package/lib/modules/comment.js +625 -0
  190. package/lib/modules/conditionalFormat.d.ts +2 -0
  191. package/lib/modules/conditionalFormat.js +447 -0
  192. package/lib/modules/cursor.d.ts +3 -0
  193. package/lib/modules/cursor.js +70 -0
  194. package/lib/modules/dataVerification.d.ts +11 -0
  195. package/lib/modules/dataVerification.js +716 -0
  196. package/lib/modules/dropCell.d.ts +10 -0
  197. package/lib/modules/dropCell.js +2283 -0
  198. package/lib/modules/filter.d.ts +45 -0
  199. package/lib/modules/filter.js +448 -0
  200. package/lib/modules/format.d.ts +6 -0
  201. package/lib/modules/format.js +334 -0
  202. package/lib/modules/formula.d.ts +54 -0
  203. package/lib/modules/formula.js +2375 -0
  204. package/lib/modules/freeze.d.ts +5 -0
  205. package/lib/modules/freeze.js +158 -0
  206. package/lib/modules/hyperlink.d.ts +21 -0
  207. package/lib/modules/hyperlink.js +232 -0
  208. package/lib/modules/iframe.d.ts +12 -0
  209. package/lib/modules/iframe.js +236 -0
  210. package/lib/modules/image.d.ts +31 -0
  211. package/lib/modules/image.js +272 -0
  212. package/lib/modules/index.d.ts +36 -0
  213. package/lib/modules/index.js +401 -0
  214. package/lib/modules/inline-string.d.ts +36 -0
  215. package/lib/modules/inline-string.js +452 -0
  216. package/lib/modules/location.d.ts +6 -0
  217. package/lib/modules/location.js +57 -0
  218. package/lib/modules/locationCondition.d.ts +21 -0
  219. package/lib/modules/locationCondition.js +229 -0
  220. package/lib/modules/merge.d.ts +3 -0
  221. package/lib/modules/merge.js +223 -0
  222. package/lib/modules/mobile.d.ts +5 -0
  223. package/lib/modules/mobile.js +41 -0
  224. package/lib/modules/moveCells.d.ts +5 -0
  225. package/lib/modules/moveCells.js +357 -0
  226. package/lib/modules/protection.d.ts +5 -0
  227. package/lib/modules/protection.js +106 -0
  228. package/lib/modules/refresh.d.ts +3 -0
  229. package/lib/modules/refresh.js +40 -0
  230. package/lib/modules/rowcol.d.ts +19 -0
  231. package/lib/modules/rowcol.js +1935 -0
  232. package/lib/modules/screenshot.d.ts +2 -0
  233. package/lib/modules/screenshot.js +96 -0
  234. package/lib/modules/searchReplace.d.ts +36 -0
  235. package/lib/modules/searchReplace.js +402 -0
  236. package/lib/modules/selection.d.ts +50 -0
  237. package/lib/modules/selection.js +1889 -0
  238. package/lib/modules/sheet.d.ts +10 -0
  239. package/lib/modules/sheet.js +250 -0
  240. package/lib/modules/sort.d.ts +7 -0
  241. package/lib/modules/sort.js +143 -0
  242. package/lib/modules/splitColumn.d.ts +5 -0
  243. package/lib/modules/splitColumn.js +136 -0
  244. package/lib/modules/ssf.js +1539 -0
  245. package/lib/modules/text.d.ts +10 -0
  246. package/lib/modules/text.js +1221 -0
  247. package/lib/modules/toolbar.d.ts +32 -0
  248. package/lib/modules/toolbar.js +1003 -0
  249. package/lib/modules/validation.d.ts +19 -0
  250. package/lib/modules/validation.js +205 -0
  251. package/lib/modules/zoom.d.ts +3 -0
  252. package/lib/modules/zoom.js +36 -0
  253. package/lib/settings.d.ts +100 -0
  254. package/lib/settings.js +42 -0
  255. package/lib/types.d.ts +380 -0
  256. package/lib/types.js +5 -0
  257. package/lib/utils/freeze.d.ts +7 -0
  258. package/lib/utils/freeze.js +92 -0
  259. package/lib/utils/index.d.ts +19 -0
  260. package/lib/utils/index.js +258 -0
  261. package/lib/utils/patch.d.ts +37 -0
  262. package/lib/utils/patch.js +392 -0
  263. package/package.json +7 -6
  264. package/dist/index.esm.js +0 -80255
  265. package/dist/index.js +0 -80601
  266. package/dist/packages/react/src/components/ChangeColor/index.d.ts +0 -7
  267. package/dist/packages/react/src/components/ConditionFormat/ConditionRules.d.ts +0 -6
  268. package/dist/packages/react/src/components/ConditionFormat/index.d.ts +0 -7
  269. package/dist/packages/react/src/components/ContextMenu/Divider.d.ts +0 -3
  270. package/dist/packages/react/src/components/ContextMenu/FilterMenu.d.ts +0 -3
  271. package/dist/packages/react/src/components/ContextMenu/Menu.d.ts +0 -8
  272. package/dist/packages/react/src/components/ContextMenu/SheetTab.d.ts +0 -4
  273. package/dist/packages/react/src/components/ContextMenu/index.d.ts +0 -5
  274. package/dist/packages/react/src/components/CustomSort/index.d.ts +0 -4
  275. package/dist/packages/react/src/components/DataVerification/DropdownList.d.ts +0 -4
  276. package/dist/packages/react/src/components/DataVerification/RangeDialog.d.ts +0 -4
  277. package/dist/packages/react/src/components/DataVerification/getDisplayedRangeTxt.d.ts +0 -2
  278. package/dist/packages/react/src/components/DataVerification/index.d.ts +0 -4
  279. package/dist/packages/react/src/components/Dialog/index.d.ts +0 -15
  280. package/dist/packages/react/src/components/DuneChartsInputModal/DuneChartsInputModal.d.ts +0 -11
  281. package/dist/packages/react/src/components/DunePreview/DunePreview.d.ts +0 -13
  282. package/dist/packages/react/src/components/FilterOption/index.d.ts +0 -5
  283. package/dist/packages/react/src/components/FormatSearch/index.d.ts +0 -6
  284. package/dist/packages/react/src/components/FormulaSearch/index.d.ts +0 -5
  285. package/dist/packages/react/src/components/FxEditor/NameBox.d.ts +0 -3
  286. package/dist/packages/react/src/components/FxEditor/index.d.ts +0 -4
  287. package/dist/packages/react/src/components/IFrameBoxs/iFrameBoxs.d.ts +0 -4
  288. package/dist/packages/react/src/components/ImgBoxs/index.d.ts +0 -3
  289. package/dist/packages/react/src/components/LinkEidtCard/index.d.ts +0 -5
  290. package/dist/packages/react/src/components/LocationCondition/index.d.ts +0 -3
  291. package/dist/packages/react/src/components/MessageBox/index.d.ts +0 -9
  292. package/dist/packages/react/src/components/NotationBoxes/index.d.ts +0 -3
  293. package/dist/packages/react/src/components/ResetColumnWidth/index.d.ts +0 -2
  294. package/dist/packages/react/src/components/SVGDefines.d.ts +0 -5
  295. package/dist/packages/react/src/components/SVGIcon.d.ts +0 -9
  296. package/dist/packages/react/src/components/SearchReplace/index.d.ts +0 -6
  297. package/dist/packages/react/src/components/Sheet/index.d.ts +0 -8
  298. package/dist/packages/react/src/components/SheetList/SheetHiddenButton.d.ts +0 -8
  299. package/dist/packages/react/src/components/SheetList/SheetListItem.d.ts +0 -9
  300. package/dist/packages/react/src/components/SheetList/index.d.ts +0 -4
  301. package/dist/packages/react/src/components/SheetOverlay/ColumnHeader.d.ts +0 -3
  302. package/dist/packages/react/src/components/SheetOverlay/ContentEditable.d.ts +0 -11
  303. package/dist/packages/react/src/components/SheetOverlay/FormulaHint/index.d.ts +0 -4
  304. package/dist/packages/react/src/components/SheetOverlay/FormulaSearch/constant.d.ts +0 -63
  305. package/dist/packages/react/src/components/SheetOverlay/FormulaSearch/index.d.ts +0 -4
  306. package/dist/packages/react/src/components/SheetOverlay/InputBox.d.ts +0 -3
  307. package/dist/packages/react/src/components/SheetOverlay/RowHeader.d.ts +0 -3
  308. package/dist/packages/react/src/components/SheetOverlay/ScrollBar/index.d.ts +0 -7
  309. package/dist/packages/react/src/components/SheetOverlay/index.d.ts +0 -4
  310. package/dist/packages/react/src/components/SheetTab/SheetItem.d.ts +0 -8
  311. package/dist/packages/react/src/components/SheetTab/index.d.ts +0 -4
  312. package/dist/packages/react/src/components/SplitColumn/index.d.ts +0 -3
  313. package/dist/packages/react/src/components/Toolbar/Button.d.ts +0 -12
  314. package/dist/packages/react/src/components/Toolbar/ColorPicker.d.ts +0 -6
  315. package/dist/packages/react/src/components/Toolbar/Combo.d.ts +0 -12
  316. package/dist/packages/react/src/components/Toolbar/CustomBorder.d.ts +0 -7
  317. package/dist/packages/react/src/components/Toolbar/CustomButton.d.ts +0 -11
  318. package/dist/packages/react/src/components/Toolbar/CustomColor.d.ts +0 -8
  319. package/dist/packages/react/src/components/Toolbar/CustomIcon.d.ts +0 -9
  320. package/dist/packages/react/src/components/Toolbar/Divider.d.ts +0 -4
  321. package/dist/packages/react/src/components/Toolbar/MoreItemsContainer.d.ts +0 -6
  322. package/dist/packages/react/src/components/Toolbar/Select.d.ts +0 -14
  323. package/dist/packages/react/src/components/Toolbar/index.d.ts +0 -10
  324. package/dist/packages/react/src/components/Workbook/api.d.ts +0 -1177
  325. package/dist/packages/react/src/components/Workbook/index.d.ts +0 -1185
  326. package/dist/packages/react/src/components/ZoomControl/index.d.ts +0 -4
  327. package/dist/packages/react/src/components/index.d.ts +0 -4
  328. package/dist/packages/react/src/constants.d.ts +0 -1
  329. package/dist/packages/react/src/context/index.d.ts +0 -25
  330. package/dist/packages/react/src/context/modal.d.ts +0 -10
  331. package/dist/packages/react/src/hooks/useAlert.d.ts +0 -4
  332. package/dist/packages/react/src/hooks/useDialog.d.ts +0 -5
  333. package/dist/packages/react/src/hooks/useOutsideClick.d.ts +0 -2
  334. package/dist/packages/react/src/hooks/usePrevious.d.ts +0 -2
  335. package/dist/packages/react/src/index.d.ts +0 -1
  336. package/dist/packages/react/src/utils/datepickerStyles.d.ts +0 -2
  337. package/dist/stories/API.stories.d.ts +0 -1210
  338. package/dist/stories/Collabration.stories.d.ts +0 -2359
  339. package/dist/stories/Features.stories.d.ts +0 -9430
  340. package/dist/stories/data/cell.d.ts +0 -983
  341. package/dist/stories/data/dataVerification.d.ts +0 -131
  342. package/dist/stories/data/empty.d.ts +0 -10
  343. package/dist/stories/data/formula.d.ts +0 -362
  344. package/dist/stories/data/freeze.d.ts +0 -34
  345. package/dist/stories/data/protected.d.ts +0 -40
  346. package/dist/stories/utils.d.ts +0 -1
@@ -1,10 +1,10 @@
1
- import { Context } from "../context";
2
- import { Cell, SingleRange } from "../types";
3
- import { CommonOptions } from "./common";
4
- export declare function getCellValue(ctx: Context, row: number, column: number, options?: CommonOptions & {
5
- type?: keyof Cell;
6
- }): any;
7
- export declare function setCellValue(ctx: Context, row: number, column: number, value: any, cellInput: HTMLDivElement | null, options?: CommonOptions): void;
8
- export declare function clearCell(ctx: Context, row: number, column: number, options?: CommonOptions): void;
9
- export declare function setCellFormat(ctx: Context, row: number, column: number, attr: keyof Cell, value: any, options?: CommonOptions): void;
10
- export declare function autoFillCell(ctx: Context, copyRange: SingleRange, applyRange: SingleRange, direction: "up" | "down" | "left" | "right"): void;
1
+ import { Context } from "../context";
2
+ import { Cell, SingleRange } from "../types";
3
+ import { CommonOptions } from "./common";
4
+ export declare function getCellValue(ctx: Context, row: number, column: number, options?: CommonOptions & {
5
+ type?: keyof Cell;
6
+ }): any;
7
+ export declare function setCellValue(ctx: Context, row: number, column: number, value: any, cellInput: HTMLDivElement | null, options?: CommonOptions): void;
8
+ export declare function clearCell(ctx: Context, row: number, column: number, options?: CommonOptions): void;
9
+ export declare function setCellFormat(ctx: Context, row: number, column: number, attr: keyof Cell, value: any, options?: CommonOptions): void;
10
+ export declare function autoFillCell(ctx: Context, copyRange: SingleRange, applyRange: SingleRange, direction: "up" | "down" | "left" | "right"): void;
package/es/api/cell.js ADDED
@@ -0,0 +1,204 @@
1
+ var __assign = this && this.__assign || function () {
2
+ __assign = Object.assign || function (t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
6
+ }
7
+ return t;
8
+ };
9
+ return __assign.apply(this, arguments);
10
+ };
11
+ import _ from "lodash";
12
+ import { delFunctionGroup, dropCellCache, functionHTMLGenerate, getTypeItemHide, setCellValue as setCellValueInternal, updateCell, updateDropCell, updateFormatCell } from "../modules";
13
+ import { getSheet } from "./common";
14
+ import { SHEET_NOT_FOUND } from "./errors";
15
+ import SSF from "../modules/ssf";
16
+ export function getCellValue(ctx, row, column, options) {
17
+ var _a;
18
+ if (options === void 0) {
19
+ options = {};
20
+ }
21
+ if (!_.isNumber(row) || !_.isNumber(column)) {
22
+ throw new Error("row or column cannot be null or undefined");
23
+ }
24
+ var sheet = getSheet(ctx, options);
25
+ var _b = options.type,
26
+ type = _b === void 0 ? "v" : _b;
27
+ var targetSheetData = sheet.data;
28
+ if (!targetSheetData) {
29
+ throw SHEET_NOT_FOUND;
30
+ }
31
+ var cellData = targetSheetData[row][column];
32
+ var ret;
33
+ if (cellData && _.isPlainObject(cellData)) {
34
+ ret = cellData[type];
35
+ if (type === "f" && ret != null) {
36
+ ret = functionHTMLGenerate(ret);
37
+ } else if (type === "f") {
38
+ ret = cellData.v;
39
+ } else if (cellData && cellData.ct && cellData.ct.fa === "yyyy-MM-dd") {
40
+ ret = cellData.m;
41
+ } else if (((_a = cellData.ct) === null || _a === void 0 ? void 0 : _a.t) === "inlineStr") {
42
+ ret = cellData.ct.s.reduce(function (prev, cur) {
43
+ var _a;
44
+ return prev + ((_a = cur.v) !== null && _a !== void 0 ? _a : "");
45
+ }, "");
46
+ }
47
+ }
48
+ if (ret === undefined) {
49
+ ret = null;
50
+ }
51
+ return ret;
52
+ }
53
+ export function setCellValue(ctx, row, column, value, cellInput, options) {
54
+ var _a;
55
+ if (options === void 0) {
56
+ options = {};
57
+ }
58
+ if (!_.isNumber(row) || !_.isNumber(column)) {
59
+ throw new Error("row or column cannot be null or undefined");
60
+ }
61
+ var sheet = getSheet(ctx, options);
62
+ var data = sheet.data;
63
+ if (!data) return;
64
+ var formatList = {
65
+ bg: 1,
66
+ ff: 1,
67
+ fc: 1,
68
+ bl: 1,
69
+ it: 1,
70
+ fs: 1,
71
+ cl: 1,
72
+ un: 1,
73
+ vt: 1,
74
+ ht: 1,
75
+ mc: 1,
76
+ tr: 1,
77
+ tb: 1,
78
+ rt: 1,
79
+ qp: 1
80
+ };
81
+ if (value == null || value.toString().length === 0) {
82
+ delFunctionGroup(ctx, row, column);
83
+ setCellValueInternal(ctx, row, column, data, value);
84
+ } else if (value instanceof Object) {
85
+ var curv = {};
86
+ if (((_a = data === null || data === void 0 ? void 0 : data[row]) === null || _a === void 0 ? void 0 : _a[column]) == null) {
87
+ data[row][column] = {};
88
+ }
89
+ var cell_1 = data[row][column];
90
+ if (value.f != null && value.v == null) {
91
+ curv.f = value.f;
92
+ if (value.ct != null) {
93
+ curv.ct = value.ct;
94
+ }
95
+ updateCell(ctx, row, column, cellInput, curv);
96
+ } else {
97
+ if (value.ct != null) {
98
+ curv.ct = value.ct;
99
+ }
100
+ if (value.f != null) {
101
+ curv.f = value.f;
102
+ }
103
+ if (value.v != null) {
104
+ curv.v = value.v;
105
+ } else {
106
+ curv.v = cell_1.v;
107
+ }
108
+ if (value.m != null) {
109
+ curv.m = value.m;
110
+ }
111
+ delFunctionGroup(ctx, row, column);
112
+ setCellValueInternal(ctx, row, column, data, curv);
113
+ }
114
+ _.forEach(value, function (v, attr) {
115
+ if (attr in formatList) {
116
+ updateFormatCell(ctx, data, attr, v, row, row, column, column);
117
+ } else {
118
+ cell_1[attr] = v;
119
+ }
120
+ });
121
+ data[row][column] = cell_1;
122
+ } else {
123
+ if (value.toString().substr(0, 1) === "=" || value.toString().substr(0, 5) === "<span") {
124
+ updateCell(ctx, row, column, cellInput, value);
125
+ } else {
126
+ delFunctionGroup(ctx, row, column);
127
+ setCellValueInternal(ctx, row, column, data, value);
128
+ }
129
+ }
130
+ }
131
+ export function clearCell(ctx, row, column, options) {
132
+ var _a, _b;
133
+ if (options === void 0) {
134
+ options = {};
135
+ }
136
+ if (!_.isNumber(row) || !_.isNumber(column)) {
137
+ throw new Error("row or column cannot be null or undefined");
138
+ }
139
+ var sheet = getSheet(ctx, options);
140
+ var cell = (_b = (_a = sheet.data) === null || _a === void 0 ? void 0 : _a[row]) === null || _b === void 0 ? void 0 : _b[column];
141
+ if (cell && _.isPlainObject(cell)) {
142
+ delete cell.m;
143
+ delete cell.v;
144
+ if (cell.f != null) {
145
+ delete cell.f;
146
+ delFunctionGroup(ctx, row, column, sheet.id);
147
+ delete cell.spl;
148
+ }
149
+ }
150
+ }
151
+ export function setCellFormat(ctx, row, column, attr, value, options) {
152
+ var _a;
153
+ if (options === void 0) {
154
+ options = {};
155
+ }
156
+ if (!_.isNumber(row) || !_.isNumber(column)) {
157
+ throw new Error("row or column cannot be null or undefined");
158
+ }
159
+ if (!attr) {
160
+ throw new Error("attr cannot be null or undefined");
161
+ }
162
+ var sheet = getSheet(ctx, options);
163
+ var targetSheetData = sheet.data;
164
+ var cellData = ((_a = targetSheetData === null || targetSheetData === void 0 ? void 0 : targetSheetData[row]) === null || _a === void 0 ? void 0 : _a[column]) || {};
165
+ var cfg = sheet.config || {};
166
+ if (attr === "ct" && (!value || value.fa == null || value.t == null)) {
167
+ throw new Error("'fa' and 't' should be present in value when attr is 'ct'");
168
+ } else if (attr === "ct" && !_.isNil(cellData.v)) {
169
+ cellData.m = SSF.format(value.fa, cellData.v);
170
+ }
171
+ if (attr === "bd") {
172
+ if (cfg.borderInfo == null) {
173
+ cfg.borderInfo = [];
174
+ }
175
+ var borderInfo = __assign({
176
+ rangeType: "range",
177
+ borderType: "border-all",
178
+ color: "#000",
179
+ style: "1",
180
+ range: [{
181
+ column: [column, column],
182
+ row: [row, row]
183
+ }]
184
+ }, value);
185
+ cfg.borderInfo.push(borderInfo);
186
+ } else {
187
+ cellData[attr] = value;
188
+ }
189
+ targetSheetData[row][column] = cellData;
190
+ sheet.config = cfg;
191
+ ctx.config = cfg;
192
+ }
193
+ export function autoFillCell(ctx, copyRange, applyRange, direction) {
194
+ dropCellCache.copyRange = copyRange;
195
+ dropCellCache.applyRange = applyRange;
196
+ dropCellCache.direction = direction;
197
+ var typeItemHide = getTypeItemHide(ctx);
198
+ if (!typeItemHide[0] && !typeItemHide[1] && !typeItemHide[2] && !typeItemHide[3] && !typeItemHide[4] && !typeItemHide[5] && !typeItemHide[6]) {
199
+ dropCellCache.applyType = "0";
200
+ } else {
201
+ dropCellCache.applyType = "1";
202
+ }
203
+ updateDropCell(ctx);
204
+ }
@@ -1,66 +1,71 @@
1
- import { Context } from "../context";
2
- import { CellMatrix, CellWithRowAndCol, Sheet } from "../types";
3
- export type CommonOptions = {
4
- index?: number;
5
- id?: string;
6
- };
7
- export declare const dataToCelldata: (data: CellMatrix | undefined) => CellWithRowAndCol[];
8
- export declare const celldataToData: (celldata: CellWithRowAndCol[], rowCount?: number, colCount?: number) => CellMatrix | null;
9
- export declare function getSheet(ctx: Context, options?: CommonOptions): Sheet;
10
- export declare function getSheetWithLatestCelldata(ctx: Context, options?: CommonOptions): {
11
- celldata: CellWithRowAndCol[];
12
- name: string;
13
- config?: import("../types").SheetConfig | undefined;
14
- order?: number | undefined;
15
- color?: string | undefined;
16
- data?: CellMatrix | undefined;
17
- id?: string | undefined;
18
- images?: import("../types").Image[] | undefined;
19
- iframes?: {
20
- id: string;
21
- src: string;
22
- left: number;
23
- top: number;
24
- width: number;
25
- height: number;
26
- }[] | undefined;
27
- zoomRatio?: number | undefined;
28
- column?: number | undefined;
29
- row?: number | undefined;
30
- addRows?: number | undefined;
31
- status?: number | undefined;
32
- hide?: number | undefined;
33
- luckysheet_select_save?: import("../types").Selection[] | undefined;
34
- luckysheet_selection_range?: {
35
- row: number[];
36
- column: number[];
37
- }[] | undefined;
38
- calcChain?: any[] | undefined;
39
- defaultRowHeight?: number | undefined;
40
- defaultColWidth?: number | undefined;
41
- showGridLines?: number | boolean | undefined;
42
- pivotTable?: any;
43
- isPivotTable?: boolean | undefined;
44
- filter?: Record<string, any> | undefined;
45
- filter_select?: {
46
- row: number[];
47
- column: number[];
48
- } | undefined;
49
- luckysheet_conditionformat_save?: any[] | undefined;
50
- luckysheet_alternateformat_save?: any[] | undefined;
51
- dataVerification?: any;
52
- conditionRules?: import("../types").ConditionRulesProps | undefined;
53
- hyperlink?: Record<string, {
54
- linkType: string;
55
- linkAddress: string;
56
- }> | undefined;
57
- dynamicArray_compute?: any;
58
- dynamicArray?: any[] | undefined;
59
- frozen?: {
60
- type: "row" | "column" | "both" | "rangeRow" | "rangeColumn" | "rangeBoth";
61
- range?: {
62
- row_focus: number;
63
- column_focus: number;
64
- } | undefined;
65
- } | undefined;
66
- };
1
+ import { Context } from "../context";
2
+ import { CellMatrix, CellWithRowAndCol, Sheet } from "../types";
3
+ export type CommonOptions = {
4
+ index?: number;
5
+ id?: string;
6
+ };
7
+ export declare const dataToCelldata: (data: CellMatrix | undefined) => CellWithRowAndCol[];
8
+ export declare const celldataToData: (celldata: CellWithRowAndCol[], rowCount?: number, colCount?: number) => CellMatrix | null;
9
+ export declare function getSheet(ctx: Context, options?: CommonOptions): Sheet;
10
+ export declare function getSheetWithLatestCelldata(ctx: Context, options?: CommonOptions): {
11
+ celldata: CellWithRowAndCol[];
12
+ name: string;
13
+ config?: import("../types").SheetConfig | undefined;
14
+ order?: number | undefined;
15
+ color?: string | undefined;
16
+ data?: CellMatrix | undefined;
17
+ id?: string | undefined;
18
+ images?: import("../types").Image[] | undefined;
19
+ iframes?: {
20
+ id: string;
21
+ src: string;
22
+ left: number;
23
+ top: number;
24
+ width: number;
25
+ height: number;
26
+ }[] | undefined;
27
+ zoomRatio?: number | undefined;
28
+ column?: number | undefined;
29
+ row?: number | undefined;
30
+ addRows?: number | undefined;
31
+ status?: number | undefined;
32
+ hide?: number | undefined;
33
+ luckysheet_select_save?: import("../types").Selection[] | undefined;
34
+ luckysheet_selection_range?: {
35
+ row: number[];
36
+ column: number[];
37
+ }[] | undefined;
38
+ calcChain?: any[] | undefined;
39
+ dataBlockCalcFunction?: {
40
+ [key: string]: {
41
+ [key: string]: any;
42
+ };
43
+ } | undefined;
44
+ defaultRowHeight?: number | undefined;
45
+ defaultColWidth?: number | undefined;
46
+ showGridLines?: number | boolean | undefined;
47
+ pivotTable?: any;
48
+ isPivotTable?: boolean | undefined;
49
+ filter?: Record<string, any> | undefined;
50
+ filter_select?: {
51
+ row: number[];
52
+ column: number[];
53
+ } | undefined;
54
+ luckysheet_conditionformat_save?: any[] | undefined;
55
+ luckysheet_alternateformat_save?: any[] | undefined;
56
+ dataVerification?: any;
57
+ conditionRules?: import("../types").ConditionRulesProps | undefined;
58
+ hyperlink?: Record<string, {
59
+ linkType: string;
60
+ linkAddress: string;
61
+ }> | undefined;
62
+ dynamicArray_compute?: any;
63
+ dynamicArray?: any[] | undefined;
64
+ frozen?: {
65
+ type: "row" | "column" | "both" | "rangeRow" | "rangeColumn" | "rangeBoth";
66
+ range?: {
67
+ row_focus: number;
68
+ column_focus: number;
69
+ } | undefined;
70
+ } | undefined;
71
+ };
@@ -0,0 +1,79 @@
1
+ var __assign = this && this.__assign || function () {
2
+ __assign = Object.assign || function (t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
6
+ }
7
+ return t;
8
+ };
9
+ return __assign.apply(this, arguments);
10
+ };
11
+ import _ from "lodash";
12
+ import { getSheetIndex } from "../utils";
13
+ import { SHEET_NOT_FOUND } from "./errors";
14
+ export var dataToCelldata = function dataToCelldata(data) {
15
+ var celldata = [];
16
+ if (data == null) {
17
+ return celldata;
18
+ }
19
+ for (var r = 0; r < data.length; r += 1) {
20
+ for (var c = 0; c < data[r].length; c += 1) {
21
+ var v = data[r][c];
22
+ if (v != null) {
23
+ celldata.push({
24
+ r: r,
25
+ c: c,
26
+ v: v
27
+ });
28
+ }
29
+ }
30
+ }
31
+ return celldata;
32
+ };
33
+ export var celldataToData = function celldataToData(celldata, rowCount, colCount) {
34
+ var _a, _b;
35
+ var lastRow = _.maxBy(celldata, "r");
36
+ var lastCol = _.maxBy(celldata, "c");
37
+ var lastRowNum = ((_a = lastRow === null || lastRow === void 0 ? void 0 : lastRow.r) !== null && _a !== void 0 ? _a : 0) + 1;
38
+ var lastColNum = ((_b = lastCol === null || lastCol === void 0 ? void 0 : lastCol.c) !== null && _b !== void 0 ? _b : 0) + 1;
39
+ if (rowCount != null && colCount != null && rowCount > 0 && colCount > 0) {
40
+ lastRowNum = Math.max(lastRowNum, rowCount);
41
+ lastColNum = Math.max(lastColNum, colCount);
42
+ }
43
+ if (lastRowNum && lastColNum) {
44
+ var expandedData_1 = _.times(lastRowNum, function () {
45
+ return _.times(lastColNum, function () {
46
+ return null;
47
+ });
48
+ });
49
+ celldata === null || celldata === void 0 ? void 0 : celldata.forEach(function (d) {
50
+ expandedData_1[d.r][d.c] = d.v;
51
+ });
52
+ return expandedData_1;
53
+ }
54
+ return null;
55
+ };
56
+ export function getSheet(ctx, options) {
57
+ if (options === void 0) {
58
+ options = {};
59
+ }
60
+ var _a = options.index,
61
+ index = _a === void 0 ? getSheetIndex(ctx, options.id || ctx.currentSheetId) : _a;
62
+ if (index == null) {
63
+ throw SHEET_NOT_FOUND;
64
+ }
65
+ var sheet = ctx.luckysheetfile[index];
66
+ if (sheet == null) {
67
+ throw SHEET_NOT_FOUND;
68
+ }
69
+ return sheet;
70
+ }
71
+ export function getSheetWithLatestCelldata(ctx, options) {
72
+ if (options === void 0) {
73
+ options = {};
74
+ }
75
+ var sheet = getSheet(ctx, options);
76
+ return __assign(__assign({}, sheet), {
77
+ celldata: dataToCelldata(sheet.data)
78
+ });
79
+ }
@@ -1,2 +1,2 @@
1
- export declare const INVALID_PARAMS: Error;
2
- export declare const SHEET_NOT_FOUND: Error;
1
+ export declare const INVALID_PARAMS: Error;
2
+ export declare const SHEET_NOT_FOUND: Error;
@@ -0,0 +1,2 @@
1
+ export var INVALID_PARAMS = new Error("invalid params");
2
+ export var SHEET_NOT_FOUND = new Error("sheet not found");
@@ -1,9 +1,9 @@
1
- import { getSheetWithLatestCelldata, CommonOptions, dataToCelldata, celldataToData } from "./common";
2
- export type { CommonOptions };
3
- export { getSheetWithLatestCelldata, dataToCelldata, celldataToData };
4
- export * from "./cell";
5
- export * from "./rowcol";
6
- export * from "./range";
7
- export * from "./merge";
8
- export * from "./sheet";
9
- export * from "./workbook";
1
+ import { getSheetWithLatestCelldata, CommonOptions, dataToCelldata, celldataToData } from "./common";
2
+ export type { CommonOptions };
3
+ export { getSheetWithLatestCelldata, dataToCelldata, celldataToData };
4
+ export * from "./cell";
5
+ export * from "./rowcol";
6
+ export * from "./range";
7
+ export * from "./merge";
8
+ export * from "./sheet";
9
+ export * from "./workbook";
@@ -0,0 +1,8 @@
1
+ import { getSheetWithLatestCelldata, dataToCelldata, celldataToData } from "./common";
2
+ export { getSheetWithLatestCelldata, dataToCelldata, celldataToData };
3
+ export * from "./cell";
4
+ export * from "./rowcol";
5
+ export * from "./range";
6
+ export * from "./merge";
7
+ export * from "./sheet";
8
+ export * from "./workbook";
@@ -1,5 +1,5 @@
1
- import { Context } from "..";
2
- import { Range } from "../types";
3
- import { CommonOptions } from "./common";
4
- export declare function mergeCells(ctx: Context, ranges: Range, type: string, options?: CommonOptions): void;
5
- export declare function cancelMerge(ctx: Context, ranges: Range, options?: CommonOptions): void;
1
+ import { Context } from "..";
2
+ import { Range } from "../types";
3
+ import { CommonOptions } from "./common";
4
+ export declare function mergeCells(ctx: Context, ranges: Range, type: string, options?: CommonOptions): void;
5
+ export declare function cancelMerge(ctx: Context, ranges: Range, options?: CommonOptions): void;
@@ -0,0 +1,15 @@
1
+ import { getSheet } from "./common";
2
+ import { mergeCells as mergeCellsInternal } from "../modules";
3
+ export function mergeCells(ctx, ranges, type, options) {
4
+ if (options === void 0) {
5
+ options = {};
6
+ }
7
+ var sheet = getSheet(ctx, options);
8
+ mergeCellsInternal(ctx, sheet.id, ranges, type);
9
+ }
10
+ export function cancelMerge(ctx, ranges, options) {
11
+ if (options === void 0) {
12
+ options = {};
13
+ }
14
+ mergeCells(ctx, ranges, "merge-cancel", options);
15
+ }
@@ -1,22 +1,22 @@
1
- import { Selection } from "..";
2
- import { Context } from "../context";
3
- import { Cell, Range, SingleRange } from "../types";
4
- import { CommonOptions } from "./common";
5
- export declare function getSelection(ctx: Context): {
6
- row: number[];
7
- column: number[];
8
- }[] | undefined;
9
- export declare function getFlattenRange(ctx: Context, range?: Range): {
10
- r: number;
11
- c: number;
12
- }[];
13
- export declare function getCellsByFlattenRange(ctx: Context, range?: {
14
- r: number;
15
- c: number;
16
- }[]): (Cell | null)[];
17
- export declare function getSelectionCoordinates(ctx: Context): string[];
18
- export declare function getCellsByRange(ctx: Context, range: Selection, options?: CommonOptions): (Cell | null)[][];
19
- export declare function getHtmlByRange(ctx: Context, range: Range, options?: CommonOptions): string | null;
20
- export declare function setSelection(ctx: Context, range: Range, options: CommonOptions): void;
21
- export declare function setCellValuesByRange(ctx: Context, data: any[][], range: SingleRange, cellInput: HTMLDivElement | null, options?: CommonOptions): void;
22
- export declare function setCellFormatByRange(ctx: Context, attr: keyof Cell, value: any, range: Range | SingleRange, options?: CommonOptions): void;
1
+ import { Selection } from "..";
2
+ import { Context } from "../context";
3
+ import { Cell, Range, SingleRange } from "../types";
4
+ import { CommonOptions } from "./common";
5
+ export declare function getSelection(ctx: Context): {
6
+ row: number[];
7
+ column: number[];
8
+ }[] | undefined;
9
+ export declare function getFlattenRange(ctx: Context, range?: Range): {
10
+ r: number;
11
+ c: number;
12
+ }[];
13
+ export declare function getCellsByFlattenRange(ctx: Context, range?: {
14
+ r: number;
15
+ c: number;
16
+ }[]): (Cell | null)[];
17
+ export declare function getSelectionCoordinates(ctx: Context): string[];
18
+ export declare function getCellsByRange(ctx: Context, range: Selection, options?: CommonOptions): (Cell | null)[][];
19
+ export declare function getHtmlByRange(ctx: Context, range: Range, options?: CommonOptions): string | null;
20
+ export declare function setSelection(ctx: Context, range: Range, options: CommonOptions): void;
21
+ export declare function setCellValuesByRange(ctx: Context, data: any[][], range: SingleRange, cellInput: HTMLDivElement | null, options?: CommonOptions): void;
22
+ export declare function setCellFormatByRange(ctx: Context, attr: keyof Cell, value: any, range: Range | SingleRange, options?: CommonOptions): void;