@fileverse-dev/fortune-core 1.1.0 → 1.1.2

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
@@ -0,0 +1,1122 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.cancelFunctionrangeSelected = cancelFunctionrangeSelected;
7
+ exports.cancelNormalSelected = cancelNormalSelected;
8
+ exports.getCellValue = getCellValue;
9
+ exports.getDataBySelectionNoCopy = getDataBySelectionNoCopy;
10
+ exports.getFlattenedRange = getFlattenedRange;
11
+ exports.getFontStyleByCell = getFontStyleByCell;
12
+ exports.getInlineStringHTML = getInlineStringHTML;
13
+ exports.getOrigincell = getOrigincell;
14
+ exports.getQKBorder = getQKBorder;
15
+ exports.getRange = getRange;
16
+ exports.getRangeByTxt = getRangeByTxt;
17
+ exports.getRangetxt = getRangetxt;
18
+ exports.getRealCellValue = getRealCellValue;
19
+ exports.getStyleByCell = getStyleByCell;
20
+ exports.getcellFormula = getcellFormula;
21
+ exports.getdatabyselection = getdatabyselection;
22
+ exports.isAllSelectedCellsInStatus = isAllSelectedCellsInStatus;
23
+ exports.luckysheetUpdateCell = luckysheetUpdateCell;
24
+ exports.mergeBorder = mergeBorder;
25
+ exports.mergeMoveMain = mergeMoveMain;
26
+ exports.normalizedAttr = normalizedAttr;
27
+ exports.normalizedCellAttr = normalizedCellAttr;
28
+ exports.setCellValue = setCellValue;
29
+ exports.updateCell = updateCell;
30
+ var _lodash = _interopRequireDefault(require("lodash"));
31
+ var _context = require("../context");
32
+ var _utils = require("../utils");
33
+ var _ConditionFormat = require("./ConditionFormat");
34
+ var _dataVerification = require("./dataVerification");
35
+ var _format = require("./format");
36
+ var _api = require("../api");
37
+ var _formula = require("./formula");
38
+ var _inlineString = require("./inline-string");
39
+ var _validation = require("./validation");
40
+ var _text = require("./text");
41
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
42
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
43
+ function normalizedCellAttr(cell, attr, defaultFontSize) {
44
+ if (defaultFontSize === void 0) {
45
+ defaultFontSize = 10;
46
+ }
47
+ var tf = {
48
+ bl: 1,
49
+ it: 1,
50
+ ff: 1,
51
+ cl: 1,
52
+ un: 1
53
+ };
54
+ var value = cell === null || cell === void 0 ? void 0 : cell[attr];
55
+ if (attr in tf || attr === "fs" && (0, _inlineString.isInlineStringCell)(cell)) {
56
+ value || (value = "0");
57
+ } else if (["fc", "bg", "bc"].includes(attr)) {
58
+ if (["fc", "bc"].includes(attr)) {
59
+ value || (value = "#000000");
60
+ }
61
+ if ((value === null || value === void 0 ? void 0 : value.indexOf("rgba")) > -1) {
62
+ value = (0, _utils.rgbToHex)(value);
63
+ }
64
+ } else if (attr.substring(0, 2) === "bs") {
65
+ value || (value = "none");
66
+ } else if (attr === "ht" || attr === "vt") {
67
+ var defaultValue = attr === "ht" ? "1" : "0";
68
+ value = !_lodash.default.isNil(value) ? value.toString() : defaultValue;
69
+ if (["0", "1", "2"].indexOf(value.toString()) === -1) {
70
+ value = defaultValue;
71
+ }
72
+ } else if (attr === "fs") {
73
+ value || (value = defaultFontSize.toString());
74
+ } else if (attr === "tb" || attr === "tr") {
75
+ value || (value = "0");
76
+ }
77
+ return value;
78
+ }
79
+ function normalizedAttr(data, r, c, attr) {
80
+ if (!data || !data[r]) {
81
+ console.warn("cell (%d, %d) is null", r, c);
82
+ return null;
83
+ }
84
+ var cell = data[r][c];
85
+ if (!cell) return undefined;
86
+ return normalizedCellAttr(cell, attr);
87
+ }
88
+ function getCellValue(r, c, data, attr) {
89
+ if (!attr) {
90
+ attr = "v";
91
+ }
92
+ var d_value;
93
+ if (!_lodash.default.isNil(r) && !_lodash.default.isNil(c)) {
94
+ d_value = data[r][c];
95
+ } else if (!_lodash.default.isNil(r)) {
96
+ d_value = data[r];
97
+ } else if (!_lodash.default.isNil(c)) {
98
+ var newData = data[0].map(function (col, i) {
99
+ return data.map(function (row) {
100
+ return row[i];
101
+ });
102
+ });
103
+ d_value = newData[c];
104
+ } else {
105
+ return data;
106
+ }
107
+ var retv = d_value;
108
+ if (_lodash.default.isPlainObject(d_value)) {
109
+ var d = d_value;
110
+ retv = d[attr];
111
+ if (attr === "f" && !_lodash.default.isNil(retv)) {
112
+ retv = (0, _formula.functionHTMLGenerate)(retv);
113
+ } else if (attr === "f") {
114
+ retv = d.v;
115
+ } else if (d && d.ct && d.ct.t === "d") {
116
+ retv = d.m;
117
+ }
118
+ }
119
+ if (retv === undefined) {
120
+ retv = null;
121
+ }
122
+ return retv;
123
+ }
124
+ function setCellValue(ctx, r, c, d, v) {
125
+ var _a, _b, _c, _d, _e, _f;
126
+ if (_lodash.default.isNil(d)) {
127
+ d = (0, _context.getFlowdata)(ctx);
128
+ }
129
+ if (!d) return;
130
+ var cell = d[r][c];
131
+ var vupdate;
132
+ if (_lodash.default.isPlainObject(v)) {
133
+ if (_lodash.default.isNil(cell)) {
134
+ cell = v;
135
+ } else {
136
+ if (!_lodash.default.isNil(v.f)) {
137
+ cell.f = v.f;
138
+ } else if ("f" in cell) {
139
+ delete cell.f;
140
+ }
141
+ if (!_lodash.default.isNil(v.baseCurrency)) {
142
+ cell.baseValue = v.baseValue;
143
+ cell.baseCurrency = v.baseCurrency;
144
+ cell.baseCurrencyPrice = v.baseCurrencyPrice;
145
+ }
146
+ if (!_lodash.default.isNil(v.ct)) {
147
+ cell.ct = v.ct;
148
+ }
149
+ }
150
+ if (_lodash.default.isPlainObject(v.v)) {
151
+ vupdate = v.v.v;
152
+ } else {
153
+ vupdate = v.v;
154
+ }
155
+ } else {
156
+ vupdate = v;
157
+ }
158
+ if ((0, _validation.isRealNull)(vupdate)) {
159
+ if (_lodash.default.isPlainObject(cell)) {
160
+ delete cell.m;
161
+ delete cell.v;
162
+ } else {
163
+ cell = null;
164
+ }
165
+ d[r][c] = cell;
166
+ return;
167
+ }
168
+ if ((0, _validation.isRealNull)(cell) || (_lodash.default.isString(cell) || _lodash.default.isNumber(cell)) && cell === v) {
169
+ cell = {};
170
+ }
171
+ if (!cell) return;
172
+ var vupdateStr = vupdate.toString();
173
+ if (vupdateStr.substr(0, 1) === "'") {
174
+ cell.m = vupdateStr.substr(1);
175
+ cell.ct = {
176
+ fa: "@",
177
+ t: "s"
178
+ };
179
+ cell.v = vupdateStr.substr(1);
180
+ cell.qp = 1;
181
+ } else if (cell.qp === 1) {
182
+ cell.m = vupdateStr;
183
+ cell.ct = {
184
+ fa: "@",
185
+ t: "s"
186
+ };
187
+ cell.v = vupdateStr;
188
+ } else if (vupdateStr.toUpperCase() === "TRUE" && (_lodash.default.isNil((_a = cell.ct) === null || _a === void 0 ? void 0 : _a.fa) || ((_b = cell.ct) === null || _b === void 0 ? void 0 : _b.fa) !== "@")) {
189
+ cell.m = "TRUE";
190
+ cell.ct = {
191
+ fa: "General",
192
+ t: "b"
193
+ };
194
+ cell.v = true;
195
+ } else if (vupdateStr.toUpperCase() === "FALSE" && (_lodash.default.isNil((_c = cell.ct) === null || _c === void 0 ? void 0 : _c.fa) || ((_d = cell.ct) === null || _d === void 0 ? void 0 : _d.fa) !== "@")) {
196
+ cell.m = "FALSE";
197
+ cell.ct = {
198
+ fa: "General",
199
+ t: "b"
200
+ };
201
+ cell.v = false;
202
+ } else if (vupdateStr.substr(-1) === "%" && (0, _validation.isRealNum)(vupdateStr.substring(0, vupdateStr.length - 1)) && (_lodash.default.isNil((_e = cell.ct) === null || _e === void 0 ? void 0 : _e.fa) || ((_f = cell.ct) === null || _f === void 0 ? void 0 : _f.fa) !== "@")) {
203
+ cell.ct = {
204
+ fa: "0%",
205
+ t: "n"
206
+ };
207
+ cell.v = vupdateStr.substring(0, vupdateStr.length - 1) / 100;
208
+ cell.m = vupdate;
209
+ } else if ((0, _validation.valueIsError)(vupdate)) {
210
+ cell.m = vupdateStr;
211
+ if (!_lodash.default.isNil(cell.ct)) {
212
+ cell.ct.t = "e";
213
+ } else {
214
+ cell.ct = {
215
+ fa: "General",
216
+ t: "e"
217
+ };
218
+ }
219
+ cell.v = vupdate;
220
+ } else {
221
+ if (!_lodash.default.isNil(cell.f) && (0, _validation.isRealNum)(vupdate) && !/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[12])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i.test(vupdate)) {
222
+ cell.v = parseFloat(vupdate);
223
+ if (_lodash.default.isNil(cell.ct)) {
224
+ cell.ct = {
225
+ fa: "General",
226
+ t: "n"
227
+ };
228
+ }
229
+ if (cell.v === Infinity || cell.v === -Infinity) {
230
+ cell.m = cell.v.toString();
231
+ } else {
232
+ if (cell.v.toString().indexOf("e") > -1) {
233
+ var len = void 0;
234
+ if (cell.v.toString().split(".").length === 1) {
235
+ len = 0;
236
+ } else {
237
+ len = cell.v.toString().split(".")[1].split("e")[0].length;
238
+ }
239
+ if (len > 5) {
240
+ len = 5;
241
+ }
242
+ cell.m = cell.v.toExponential(len).toString();
243
+ } else {
244
+ var v_p = Math.round(cell.v * 1000000000) / 1000000000;
245
+ if (_lodash.default.isNil(cell.ct)) {
246
+ var mask = (0, _format.genarate)(v_p);
247
+ if (mask != null) {
248
+ cell.m = mask[0].toString();
249
+ }
250
+ } else {
251
+ var mask = (0, _format.update)(cell.ct.fa, v_p);
252
+ cell.m = mask.toString();
253
+ }
254
+ }
255
+ }
256
+ } else if (!_lodash.default.isNil(cell.ct) && cell.ct.fa === "@") {
257
+ cell.m = vupdateStr;
258
+ cell.v = vupdate;
259
+ } else if (cell.ct != null && cell.ct.t === "d" && _lodash.default.isString(vupdate)) {
260
+ var mask = (0, _format.genarate)(vupdate);
261
+ if (mask[1].t !== "d" || mask[1].fa === cell.ct.fa) {
262
+ cell.m = mask[0], cell.ct = mask[1], cell.v = mask[2];
263
+ } else {
264
+ cell.v = mask[2];
265
+ cell.m = (0, _format.update)(cell.ct.fa, cell.v);
266
+ }
267
+ } else if (!_lodash.default.isNil(cell.ct) && !_lodash.default.isNil(cell.ct.fa) && cell.ct.fa !== "General") {
268
+ if ((0, _validation.isRealNum)(vupdate)) {
269
+ vupdate = parseFloat(vupdate);
270
+ }
271
+ var mask = (0, _format.update)(cell.ct.fa, vupdate);
272
+ if (mask === vupdate) {
273
+ mask = (0, _format.genarate)(vupdate);
274
+ cell.m = mask[0].toString();
275
+ cell.ct = mask[1], cell.v = mask[2];
276
+ } else {
277
+ if (v.m) {
278
+ cell.m = v.m;
279
+ } else {
280
+ cell.m = mask.toString();
281
+ }
282
+ cell.v = vupdate;
283
+ }
284
+ } else {
285
+ if ((0, _validation.isRealNum)(vupdate) && !/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[12])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i.test(vupdate)) {
286
+ if (typeof vupdate === "string") {
287
+ var flag = vupdate.split("").every(function (ele) {
288
+ return ele === "0" || ele === ".";
289
+ });
290
+ if (flag) {
291
+ vupdate = parseFloat(vupdate);
292
+ }
293
+ }
294
+ cell.v = vupdate;
295
+ cell.ct = {
296
+ fa: "General",
297
+ t: "n"
298
+ };
299
+ if (cell.v === Infinity || cell.v === -Infinity) {
300
+ cell.m = cell.v.toString();
301
+ } else if (cell.v != null) {
302
+ var mask = (0, _format.genarate)(cell.v);
303
+ if (mask) {
304
+ if (v.m) {
305
+ cell.m = v.m;
306
+ } else {
307
+ cell.m = mask[0].toString();
308
+ }
309
+ }
310
+ }
311
+ } else {
312
+ var mask = (0, _format.genarate)(vupdate);
313
+ if (mask) {
314
+ cell.m = mask[0].toString();
315
+ cell.ct = mask[1], cell.v = mask[2];
316
+ }
317
+ }
318
+ }
319
+ }
320
+ d[r][c] = cell;
321
+ }
322
+ function getRealCellValue(r, c, data, attr) {
323
+ var value = getCellValue(r, c, data, "m");
324
+ if (_lodash.default.isNil(value)) {
325
+ value = getCellValue(r, c, data, attr);
326
+ if (_lodash.default.isNil(value)) {
327
+ var ct = getCellValue(r, c, data, "ct");
328
+ if ((0, _inlineString.isInlineStringCT)(ct)) {
329
+ value = ct.s;
330
+ }
331
+ }
332
+ }
333
+ return value;
334
+ }
335
+ function mergeBorder(ctx, d, row_index, col_index) {
336
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
337
+ if (!d || !d[row_index]) {
338
+ console.warn("Merge info is null", row_index, col_index);
339
+ return null;
340
+ }
341
+ var value = d[row_index][col_index];
342
+ if (!value) return null;
343
+ if (value === null || value === void 0 ? void 0 : value.mc) {
344
+ var margeMaindata = value.mc;
345
+ if (!margeMaindata) {
346
+ console.warn("Merge info is null", row_index, col_index);
347
+ return null;
348
+ }
349
+ col_index = margeMaindata.c;
350
+ row_index = margeMaindata.r;
351
+ if (_lodash.default.isNil((_a = d === null || d === void 0 ? void 0 : d[row_index]) === null || _a === void 0 ? void 0 : _a[col_index])) {
352
+ console.warn("Main merge Cell info is null", row_index, col_index);
353
+ return null;
354
+ }
355
+ var col_rs = (_d = (_c = (_b = d[row_index]) === null || _b === void 0 ? void 0 : _b[col_index]) === null || _c === void 0 ? void 0 : _c.mc) === null || _d === void 0 ? void 0 : _d.cs;
356
+ var row_rs = (_g = (_f = (_e = d[row_index]) === null || _e === void 0 ? void 0 : _e[col_index]) === null || _f === void 0 ? void 0 : _f.mc) === null || _g === void 0 ? void 0 : _g.rs;
357
+ var mergeMain = (_j = (_h = d[row_index]) === null || _h === void 0 ? void 0 : _h[col_index]) === null || _j === void 0 ? void 0 : _j.mc;
358
+ if (!mergeMain || _lodash.default.isNil(mergeMain === null || mergeMain === void 0 ? void 0 : mergeMain.rs) || _lodash.default.isNil(mergeMain === null || mergeMain === void 0 ? void 0 : mergeMain.cs) || _lodash.default.isNil(col_rs) || _lodash.default.isNil(row_rs)) {
359
+ console.warn("Main merge info is null", mergeMain);
360
+ return null;
361
+ }
362
+ var start_r = void 0;
363
+ var end_r = void 0;
364
+ var row = void 0;
365
+ var row_pre = void 0;
366
+ for (var r = row_index; r < mergeMain.rs + row_index; r += 1) {
367
+ if (r === 0) {
368
+ start_r = -1;
369
+ } else {
370
+ start_r = ctx.visibledatarow[r - 1] - 1;
371
+ }
372
+ end_r = ctx.visibledatarow[r];
373
+ if (row_pre === undefined) {
374
+ row_pre = start_r;
375
+ row = end_r;
376
+ } else if (row !== undefined) {
377
+ row += end_r - start_r - 1;
378
+ }
379
+ }
380
+ var start_c = void 0;
381
+ var end_c = void 0;
382
+ var col = void 0;
383
+ var col_pre = void 0;
384
+ for (var c = col_index; c < mergeMain.cs + col_index; c += 1) {
385
+ if (c === 0) {
386
+ start_c = 0;
387
+ } else {
388
+ start_c = ctx.visibledatacolumn[c - 1];
389
+ }
390
+ end_c = ctx.visibledatacolumn[c];
391
+ if (col_pre === undefined) {
392
+ col_pre = start_c;
393
+ col = end_c;
394
+ } else if (col !== undefined) {
395
+ col += end_c - start_c;
396
+ }
397
+ }
398
+ if (_lodash.default.isNil(row_pre) || _lodash.default.isNil(col_pre) || _lodash.default.isNil(row) || _lodash.default.isNil(col)) {
399
+ console.warn("Main merge info row_pre or col_pre or row or col is null", mergeMain);
400
+ return null;
401
+ }
402
+ return {
403
+ row: [row_pre, row, row_index, row_index + row_rs - 1],
404
+ column: [col_pre, col, col_index, col_index + col_rs - 1]
405
+ };
406
+ }
407
+ return null;
408
+ }
409
+ function mergeMove(ctx, mc, columnseleted, rowseleted, s, top, height, left, width) {
410
+ var row_st = mc.r;
411
+ var row_ed = mc.r + mc.rs - 1;
412
+ var col_st = mc.c;
413
+ var col_ed = mc.c + mc.cs - 1;
414
+ var ismatch = false;
415
+ columnseleted[0] = Math.min(columnseleted[0], columnseleted[1]);
416
+ rowseleted[0] = Math.min(rowseleted[0], rowseleted[1]);
417
+ if (columnseleted[0] <= col_st && columnseleted[1] >= col_ed && rowseleted[0] <= row_st && rowseleted[1] >= row_ed || !(columnseleted[1] < col_st || columnseleted[0] > col_ed) && !(rowseleted[1] < row_st || rowseleted[0] > row_ed)) {
418
+ var flowdata = (0, _context.getFlowdata)(ctx);
419
+ if (!flowdata) return null;
420
+ var margeset = mergeBorder(ctx, flowdata, mc.r, mc.c);
421
+ if (margeset) {
422
+ var row = margeset.row[1];
423
+ var row_pre = margeset.row[0];
424
+ var col = margeset.column[1];
425
+ var col_pre = margeset.column[0];
426
+ if (!(columnseleted[1] < col_st || columnseleted[0] > col_ed)) {
427
+ if (rowseleted[0] <= row_ed && rowseleted[0] >= row_st) {
428
+ height += top - row_pre;
429
+ top = row_pre;
430
+ rowseleted[0] = row_st;
431
+ }
432
+ if (rowseleted[1] >= row_st && rowseleted[1] <= row_ed) {
433
+ if (s.row_focus >= row_st && s.row_focus <= row_ed) {
434
+ height = row - top;
435
+ } else {
436
+ height = row - top;
437
+ }
438
+ rowseleted[1] = row_ed;
439
+ }
440
+ }
441
+ if (!(rowseleted[1] < row_st || rowseleted[0] > row_ed)) {
442
+ if (columnseleted[0] <= col_ed && columnseleted[0] >= col_st) {
443
+ width += left - col_pre;
444
+ left = col_pre;
445
+ columnseleted[0] = col_st;
446
+ }
447
+ if (columnseleted[1] >= col_st && columnseleted[1] <= col_ed) {
448
+ if (s.column_focus >= col_st && s.column_focus <= col_ed) {
449
+ width = col - left;
450
+ } else {
451
+ width = col - left;
452
+ }
453
+ columnseleted[1] = col_ed;
454
+ }
455
+ }
456
+ ismatch = true;
457
+ }
458
+ }
459
+ if (ismatch) {
460
+ return [columnseleted, rowseleted, top, height, left, width];
461
+ }
462
+ return null;
463
+ }
464
+ function mergeMoveMain(ctx, columnseleted, rowseleted, s, top, height, left, width) {
465
+ var mergesetting = ctx.config.merge;
466
+ if (!mergesetting) {
467
+ return null;
468
+ }
469
+ var mcset = Object.keys(mergesetting);
470
+ rowseleted[1] = Math.max(rowseleted[0], rowseleted[1]);
471
+ columnseleted[1] = Math.max(columnseleted[0], columnseleted[1]);
472
+ var offloop = true;
473
+ var mergeMoveData = {};
474
+ while (offloop) {
475
+ offloop = false;
476
+ for (var i = 0; i < mcset.length; i += 1) {
477
+ var key = mcset[i];
478
+ var mc = mergesetting[key];
479
+ if (key in mergeMoveData) {
480
+ continue;
481
+ }
482
+ var changeparam = mergeMove(ctx, mc, columnseleted, rowseleted, s, top, height, left, width);
483
+ if (changeparam != null) {
484
+ mergeMoveData[key] = mc;
485
+ columnseleted = changeparam[0], rowseleted = changeparam[1], top = changeparam[2], height = changeparam[3], left = changeparam[4], width = changeparam[5];
486
+ offloop = true;
487
+ } else {
488
+ delete mergeMoveData[key];
489
+ }
490
+ }
491
+ }
492
+ return [columnseleted, rowseleted, top, height, left, width];
493
+ }
494
+ function cancelFunctionrangeSelected(ctx) {
495
+ if (ctx.formulaCache.selectingRangeIndex === -1) {
496
+ ctx.formulaRangeSelect = undefined;
497
+ }
498
+ }
499
+ function cancelNormalSelected(ctx) {
500
+ cancelFunctionrangeSelected(ctx);
501
+ ctx.luckysheetCellUpdate = [];
502
+ ctx.formulaRangeHighlight = [];
503
+ ctx.functionHint = null;
504
+ ctx.formulaCache.rangestart = false;
505
+ ctx.formulaCache.rangedrag_column_start = false;
506
+ ctx.formulaCache.rangedrag_row_start = false;
507
+ }
508
+ function updateCell(ctx, r, c, $input, value, canvas) {
509
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
510
+ var inputText = $input === null || $input === void 0 ? void 0 : $input.innerText;
511
+ var inputHtml = $input === null || $input === void 0 ? void 0 : $input.innerHTML;
512
+ var flowdata = (0, _context.getFlowdata)(ctx);
513
+ if (!flowdata) return;
514
+ var index = (0, _utils.getSheetIndex)(ctx, ctx.currentSheetId);
515
+ var dataVerification = ctx.luckysheetfile[index].dataVerification;
516
+ if (!_lodash.default.isNil(dataVerification)) {
517
+ var dvItem = dataVerification["".concat(r, "_").concat(c)];
518
+ if (!_lodash.default.isNil(dvItem) && dvItem.prohibitInput && !(0, _dataVerification.validateCellData)(ctx, dvItem, inputText)) {
519
+ var failureText = (0, _dataVerification.getFailureText)(ctx, dvItem);
520
+ cancelNormalSelected(ctx);
521
+ ctx.warnDialog = failureText;
522
+ return;
523
+ }
524
+ }
525
+ var curv = flowdata[r][c];
526
+ var oldValue = _lodash.default.cloneDeep(curv);
527
+ var isPrevInline = (0, _inlineString.isInlineStringCell)(curv);
528
+ var isCurInline = (inputText === null || inputText === void 0 ? void 0 : inputText.slice(0, 1)) !== "=" && (inputHtml === null || inputHtml === void 0 ? void 0 : inputHtml.substring(0, 5)) === "<span";
529
+ var isCopyVal = false;
530
+ if (!isCurInline && inputText && inputText.length > 0) {
531
+ var splitArr = inputText.replace(/\r\n/g, "_x000D_").replace(/&#13;&#10;/g, "_x000D_").replace(/\r/g, "_x000D_").replace(/\n/g, "_x000D_").split("_x000D_");
532
+ if (splitArr.length > 1 && inputHtml !== "<br>") {
533
+ isCopyVal = true;
534
+ isCurInline = true;
535
+ inputText = splitArr.join("\r\n");
536
+ }
537
+ }
538
+ if ((curv === null || curv === void 0 ? void 0 : curv.ct) && !value && !isCurInline && isPrevInline) {
539
+ delete curv.ct.s;
540
+ curv.ct.t = "g";
541
+ curv.ct.fa = "General";
542
+ curv.tb = "1";
543
+ value = "";
544
+ } else if (isCurInline) {
545
+ if (!_lodash.default.isPlainObject(curv)) {
546
+ curv = {};
547
+ }
548
+ curv || (curv = {});
549
+ var fontSize = curv.fs || 10;
550
+ if (!curv.ct) {
551
+ curv.ct = {};
552
+ curv.ct.fa = "General";
553
+ curv.tb = "1";
554
+ }
555
+ curv.ct.t = "inlineStr";
556
+ curv.ct.s = (0, _inlineString.convertSpanToShareString)($input.querySelectorAll("span"), curv);
557
+ delete curv.fs;
558
+ delete curv.f;
559
+ delete curv.v;
560
+ delete curv.m;
561
+ curv.fs = fontSize;
562
+ if (isCopyVal) {
563
+ curv.ct.s = [{
564
+ v: inputText,
565
+ fs: fontSize
566
+ }];
567
+ }
568
+ }
569
+ value = value || ($input === null || $input === void 0 ? void 0 : $input.innerText);
570
+ if (((_b = (_a = ctx.hooks).beforeUpdateCell) === null || _b === void 0 ? void 0 : _b.call(_a, r, c, value)) === false) {
571
+ cancelNormalSelected(ctx);
572
+ return;
573
+ }
574
+ if (!isCurInline) {
575
+ if ((0, _validation.isRealNull)(value) && !isPrevInline) {
576
+ if (!curv || (0, _validation.isRealNull)(curv.v) && !curv.spl && !curv.f) {
577
+ cancelNormalSelected(ctx);
578
+ return;
579
+ }
580
+ } else if (curv && curv.qp !== 1) {
581
+ if (_lodash.default.isPlainObject(curv) && (value === curv.f || value === curv.v || value === curv.m)) {
582
+ cancelNormalSelected(ctx);
583
+ return;
584
+ }
585
+ if (value === curv) {
586
+ cancelNormalSelected(ctx);
587
+ return;
588
+ }
589
+ }
590
+ if (_lodash.default.isString(value) && value.slice(0, 1) === "=" && value.length > 1) {} else if (_lodash.default.isPlainObject(curv) && curv && curv.ct && curv.ct.fa && curv.ct.fa !== "@" && !(0, _validation.isRealNull)(value)) {
591
+ delete curv.m;
592
+ if (curv.f) {
593
+ delete curv.f;
594
+ delete curv.spl;
595
+ }
596
+ }
597
+ }
598
+ var isRunExecFunction = true;
599
+ var d = flowdata;
600
+ var dynamicArrayItem = null;
601
+ if (_lodash.default.isPlainObject(curv)) {
602
+ if (!isCurInline) {
603
+ if (_lodash.default.isString(value) && value.slice(0, 1) === "=" && value.length > 1) {
604
+ var v = (0, _formula.execfunction)(ctx, value, r, c, undefined, undefined, true);
605
+ isRunExecFunction = false;
606
+ curv = _lodash.default.cloneDeep(((_c = d === null || d === void 0 ? void 0 : d[r]) === null || _c === void 0 ? void 0 : _c[c]) || {});
607
+ curv.v = v[1], curv.f = v[2];
608
+ if (v.length === 4 && v[3].type === "sparklines") {
609
+ delete curv.m;
610
+ delete curv.v;
611
+ var curCalv = v[3].data;
612
+ if (_lodash.default.isArray(curCalv) && !_lodash.default.isPlainObject(curCalv[0])) {
613
+ curv.v = curCalv[0];
614
+ } else {
615
+ curv.spl = v[3].data;
616
+ }
617
+ } else if (v.length === 4 && v[3].type === "dynamicArrayItem") {
618
+ dynamicArrayItem = v[3].data;
619
+ }
620
+ } else if (_lodash.default.isPlainObject(value)) {
621
+ var valueFunction = value.f;
622
+ if (_lodash.default.isString(valueFunction) && valueFunction.slice(0, 1) === "=" && valueFunction.length > 1) {
623
+ var v = (0, _formula.execfunction)(ctx, valueFunction, r, c, undefined, undefined, true);
624
+ isRunExecFunction = false;
625
+ curv = _lodash.default.cloneDeep(((_d = d === null || d === void 0 ? void 0 : d[r]) === null || _d === void 0 ? void 0 : _d[c]) || {});
626
+ curv.v = v[1], curv.f = v[2];
627
+ if (v.length === 4 && v[3].type === "sparklines") {
628
+ delete curv.m;
629
+ delete curv.v;
630
+ var curCalv = v[3].data;
631
+ if (_lodash.default.isArray(curCalv) && !_lodash.default.isPlainObject(curCalv[0])) {
632
+ curv.v = curCalv[0];
633
+ } else {
634
+ curv.spl = v[3].data;
635
+ }
636
+ } else if (v.length === 4 && v[3].type === "dynamicArrayItem") {
637
+ dynamicArrayItem = v[3].data;
638
+ }
639
+ } else {
640
+ Object.keys(value).forEach(function (attr) {
641
+ curv[attr] = value[attr];
642
+ });
643
+ }
644
+ } else {
645
+ (0, _formula.delFunctionGroup)(ctx, r, c);
646
+ curv = _lodash.default.cloneDeep(((_e = d === null || d === void 0 ? void 0 : d[r]) === null || _e === void 0 ? void 0 : _e[c]) || {});
647
+ curv.v = value;
648
+ delete curv.f;
649
+ delete curv.spl;
650
+ var decemialCount_1 = ((_f = oldValue === null || oldValue === void 0 ? void 0 : oldValue.m) === null || _f === void 0 ? void 0 : _f.toString().includes(".")) ? (_h = (_g = oldValue === null || oldValue === void 0 ? void 0 : oldValue.m) === null || _g === void 0 ? void 0 : _g.toString().split(" ")[0].split(".")[1]) === null || _h === void 0 ? void 0 : _h.length : 0;
651
+ var coin_1 = (_j = oldValue === null || oldValue === void 0 ? void 0 : oldValue.m) === null || _j === void 0 ? void 0 : _j.toString().split(" ")[1];
652
+ if (_typeof(curv) === "object" && (curv === null || curv === void 0 ? void 0 : curv.baseValue)) {
653
+ curv.m = "".concat((parseFloat(value) / (oldValue === null || oldValue === void 0 ? void 0 : oldValue.baseCurrencyPrice)).toFixed(decemialCount_1 || 2), " ").concat(coin_1);
654
+ curv.baseValue = value;
655
+ }
656
+ (0, _formula.execFunctionGroup)(ctx, r, c, curv);
657
+ isRunExecFunction = false;
658
+ if (curv.qp === 1 && "".concat(value).substring(0, 1) !== "'") {
659
+ curv.qp = 0;
660
+ if (curv.ct) {
661
+ curv.ct.fa = "General";
662
+ curv.ct.t = "n";
663
+ }
664
+ }
665
+ }
666
+ }
667
+ value = curv;
668
+ } else {
669
+ if (_lodash.default.isString(value) && value.slice(0, 1) === "=" && value.length > 1) {
670
+ var v = (0, _formula.execfunction)(ctx, value, r, c, undefined, undefined, true);
671
+ isRunExecFunction = false;
672
+ value = {
673
+ v: v[1],
674
+ f: v[2]
675
+ };
676
+ if (v.length === 4 && v[3].type === "sparklines") {
677
+ var curCalv = v[3].data;
678
+ if (_lodash.default.isArray(curCalv) && !_lodash.default.isPlainObject(curCalv[0])) {
679
+ value.v = curCalv[0];
680
+ } else {
681
+ value.spl = v[3].data;
682
+ }
683
+ } else if (v.length === 4 && v[3].type === "dynamicArrayItem") {
684
+ dynamicArrayItem = v[3].data;
685
+ }
686
+ } else if (_lodash.default.isPlainObject(value)) {
687
+ var valueFunction = value.f;
688
+ if (_lodash.default.isString(valueFunction) && valueFunction.slice(0, 1) === "=" && valueFunction.length > 1) {
689
+ var v = (0, _formula.execfunction)(ctx, valueFunction, r, c, undefined, undefined, true);
690
+ isRunExecFunction = false;
691
+ value.v = v[1], value.f = v[2];
692
+ if (v.length === 4 && v[3].type === "sparklines") {
693
+ var curCalv = v[3].data;
694
+ if (_lodash.default.isArray(curCalv) && !_lodash.default.isPlainObject(curCalv[0])) {
695
+ value.v = curCalv[0];
696
+ } else {
697
+ value.spl = v[3].data;
698
+ }
699
+ } else if (v.length === 4 && v[3].type === "dynamicArrayItem") {
700
+ dynamicArrayItem = v[3].data;
701
+ }
702
+ } else {
703
+ var v = curv;
704
+ if (_lodash.default.isNil(value.v)) {
705
+ value.v = v;
706
+ }
707
+ }
708
+ } else {
709
+ (0, _formula.delFunctionGroup)(ctx, r, c);
710
+ (0, _formula.execFunctionGroup)(ctx, r, c, value);
711
+ isRunExecFunction = false;
712
+ }
713
+ }
714
+ var decemialCount = ((_k = oldValue === null || oldValue === void 0 ? void 0 : oldValue.m) === null || _k === void 0 ? void 0 : _k.toString().includes(".")) ? (_m = (_l = oldValue === null || oldValue === void 0 ? void 0 : oldValue.m) === null || _l === void 0 ? void 0 : _l.toString().split(" ")[0].split(".")[1]) === null || _m === void 0 ? void 0 : _m.length : 0;
715
+ var coin = (_o = oldValue === null || oldValue === void 0 ? void 0 : oldValue.m) === null || _o === void 0 ? void 0 : _o.toString().split(" ")[1];
716
+ if (_typeof(value) === "object" && value.baseValue && !(value === null || value === void 0 ? void 0 : value.m)) {
717
+ value.m = "".concat((parseFloat(value === null || value === void 0 ? void 0 : value.v) / (oldValue === null || oldValue === void 0 ? void 0 : oldValue.baseCurrencyPrice)).toFixed(decemialCount || 2), " ").concat(coin);
718
+ }
719
+ if (typeof value === "string") {
720
+ value = {
721
+ ct: {
722
+ fa: "General",
723
+ t: "g"
724
+ },
725
+ v: value,
726
+ tb: "1"
727
+ };
728
+ } else if (_typeof(value) === "object" && !value.tb) {
729
+ value.tb = "1";
730
+ }
731
+ setCellValue(ctx, r, c, d, value);
732
+ cancelNormalSelected(ctx);
733
+ if ((curv === null || curv === void 0 ? void 0 : curv.tb) === "2" && curv.v || (0, _inlineString.isInlineStringCell)(d[r][c])) {
734
+ var defaultrowlen = ctx.defaultrowlen;
735
+ var cfg = ctx.luckysheetfile[(0, _utils.getSheetIndex)(ctx, ctx.currentSheetId)].config || {};
736
+ if (!(((_p = cfg.columnlen) === null || _p === void 0 ? void 0 : _p[c]) && ((_q = cfg.rowlen) === null || _q === void 0 ? void 0 : _q[r]))) {
737
+ var cellWidth = ((_r = cfg.columnlen) === null || _r === void 0 ? void 0 : _r[c]) || ctx.defaultcollen;
738
+ var textInfo = canvas ? (0, _text.getCellTextInfo)(d[r][c], canvas, ctx, {
739
+ r: r,
740
+ c: c,
741
+ cellWidth: cellWidth
742
+ }) : null;
743
+ var currentRowLen = defaultrowlen;
744
+ if (textInfo) {
745
+ currentRowLen = textInfo.textHeightAll + 2;
746
+ }
747
+ var previousRowHeight = (0, _api.getRowHeight)(ctx, [r])[r];
748
+ if (currentRowLen > defaultrowlen && !((_s = cfg.customHeight) === null || _s === void 0 ? void 0 : _s[r]) && previousRowHeight < currentRowLen) {
749
+ if (_lodash.default.isNil(cfg.rowlen)) cfg.rowlen = {};
750
+ cfg.rowlen[r] = currentRowLen;
751
+ }
752
+ }
753
+ }
754
+ if (ctx.hooks.afterUpdateCell) {
755
+ var newValue_1 = _lodash.default.cloneDeep(flowdata[r][c]);
756
+ var afterUpdateCell_1 = ctx.hooks.afterUpdateCell;
757
+ setTimeout(function () {
758
+ afterUpdateCell_1 === null || afterUpdateCell_1 === void 0 ? void 0 : afterUpdateCell_1(r, c, oldValue, newValue_1);
759
+ });
760
+ }
761
+ ctx.formulaCache.execFunctionGlobalData = null;
762
+ }
763
+ function getOrigincell(ctx, r, c, i) {
764
+ var data = (0, _context.getFlowdata)(ctx, i);
765
+ if (_lodash.default.isNil(r) || _lodash.default.isNil(c)) {
766
+ return null;
767
+ }
768
+ if (!data || !data[r] || !data[r][c]) {
769
+ return null;
770
+ }
771
+ return data[r][c];
772
+ }
773
+ function getcellFormula(ctx, r, c, i, data) {
774
+ var cell;
775
+ if (_lodash.default.isNil(data)) {
776
+ cell = getOrigincell(ctx, r, c, i);
777
+ } else {
778
+ cell = data[r][c];
779
+ }
780
+ if (_lodash.default.isNil(cell)) {
781
+ return null;
782
+ }
783
+ return cell.f;
784
+ }
785
+ function getRange(ctx) {
786
+ var rangeArr = _lodash.default.cloneDeep(ctx.luckysheet_select_save);
787
+ var result = [];
788
+ if (!rangeArr) return result;
789
+ for (var i = 0; i < rangeArr.length; i += 1) {
790
+ var rangeItem = rangeArr[i];
791
+ var temp = {
792
+ row: rangeItem.row,
793
+ column: rangeItem.column
794
+ };
795
+ result.push(temp);
796
+ }
797
+ return result;
798
+ }
799
+ function getFlattenedRange(ctx, range) {
800
+ range = range || getRange(ctx);
801
+ var result = [];
802
+ range.forEach(function (ele) {
803
+ var rs = ele.row;
804
+ var cs = ele.column;
805
+ for (var r = rs[0]; r <= rs[1]; r += 1) {
806
+ for (var c = cs[0]; c <= cs[1]; c += 1) {
807
+ result.push({
808
+ r: r,
809
+ c: c
810
+ });
811
+ }
812
+ }
813
+ });
814
+ return result;
815
+ }
816
+ function getRangetxt(ctx, sheetId, range, currentId) {
817
+ var sheettxt = "";
818
+ if (currentId == null) {
819
+ currentId = ctx.currentSheetId;
820
+ }
821
+ if (sheetId !== currentId) {
822
+ var index = (0, _utils.getSheetIndex)(ctx, sheetId);
823
+ if (index == null) return "";
824
+ sheettxt = ctx.luckysheetfile[index].name.replace(/'/g, "''");
825
+ if (/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/.test(sheettxt)) {
826
+ sheettxt += "!";
827
+ } else {
828
+ sheettxt = "'".concat(sheettxt, "'!");
829
+ }
830
+ }
831
+ var row0 = range.row[0];
832
+ var row1 = range.row[1];
833
+ var column0 = range.column[0];
834
+ var column1 = range.column[1];
835
+ if (row0 == null && row1 == null) {
836
+ return "".concat(sheettxt + (0, _utils.indexToColumnChar)(column0), ":").concat((0, _utils.indexToColumnChar)(column1));
837
+ }
838
+ if (column0 == null && column1 == null) {
839
+ return "".concat(sheettxt + (row0 + 1), ":").concat(row1 + 1);
840
+ }
841
+ if (column0 === column1 && row0 === row1) {
842
+ return sheettxt + (0, _utils.indexToColumnChar)(column0) + (row0 + 1);
843
+ }
844
+ return "".concat(sheettxt + (0, _utils.indexToColumnChar)(column0) + (row0 + 1), ":").concat((0, _utils.indexToColumnChar)(column1)).concat(row1 + 1);
845
+ }
846
+ function getRangeByTxt(ctx, txt) {
847
+ var range = [];
848
+ if (txt.indexOf(",") !== -1) {
849
+ var arr = txt.split(",");
850
+ for (var i = 0; i < arr.length; i += 1) {
851
+ if ((0, _formula.iscelldata)(arr[i])) {
852
+ range.push((0, _formula.getcellrange)(ctx, arr[i]));
853
+ } else {
854
+ range = [];
855
+ break;
856
+ }
857
+ }
858
+ } else {
859
+ if ((0, _formula.iscelldata)(txt)) {
860
+ range.push((0, _formula.getcellrange)(ctx, txt));
861
+ }
862
+ }
863
+ return range;
864
+ }
865
+ function isAllSelectedCellsInStatus(ctx, attr, status) {
866
+ var _a, _b, _c, _d;
867
+ if (!_lodash.default.isEmpty(ctx.luckysheetCellUpdate)) {
868
+ var w = window.getSelection();
869
+ if (!w) return false;
870
+ if (w.rangeCount === 0) return false;
871
+ var range = w.getRangeAt(0);
872
+ if (range.collapsed === true) {
873
+ return false;
874
+ }
875
+ var endContainer = range.endContainer;
876
+ var startContainer = range.startContainer;
877
+ var cssField_1 = _lodash.default.camelCase(_inlineString.attrToCssName[attr]);
878
+ if (startContainer === endContainer) {
879
+ return !_lodash.default.isEmpty((_a = startContainer.parentElement) === null || _a === void 0 ? void 0 : _a.style[cssField_1]);
880
+ }
881
+ if (((_b = startContainer.parentElement) === null || _b === void 0 ? void 0 : _b.tagName) === "SPAN" && ((_c = endContainer.parentElement) === null || _c === void 0 ? void 0 : _c.tagName) === "SPAN") {
882
+ var startSpan = startContainer.parentNode;
883
+ var endSpan = endContainer.parentNode;
884
+ var allSpans = (_d = startSpan === null || startSpan === void 0 ? void 0 : startSpan.parentNode) === null || _d === void 0 ? void 0 : _d.querySelectorAll("span");
885
+ if (allSpans) {
886
+ var startSpanIndex = _lodash.default.indexOf(allSpans, startSpan);
887
+ var endSpanIndex = _lodash.default.indexOf(allSpans, endSpan);
888
+ var rangeSpans = [];
889
+ for (var i = startSpanIndex; i <= endSpanIndex; i += 1) {
890
+ rangeSpans.push(allSpans[i]);
891
+ }
892
+ return _lodash.default.every(rangeSpans, function (s) {
893
+ return !_lodash.default.isEmpty(s.style[cssField_1]);
894
+ });
895
+ }
896
+ }
897
+ }
898
+ var cells = getFlattenedRange(ctx);
899
+ var flowdata = (0, _context.getFlowdata)(ctx);
900
+ return cells.every(function (_a) {
901
+ var _b;
902
+ var r = _a.r,
903
+ c = _a.c;
904
+ var cell = (_b = flowdata === null || flowdata === void 0 ? void 0 : flowdata[r]) === null || _b === void 0 ? void 0 : _b[c];
905
+ if (_lodash.default.isNil(cell)) {
906
+ return false;
907
+ }
908
+ return cell[attr] === status;
909
+ });
910
+ }
911
+ function getFontStyleByCell(cell, checksAF, checksCF, isCheck) {
912
+ if (isCheck === void 0) {
913
+ isCheck = true;
914
+ }
915
+ var style = {};
916
+ if (!cell) {
917
+ return style;
918
+ }
919
+ _lodash.default.forEach(cell, function (v, key) {
920
+ var _a, _b, _c, _d;
921
+ var value = cell[key];
922
+ if (isCheck) {
923
+ value = normalizedCellAttr(cell, key);
924
+ }
925
+ var valueNum = Number(value);
926
+ if (key === "bl" && valueNum !== 0) {
927
+ style.fontWeight = "bold";
928
+ }
929
+ if (key === "it" && valueNum !== 0) {
930
+ style.fontStyle = "italic";
931
+ }
932
+ if (key === "fs" && valueNum !== 10) {
933
+ style.fontSize = "".concat(valueNum, "pt");
934
+ }
935
+ if (key === "fc" && value !== "#000000" || ((_a = checksAF === null || checksAF === void 0 ? void 0 : checksAF.length) !== null && _a !== void 0 ? _a : 0) > 0 || (checksCF === null || checksCF === void 0 ? void 0 : checksCF.textColor)) {
936
+ if (checksCF === null || checksCF === void 0 ? void 0 : checksCF.textColor) {
937
+ style.color = checksCF.textColor;
938
+ } else if (((_b = checksAF === null || checksAF === void 0 ? void 0 : checksAF.length) !== null && _b !== void 0 ? _b : 0) > 0) {
939
+ style.color = checksAF[0];
940
+ } else {
941
+ style.color = value;
942
+ }
943
+ }
944
+ if (key === "cl" && valueNum !== 0) {
945
+ style.textDecoration = "line-through";
946
+ }
947
+ if (key === "un" && (valueNum === 1 || valueNum === 3)) {
948
+ var color = (_c = cell._color) !== null && _c !== void 0 ? _c : cell.fc;
949
+ var fs = (_d = cell._fontSize) !== null && _d !== void 0 ? _d : cell.fs;
950
+ style.borderBottom = "".concat(Math.floor(fs / 9), "px solid ").concat(color);
951
+ }
952
+ });
953
+ return style;
954
+ }
955
+ function getStyleByCell(ctx, d, r, c) {
956
+ var _a;
957
+ var style = {};
958
+ var checksAF = [];
959
+ var cf_compute = (0, _ConditionFormat.getComputeMap)(ctx);
960
+ var checksCF = (0, _ConditionFormat.checkCF)(r, c, cf_compute);
961
+ var cell = (_a = d === null || d === void 0 ? void 0 : d[r]) === null || _a === void 0 ? void 0 : _a[c];
962
+ if (!cell) return {};
963
+ var isInline = (0, _inlineString.isInlineStringCell)(cell);
964
+ if ("bg" in cell) {
965
+ var value = normalizedCellAttr(cell, "bg");
966
+ if (checksCF === null || checksCF === void 0 ? void 0 : checksCF.cellColor) {
967
+ if (checksCF === null || checksCF === void 0 ? void 0 : checksCF.cellColor) {
968
+ style.background = "".concat(checksCF.cellColor);
969
+ } else if (checksAF.length > 1) {
970
+ style.background = "".concat(checksAF[1]);
971
+ } else {
972
+ style.background = "".concat(value);
973
+ }
974
+ }
975
+ }
976
+ if ("ht" in cell) {
977
+ var value = normalizedCellAttr(cell, "ht");
978
+ if (Number(value) === 0) {
979
+ style.textAlign = "center";
980
+ } else if (Number(value) === 2) {
981
+ style.textAlign = "right";
982
+ }
983
+ }
984
+ if ("vt" in cell) {
985
+ var value = normalizedCellAttr(cell, "vt");
986
+ if (Number(value) === 0) {
987
+ style.alignItems = "center";
988
+ } else if (Number(value) === 2) {
989
+ style.alignItems = "flex-end";
990
+ }
991
+ }
992
+ if (!isInline) {
993
+ style = _lodash.default.assign(style, getFontStyleByCell(cell, checksAF, checksCF));
994
+ }
995
+ return style;
996
+ }
997
+ function getInlineStringHTML(r, c, data) {
998
+ var ct = getCellValue(r, c, data, "ct");
999
+ if ((0, _inlineString.isInlineStringCT)(ct)) {
1000
+ var strings = ct.s;
1001
+ var value = "";
1002
+ for (var i = 0; i < strings.length; i += 1) {
1003
+ var strObj = strings[i];
1004
+ if (strObj.v) {
1005
+ var style = getFontStyleByCell(strObj);
1006
+ var styleStr = _lodash.default.map(style, function (v, key) {
1007
+ return "".concat(_lodash.default.kebabCase(key), ":").concat(_lodash.default.isNumber(v) ? "".concat(v, "px") : v, ";");
1008
+ }).join("");
1009
+ value += "<span class=\"luckysheet-input-span\" index='".concat(i, "' style='").concat(styleStr, "'>").concat(strObj.v, "</span>");
1010
+ }
1011
+ }
1012
+ return value;
1013
+ }
1014
+ return "";
1015
+ }
1016
+ function getQKBorder(width, type, color) {
1017
+ var bordertype = "";
1018
+ if (width.toString().indexOf("pt") > -1) {
1019
+ var nWidth = parseFloat(width);
1020
+ if (nWidth < 1) {} else if (nWidth < 1.5) {
1021
+ bordertype = "Medium";
1022
+ } else {
1023
+ bordertype = "Thick";
1024
+ }
1025
+ } else {
1026
+ var nWidth = parseFloat(width);
1027
+ if (nWidth < 2) {} else if (nWidth < 3) {
1028
+ bordertype = "Medium";
1029
+ } else {
1030
+ bordertype = "Thick";
1031
+ }
1032
+ }
1033
+ var style = 0;
1034
+ type = type.toLowerCase();
1035
+ if (type === "double") {
1036
+ style = 2;
1037
+ } else if (type === "dotted") {
1038
+ if (bordertype === "Medium" || bordertype === "Thick") {
1039
+ style = 3;
1040
+ } else {
1041
+ style = 10;
1042
+ }
1043
+ } else if (type === "dashed") {
1044
+ if (bordertype === "Medium" || bordertype === "Thick") {
1045
+ style = 4;
1046
+ } else {
1047
+ style = 9;
1048
+ }
1049
+ } else if (type === "solid") {
1050
+ if (bordertype === "Medium") {
1051
+ style = 8;
1052
+ } else if (bordertype === "Thick") {
1053
+ style = 13;
1054
+ } else {
1055
+ style = 1;
1056
+ }
1057
+ }
1058
+ return [style, color];
1059
+ }
1060
+ function getdatabyselection(ctx, range, sheetId) {
1061
+ if (range == null && ctx.luckysheet_select_save) {
1062
+ range = ctx.luckysheet_select_save[0];
1063
+ }
1064
+ if (!range) return [];
1065
+ if (range.row == null || range.row.length === 0) {
1066
+ return [];
1067
+ }
1068
+ var d;
1069
+ var cfg;
1070
+ if (sheetId != null && sheetId !== ctx.currentSheetId) {
1071
+ d = ctx.luckysheetfile[(0, _utils.getSheetIndex)(ctx, sheetId)].data;
1072
+ cfg = ctx.luckysheetfile[(0, _utils.getSheetIndex)(ctx, sheetId)].config;
1073
+ } else {
1074
+ d = (0, _context.getFlowdata)(ctx);
1075
+ cfg = ctx.config;
1076
+ }
1077
+ var data = [];
1078
+ for (var r = range.row[0]; r <= range.row[1]; r += 1) {
1079
+ if ((d === null || d === void 0 ? void 0 : d[r]) == null) {
1080
+ continue;
1081
+ }
1082
+ if ((cfg === null || cfg === void 0 ? void 0 : cfg.rowhidden) != null && cfg.rowhidden[r] != null) {
1083
+ continue;
1084
+ }
1085
+ var row = [];
1086
+ for (var c = range.column[0]; c <= range.column[1]; c += 1) {
1087
+ if ((cfg === null || cfg === void 0 ? void 0 : cfg.colhidden) != null && cfg.colhidden[c] != null) {
1088
+ continue;
1089
+ }
1090
+ row.push(d[r][c]);
1091
+ }
1092
+ data.push(row);
1093
+ }
1094
+ return data;
1095
+ }
1096
+ function luckysheetUpdateCell(ctx, row_index, col_index) {
1097
+ ctx.luckysheetCellUpdate = [row_index, col_index];
1098
+ }
1099
+ function getDataBySelectionNoCopy(ctx, range) {
1100
+ if (!range || !range.row || range.row.length === 0) return [];
1101
+ var data = [];
1102
+ var flowData = (0, _context.getFlowdata)(ctx);
1103
+ if (!flowData) return [];
1104
+ for (var r = range.row[0]; r <= range.row[1]; r += 1) {
1105
+ var row = [];
1106
+ if (ctx.config.rowhidden != null && ctx.config.rowhidden[r] != null) {
1107
+ continue;
1108
+ }
1109
+ for (var c = range.column[0]; c <= range.column[1]; c += 1) {
1110
+ var value = null;
1111
+ if (ctx.config.colhidden != null && ctx.config.colhidden[c] != null) {
1112
+ continue;
1113
+ }
1114
+ if (flowData[r] != null && flowData[r][c] != null) {
1115
+ value = flowData[r][c];
1116
+ }
1117
+ row.push(value);
1118
+ }
1119
+ data.push(row);
1120
+ }
1121
+ return data;
1122
+ }