@fileverse-dev/fortune-core 1.0.5 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (346) hide show
  1. package/{dist/packages/core/src → es}/api/cell.d.ts +10 -10
  2. package/es/api/cell.js +204 -0
  3. package/{dist/packages/core/src → es}/api/common.d.ts +66 -66
  4. package/es/api/common.js +79 -0
  5. package/{dist/packages/core/src → es}/api/errors.d.ts +2 -2
  6. package/es/api/errors.js +2 -0
  7. package/{dist/packages/core/src → es}/api/index.d.ts +9 -9
  8. package/es/api/index.js +8 -0
  9. package/{dist/packages/core/src → es}/api/merge.d.ts +5 -5
  10. package/es/api/merge.js +15 -0
  11. package/{dist/packages/core/src → es}/api/range.d.ts +22 -22
  12. package/es/api/range.js +123 -0
  13. package/{dist/packages/core/src → es}/api/rowcol.d.ts +14 -14
  14. package/es/api/rowcol.js +207 -0
  15. package/{dist/packages/core/src → es}/api/sheet.d.ts +10 -10
  16. package/es/api/sheet.js +128 -0
  17. package/{dist/packages/core/src → es}/api/workbook.d.ts +15 -15
  18. package/es/api/workbook.js +85 -0
  19. package/{dist/packages/core/src → es}/canvas.d.ts +46 -46
  20. package/es/canvas.js +1350 -0
  21. package/{dist/packages/core/src → es}/context.d.ts +197 -197
  22. package/es/context.js +380 -0
  23. package/{dist/packages/core/src → es}/events/copy.d.ts +2 -2
  24. package/es/events/copy.js +78 -0
  25. package/{dist/packages/core/src → es}/events/index.d.ts +4 -4
  26. package/es/events/index.js +4 -0
  27. package/{dist/packages/core/src → es}/events/keyboard.d.ts +6 -6
  28. package/es/events/keyboard.js +332 -0
  29. package/{dist/packages/core/src → es}/events/mouse.d.ts +22 -22
  30. package/es/events/mouse.js +1725 -0
  31. package/{dist/packages/core/src → es}/events/paste.d.ts +3 -3
  32. package/es/events/paste.js +1358 -0
  33. package/{dist/packages/core/src → es}/index.d.ts +10 -10
  34. package/es/index.js +10 -0
  35. package/{dist/packages/core/src → es}/locale/en.d.ts +992 -992
  36. package/es/locale/en.js +10564 -0
  37. package/{dist/packages/core/src → es}/locale/es.d.ts +1134 -1134
  38. package/es/locale/es.js +10010 -0
  39. package/{dist/packages/core/src → es}/locale/hi.d.ts +1030 -1030
  40. package/es/locale/hi.js +10550 -0
  41. package/{dist/packages/core/src → es}/locale/index.d.ts +1049 -1049
  42. package/es/locale/index.js +23 -0
  43. package/{dist/packages/core/src → es}/locale/zh.d.ts +1048 -1048
  44. package/es/locale/zh.js +10568 -0
  45. package/{dist/packages/core/src → es}/locale/zh_tw.d.ts +1187 -1187
  46. package/es/locale/zh_tw.js +10072 -0
  47. package/{dist/packages/core/src → es}/modules/ConditionFormat.d.ts +17 -17
  48. package/es/modules/ConditionFormat.js +1258 -0
  49. package/{dist/packages/core/src → es}/modules/border.d.ts +3 -3
  50. package/es/modules/border.js +1240 -0
  51. package/{dist/packages/core/src → es}/modules/cell.d.ts +32 -32
  52. package/es/modules/cell.js +1055 -0
  53. package/{dist/packages/core/src → es}/modules/clipboard.d.ts +3 -3
  54. package/es/modules/clipboard.js +36 -0
  55. package/{dist/packages/core/src → es}/modules/color.d.ts +1 -1
  56. package/es/modules/color.js +1 -0
  57. package/{dist/packages/core/src → es}/modules/comment.d.ts +97 -97
  58. package/es/modules/comment.js +597 -0
  59. package/{dist/packages/core/src → es}/modules/conditionalFormat.d.ts +2 -2
  60. package/es/modules/conditionalFormat.js +441 -0
  61. package/{dist/packages/core/src → es}/modules/cursor.d.ts +3 -3
  62. package/es/modules/cursor.js +62 -0
  63. package/{dist/packages/core/src → es}/modules/dataVerification.d.ts +11 -11
  64. package/es/modules/dataVerification.js +700 -0
  65. package/{dist/packages/core/src → es}/modules/dropCell.d.ts +10 -10
  66. package/es/modules/dropCell.js +2266 -0
  67. package/{dist/packages/core/src → es}/modules/filter.d.ts +45 -45
  68. package/es/modules/filter.js +434 -0
  69. package/{dist/packages/core/src → es}/modules/format.d.ts +6 -6
  70. package/es/modules/format.js +323 -0
  71. package/{dist/packages/core/src → es}/modules/formula.d.ts +54 -54
  72. package/es/modules/formula.js +2301 -0
  73. package/{dist/packages/core/src → es}/modules/freeze.d.ts +5 -5
  74. package/es/modules/freeze.js +148 -0
  75. package/{dist/packages/core/src → es}/modules/hyperlink.d.ts +21 -21
  76. package/es/modules/hyperlink.js +216 -0
  77. package/{dist/packages/core/src → es}/modules/iframe.d.ts +12 -12
  78. package/es/modules/iframe.js +220 -0
  79. package/{dist/packages/core/src → es}/modules/image.d.ts +31 -31
  80. package/es/modules/image.js +253 -0
  81. package/{dist/packages/core/src → es}/modules/index.d.ts +36 -36
  82. package/es/modules/index.js +36 -0
  83. package/{dist/packages/core/src → es}/modules/inline-string.d.ts +36 -36
  84. package/es/modules/inline-string.js +437 -0
  85. package/{dist/packages/core/src → es}/modules/location.d.ts +6 -6
  86. package/es/modules/location.js +46 -0
  87. package/{dist/packages/core/src → es}/modules/locationCondition.d.ts +21 -21
  88. package/es/modules/locationCondition.js +218 -0
  89. package/{dist/packages/core/src → es}/modules/merge.d.ts +3 -3
  90. package/es/modules/merge.js +216 -0
  91. package/{dist/packages/core/src → es}/modules/mobile.d.ts +5 -5
  92. package/es/modules/mobile.js +33 -0
  93. package/{dist/packages/core/src → es}/modules/moveCells.d.ts +5 -5
  94. package/es/modules/moveCells.js +348 -0
  95. package/{dist/packages/core/src → es}/modules/protection.d.ts +5 -5
  96. package/es/modules/protection.js +96 -0
  97. package/{dist/packages/core/src → es}/modules/refresh.d.ts +3 -3
  98. package/es/modules/refresh.js +34 -0
  99. package/{dist/packages/core/src → es}/modules/rowcol.d.ts +19 -19
  100. package/es/modules/rowcol.js +1922 -0
  101. package/{dist/packages/core/src → es}/modules/screenshot.d.ts +2 -2
  102. package/es/modules/screenshot.js +90 -0
  103. package/{dist/packages/core/src → es}/modules/searchReplace.d.ts +36 -36
  104. package/es/modules/searchReplace.js +388 -0
  105. package/{dist/packages/core/src → es}/modules/selection.d.ts +46 -46
  106. package/es/modules/selection.js +1674 -0
  107. package/{dist/packages/core/src → es}/modules/sheet.d.ts +10 -10
  108. package/es/modules/sheet.js +237 -0
  109. package/{dist/packages/core/src → es}/modules/sort.d.ts +7 -7
  110. package/es/modules/sort.js +150 -0
  111. package/{dist/packages/core/src → es}/modules/splitColumn.d.ts +5 -5
  112. package/es/modules/splitColumn.js +126 -0
  113. package/es/modules/ssf.js +1533 -0
  114. package/{dist/packages/core/src → es}/modules/text.d.ts +10 -10
  115. package/es/modules/text.js +1207 -0
  116. package/{dist/packages/core/src → es}/modules/toolbar.d.ts +32 -32
  117. package/es/modules/toolbar.js +970 -0
  118. package/{dist/packages/core/src → es}/modules/validation.d.ts +19 -19
  119. package/es/modules/validation.js +190 -0
  120. package/{dist/packages/core/src → es}/modules/zoom.d.ts +3 -3
  121. package/es/modules/zoom.js +29 -0
  122. package/{dist/packages/core/src → es}/settings.d.ts +100 -100
  123. package/es/settings.js +36 -0
  124. package/{dist/packages/core/src → es}/types.d.ts +371 -371
  125. package/es/types.js +1 -0
  126. package/{dist/packages/core/src → es}/utils/freeze.d.ts +7 -7
  127. package/es/utils/freeze.js +86 -0
  128. package/{dist/packages/core/src → es}/utils/index.d.ts +18 -18
  129. package/es/utils/index.js +173 -0
  130. package/{dist/packages/core/src → es}/utils/patch.d.ts +37 -37
  131. package/es/utils/patch.js +381 -0
  132. package/lib/api/cell.d.ts +10 -0
  133. package/lib/api/cell.js +215 -0
  134. package/lib/api/common.d.ts +66 -0
  135. package/lib/api/common.js +88 -0
  136. package/lib/api/errors.d.ts +2 -0
  137. package/lib/api/errors.js +8 -0
  138. package/lib/api/index.d.ts +9 -0
  139. package/lib/api/index.js +101 -0
  140. package/lib/api/merge.d.ts +5 -0
  141. package/lib/api/merge.js +22 -0
  142. package/lib/api/range.d.ts +22 -0
  143. package/lib/api/range.js +138 -0
  144. package/lib/api/rowcol.d.ts +14 -0
  145. package/lib/api/rowcol.js +222 -0
  146. package/lib/api/sheet.d.ts +10 -0
  147. package/lib/api/sheet.js +145 -0
  148. package/lib/api/workbook.d.ts +15 -0
  149. package/lib/api/workbook.js +98 -0
  150. package/lib/canvas.d.ts +46 -0
  151. package/lib/canvas.js +1356 -0
  152. package/lib/context.d.ts +197 -0
  153. package/lib/context.js +392 -0
  154. package/lib/events/copy.d.ts +2 -0
  155. package/lib/events/copy.js +85 -0
  156. package/lib/events/index.d.ts +4 -0
  157. package/lib/events/index.js +49 -0
  158. package/lib/events/keyboard.d.ts +6 -0
  159. package/lib/events/keyboard.js +342 -0
  160. package/lib/events/mouse.d.ts +22 -0
  161. package/lib/events/mouse.js +1744 -0
  162. package/lib/events/paste.d.ts +3 -0
  163. package/lib/events/paste.js +1366 -0
  164. package/lib/index.d.ts +10 -0
  165. package/lib/index.js +109 -0
  166. package/lib/locale/en.d.ts +992 -0
  167. package/lib/locale/en.js +10570 -0
  168. package/lib/locale/es.d.ts +1134 -0
  169. package/lib/locale/es.js +10016 -0
  170. package/lib/locale/hi.d.ts +1030 -0
  171. package/lib/locale/hi.js +10556 -0
  172. package/lib/locale/index.d.ts +1049 -0
  173. package/lib/locale/index.js +29 -0
  174. package/lib/locale/zh.d.ts +1048 -0
  175. package/lib/locale/zh.js +10574 -0
  176. package/lib/locale/zh_tw.d.ts +1187 -0
  177. package/lib/locale/zh_tw.js +10078 -0
  178. package/lib/modules/ConditionFormat.d.ts +17 -0
  179. package/lib/modules/ConditionFormat.js +1273 -0
  180. package/lib/modules/border.d.ts +3 -0
  181. package/lib/modules/border.js +1248 -0
  182. package/lib/modules/cell.d.ts +32 -0
  183. package/lib/modules/cell.js +1085 -0
  184. package/lib/modules/clipboard.d.ts +3 -0
  185. package/lib/modules/clipboard.js +42 -0
  186. package/lib/modules/color.d.ts +1 -0
  187. package/lib/modules/color.js +7 -0
  188. package/lib/modules/comment.d.ts +97 -0
  189. package/lib/modules/comment.js +625 -0
  190. package/lib/modules/conditionalFormat.d.ts +2 -0
  191. package/lib/modules/conditionalFormat.js +447 -0
  192. package/lib/modules/cursor.d.ts +3 -0
  193. package/lib/modules/cursor.js +70 -0
  194. package/lib/modules/dataVerification.d.ts +11 -0
  195. package/lib/modules/dataVerification.js +715 -0
  196. package/lib/modules/dropCell.d.ts +10 -0
  197. package/lib/modules/dropCell.js +2282 -0
  198. package/lib/modules/filter.d.ts +45 -0
  199. package/lib/modules/filter.js +448 -0
  200. package/lib/modules/format.d.ts +6 -0
  201. package/lib/modules/format.js +334 -0
  202. package/lib/modules/formula.d.ts +54 -0
  203. package/lib/modules/formula.js +2330 -0
  204. package/lib/modules/freeze.d.ts +5 -0
  205. package/lib/modules/freeze.js +158 -0
  206. package/lib/modules/hyperlink.d.ts +21 -0
  207. package/lib/modules/hyperlink.js +232 -0
  208. package/lib/modules/iframe.d.ts +12 -0
  209. package/lib/modules/iframe.js +236 -0
  210. package/lib/modules/image.d.ts +31 -0
  211. package/lib/modules/image.js +272 -0
  212. package/lib/modules/index.d.ts +36 -0
  213. package/lib/modules/index.js +401 -0
  214. package/lib/modules/inline-string.d.ts +36 -0
  215. package/lib/modules/inline-string.js +452 -0
  216. package/lib/modules/location.d.ts +6 -0
  217. package/lib/modules/location.js +57 -0
  218. package/lib/modules/locationCondition.d.ts +21 -0
  219. package/lib/modules/locationCondition.js +229 -0
  220. package/lib/modules/merge.d.ts +3 -0
  221. package/lib/modules/merge.js +223 -0
  222. package/lib/modules/mobile.d.ts +5 -0
  223. package/lib/modules/mobile.js +41 -0
  224. package/lib/modules/moveCells.d.ts +5 -0
  225. package/lib/modules/moveCells.js +357 -0
  226. package/lib/modules/protection.d.ts +5 -0
  227. package/lib/modules/protection.js +106 -0
  228. package/lib/modules/refresh.d.ts +3 -0
  229. package/lib/modules/refresh.js +40 -0
  230. package/lib/modules/rowcol.d.ts +19 -0
  231. package/lib/modules/rowcol.js +1935 -0
  232. package/lib/modules/screenshot.d.ts +2 -0
  233. package/lib/modules/screenshot.js +96 -0
  234. package/lib/modules/searchReplace.d.ts +36 -0
  235. package/lib/modules/searchReplace.js +402 -0
  236. package/lib/modules/selection.d.ts +46 -0
  237. package/lib/modules/selection.js +1703 -0
  238. package/lib/modules/sheet.d.ts +10 -0
  239. package/lib/modules/sheet.js +250 -0
  240. package/lib/modules/sort.d.ts +7 -0
  241. package/lib/modules/sort.js +159 -0
  242. package/lib/modules/splitColumn.d.ts +5 -0
  243. package/lib/modules/splitColumn.js +136 -0
  244. package/lib/modules/ssf.js +1539 -0
  245. package/lib/modules/text.d.ts +10 -0
  246. package/lib/modules/text.js +1221 -0
  247. package/lib/modules/toolbar.d.ts +32 -0
  248. package/lib/modules/toolbar.js +1003 -0
  249. package/lib/modules/validation.d.ts +19 -0
  250. package/lib/modules/validation.js +205 -0
  251. package/lib/modules/zoom.d.ts +3 -0
  252. package/lib/modules/zoom.js +36 -0
  253. package/lib/settings.d.ts +100 -0
  254. package/lib/settings.js +42 -0
  255. package/lib/types.d.ts +371 -0
  256. package/lib/types.js +5 -0
  257. package/lib/utils/freeze.d.ts +7 -0
  258. package/lib/utils/freeze.js +92 -0
  259. package/lib/utils/index.d.ts +18 -0
  260. package/lib/utils/index.js +231 -0
  261. package/lib/utils/patch.d.ts +37 -0
  262. package/lib/utils/patch.js +392 -0
  263. package/package.json +6 -5
  264. package/dist/index.esm.js +0 -80253
  265. package/dist/index.js +0 -80599
  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,1258 @@
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 { getFlowdata } from "../context";
13
+ import { getSheetIndex } from "../utils";
14
+ import { getCellValue, getRangeByTxt } from "./cell";
15
+ import { genarate } from "./format";
16
+ import { execfunction, functionCopy } from "./formula";
17
+ import { checkProtectionFormatCells } from "./protection";
18
+ import { isRealNull } from "./validation";
19
+ export function getHistoryRules(fileH) {
20
+ var historyRules = [];
21
+ for (var h = 0; h < fileH.length; h += 1) {
22
+ historyRules.push({
23
+ sheetIndex: h,
24
+ luckysheet_conditionformat_save: fileH[h].luckysheet_conditionformat_save
25
+ });
26
+ }
27
+ return historyRules;
28
+ }
29
+ export function getCurrentRules(fileC) {
30
+ var currentRules = [];
31
+ for (var c = 0; c < fileC.length; c += 1) {
32
+ currentRules.push({
33
+ sheetIndex: c,
34
+ luckysheet_conditionformat_save: fileC[c].luckysheet_conditionformat_save
35
+ });
36
+ }
37
+ return currentRules;
38
+ }
39
+ export function setConditionRules(ctx, protection, generalDialog, conditionformat, rules) {
40
+ var _a, _b;
41
+ if (!checkProtectionFormatCells(ctx)) {
42
+ return;
43
+ }
44
+ var conditionName = rules.rulesType;
45
+ var conditionRange = [];
46
+ var conditionValue = [];
47
+ if (conditionName === "greaterThan" || conditionName === "lessThan" || conditionName === "equal" || conditionName === "textContains") {
48
+ var v = rules.rulesValue;
49
+ var rangeArr = getRangeByTxt(ctx, v);
50
+ if (rangeArr.length > 1) {
51
+ var r1 = rangeArr[0].row[0];
52
+ var r2 = rangeArr[0].row[1];
53
+ var c1 = rangeArr[0].column[0];
54
+ var c2 = rangeArr[0].column[1];
55
+ if (r1 === r2 && c1 === c2) {
56
+ var d = getFlowdata(ctx);
57
+ if (!d) return;
58
+ v = getCellValue(r1, c1, d);
59
+ conditionRange.push({
60
+ row: rangeArr[0].row,
61
+ column: rangeArr[0].column
62
+ });
63
+ conditionValue.push(v);
64
+ } else {
65
+ ctx.warnDialog = conditionformat.onlySingleCell;
66
+ }
67
+ } else if (rangeArr.length === 0) {
68
+ if (_.isNaN(v) || v === "") {
69
+ ctx.warnDialog = conditionformat.conditionValueCanOnly;
70
+ return;
71
+ }
72
+ conditionValue.push(v);
73
+ }
74
+ } else if (conditionName === "between") {
75
+ var v1 = rules.betweenValue.value1;
76
+ var v2 = rules.betweenValue.value2;
77
+ var rangeArr1 = getRangeByTxt(ctx, v1);
78
+ if (rangeArr1.length > 1) {
79
+ ctx.warnDialog = conditionformat.onlySingleCell;
80
+ return;
81
+ }
82
+ if (rangeArr1.length === 1) {
83
+ var r1 = rangeArr1[0].row[0];
84
+ var r2 = rangeArr1[0].row[1];
85
+ var c1 = rangeArr1[0].column[0];
86
+ var c2 = rangeArr1[0].column[1];
87
+ if (r1 === r2 && c1 === c2) {
88
+ var d = getFlowdata(ctx);
89
+ if (!d) return;
90
+ v1 = getCellValue(r1, c1, d);
91
+ conditionRange.push({
92
+ row: rangeArr1[0].row,
93
+ column: rangeArr1[0].column
94
+ });
95
+ conditionValue.push(v1);
96
+ } else {
97
+ ctx.warnDialog = conditionformat.onlySingleCell;
98
+ return;
99
+ }
100
+ } else if (rangeArr1.length === 0) {
101
+ if (_.isNaN(v1) || v1 === "") {
102
+ ctx.warnDialog = conditionformat.conditionValueCanOnly;
103
+ return;
104
+ }
105
+ conditionValue.push(v1);
106
+ }
107
+ var rangeArr2 = getRangeByTxt(ctx, v2);
108
+ if (rangeArr2.length > 1) {
109
+ ctx.warnDialog = conditionformat.onlySingleCell;
110
+ return;
111
+ }
112
+ if (rangeArr2.length === 1) {
113
+ var r1 = rangeArr2[0].row[0];
114
+ var r2 = rangeArr2[0].row[1];
115
+ var c1 = rangeArr2[0].column[0];
116
+ var c2 = rangeArr2[0].column[1];
117
+ if (r1 === r2 && c1 === c2) {
118
+ var d = getFlowdata(ctx);
119
+ if (!d) return;
120
+ v2 = getCellValue(r1, c1, d);
121
+ conditionRange.push({
122
+ row: rangeArr2[0].row,
123
+ column: rangeArr2[0].column
124
+ });
125
+ } else {
126
+ ctx.warnDialog = conditionformat.onlySingleCell;
127
+ return;
128
+ }
129
+ } else if (rangeArr2.length === 0) {
130
+ if (_.isNaN(v2) || v2 === "") {
131
+ ctx.warnDialog = conditionformat.conditionValueCanOnly;
132
+ } else {
133
+ conditionValue.push(v2);
134
+ }
135
+ }
136
+ } else if (conditionName === "occurrenceDate") {
137
+ var v = rules.dateValue;
138
+ if (!v) {
139
+ ctx.warnDialog = conditionformat.pleaseSelectADate;
140
+ return;
141
+ }
142
+ conditionValue.push(v);
143
+ } else if (conditionName === "duplicateValue") {
144
+ conditionValue.push(rules.repeatValue);
145
+ } else if (conditionName === "top10" || conditionName === "top10_percent" || conditionName === "last10" || conditionName === "last10_percent") {
146
+ var v = rules.projectValue;
147
+ if (parseInt(v, 10).toString() !== v || parseInt(v, 10) < 1 || parseInt(v, 10) > 1000) {
148
+ ctx.warnDialog = conditionformat.pleaseEnterInteger;
149
+ return;
150
+ }
151
+ conditionValue.push(v);
152
+ } else {
153
+ conditionValue.push(conditionName);
154
+ }
155
+ var textColor = null;
156
+ if (rules.textColor.check) {
157
+ textColor = rules.textColor.color;
158
+ }
159
+ var cellColor = null;
160
+ if (rules.cellColor.check) {
161
+ cellColor = rules.cellColor.color;
162
+ }
163
+ var rule = {
164
+ type: "default",
165
+ cellrange: (_a = ctx.luckysheet_select_save) !== null && _a !== void 0 ? _a : [],
166
+ format: {
167
+ textColor: textColor,
168
+ cellColor: cellColor
169
+ },
170
+ conditionName: conditionName,
171
+ conditionRange: conditionRange,
172
+ conditionValue: conditionValue
173
+ };
174
+ var index = getSheetIndex(ctx, ctx.currentSheetId);
175
+ var ruleArr = (_b = ctx.luckysheetfile[index].luckysheet_conditionformat_save) !== null && _b !== void 0 ? _b : [];
176
+ ruleArr === null || ruleArr === void 0 ? void 0 : ruleArr.push(rule);
177
+ ctx.luckysheetfile[index].luckysheet_conditionformat_save = ruleArr;
178
+ ctx.luckysheetfile[index].conditionRules = __assign(__assign({}, rules), {
179
+ rulesType: rules.rulesType || "",
180
+ rulesValue: rules.rulesValue || "",
181
+ textColor: rules.textColor || {
182
+ check: true,
183
+ color: "#000000"
184
+ },
185
+ cellColor: rules.cellColor || {
186
+ check: true,
187
+ color: "#000000"
188
+ },
189
+ betweenValue: rules.betweenValue || {
190
+ value1: "",
191
+ value2: ""
192
+ },
193
+ dateValue: rules.dateValue || "",
194
+ repeatValue: rules.repeatValue || "0",
195
+ projectValue: rules.projectValue || "10"
196
+ });
197
+ }
198
+ export function getColorGradation(color1, color2, value1, value2, value) {
199
+ var rgb1 = color1.split(",");
200
+ var r1 = parseInt(rgb1[0].split("(")[1], 10);
201
+ var g1 = parseInt(rgb1[1], 10);
202
+ var b1 = parseInt(rgb1[2].split(")")[0], 10);
203
+ var rgb2 = color2.split(",");
204
+ var r2 = parseInt(rgb2[0].split("(")[1], 10);
205
+ var g2 = parseInt(rgb2[1], 10);
206
+ var b2 = parseInt(rgb2[2].split(")")[0], 10);
207
+ var v12 = value1 - value2;
208
+ var v10 = value1 - value;
209
+ var r = Math.round(r1 - (r1 - r2) / v12 * v10);
210
+ var g = Math.round(g1 - (g1 - g2) / v12 * v10);
211
+ var b = Math.round(b1 - (b1 - b2) / v12 * v10);
212
+ return "rgb(".concat(r, ", ").concat(g, ", ").concat(b, ")");
213
+ }
214
+ export function compute(ctx, ruleArr, d) {
215
+ if (_.isNil(ruleArr)) {
216
+ ruleArr = [];
217
+ }
218
+ var computeMap = {};
219
+ if (ruleArr.length > 0) {
220
+ var _loop_1 = function _loop_1(i) {
221
+ var _a = ruleArr[i],
222
+ type = _a.type,
223
+ cellrange = _a.cellrange,
224
+ format = _a.format;
225
+ if (type === "dataBar") {
226
+ var max = null;
227
+ var min = null;
228
+ for (var s = 0; s < cellrange.length; s += 1) {
229
+ for (var r = cellrange[s].row[0]; r <= cellrange[s].row[1]; r += 1) {
230
+ for (var c = cellrange[s].column[0]; c <= cellrange[s].column[1]; c += 1) {
231
+ if (_.isNil(d[r]) || _.isNil(d[r][c])) {
232
+ continue;
233
+ }
234
+ var cell = d[r][c];
235
+ if (!_.isNil(cell) && !_.isNil(cell.ct) && cell.ct.t === "n" && _.isNil(cell.v)) {
236
+ if (_.isNil(max) || parseInt("".concat(cell.v), 10) > max) {
237
+ max = parseInt("".concat(cell.v), 10);
238
+ }
239
+ if (_.isNil(min) || parseInt("".concat(cell.v), 10) < min) {
240
+ min = parseInt("".concat(cell.v), 10);
241
+ }
242
+ }
243
+ }
244
+ }
245
+ }
246
+ if (!_.isNil(max) && !_.isNil(min)) {
247
+ if (min < 0) {
248
+ var plusLen = Math.round(max / (max - min) * 10) / 10;
249
+ var minusLen = Math.round(Math.abs(min) / (max - min) * 10) / 10;
250
+ for (var s = 0; s < cellrange.length; s += 1) {
251
+ for (var r = cellrange[s].row[0]; r <= cellrange[s].row[1]; r += 1) {
252
+ for (var c = cellrange[s].column[0]; c <= cellrange[s].column[1]; c += 1) {
253
+ if (_.isNil(d[r]) || _.isNil(d[r][c])) {
254
+ continue;
255
+ }
256
+ var cell = d[r][c];
257
+ if (!_.isNil(cell) && !_.isNil(cell.ct) && cell.ct.t === "n" && !_.isNil(cell.v)) {
258
+ if (parseInt("".concat(cell.v), 10) < 0) {
259
+ var valueLen = Math.round(Math.abs(parseInt("".concat(cell.v), 10)) / Math.abs(min) * 100) / 100;
260
+ if ("".concat(r, "_").concat(c) in computeMap) {
261
+ computeMap["".concat(r, "_").concat(c)].dataBar = {
262
+ valueType: "minus",
263
+ minusLen: minusLen,
264
+ valueLen: valueLen,
265
+ format: format
266
+ };
267
+ } else {
268
+ computeMap["".concat(r, "_").concat(c)] = {
269
+ dataBar: {
270
+ valueType: "minus",
271
+ minusLen: minusLen,
272
+ valueLen: valueLen,
273
+ format: format
274
+ }
275
+ };
276
+ }
277
+ }
278
+ if (parseInt("".concat(cell.v), 10) > 0) {
279
+ var valueLen = Math.round(parseInt("".concat(cell.v), 10) / max * 100) / 100;
280
+ if ("".concat(r, "_").concat(c) in computeMap) {
281
+ computeMap["".concat(r, "_").concat(c)].dataBar = {
282
+ valueType: "plus",
283
+ plusLen: plusLen,
284
+ minusLen: minusLen,
285
+ valueLen: valueLen,
286
+ format: format
287
+ };
288
+ } else {
289
+ computeMap["".concat(r, "_").concat(c)] = {
290
+ dataBar: {
291
+ valueType: "plus",
292
+ plusLen: plusLen,
293
+ minusLen: minusLen,
294
+ valueLen: valueLen,
295
+ format: format
296
+ }
297
+ };
298
+ }
299
+ }
300
+ }
301
+ }
302
+ }
303
+ }
304
+ } else {
305
+ var plusLen = 1;
306
+ for (var s = 0; s < cellrange.length; s += 1) {
307
+ for (var r = cellrange[s].row[0]; r <= cellrange[s].row[1]; r += 1) {
308
+ for (var c = cellrange[s].column[0]; c <= cellrange[s].column[1]; c += 1) {
309
+ if (_.isNil(d[r]) || _.isNil(d[r][c])) {
310
+ continue;
311
+ }
312
+ var cell = d[r][c];
313
+ if (!_.isNil(cell) && !_.isNil(cell.ct) && cell.ct.t === "n" && !_.isNil(cell.v)) {
314
+ var valueLen = void 0;
315
+ if (max === 0) {
316
+ valueLen = 1;
317
+ } else {
318
+ valueLen = Math.round(parseInt("".concat(cell.v), 10) / max * 100) / 100;
319
+ }
320
+ if ("".concat(r, "_").concat(c) in computeMap) {
321
+ computeMap["".concat(r, "_").concat(c)].dataBar = {
322
+ valueType: "plus",
323
+ plusLen: plusLen,
324
+ valueLen: valueLen,
325
+ format: format
326
+ };
327
+ } else {
328
+ computeMap["".concat(r, "_").concat(c)] = {
329
+ dataBar: {
330
+ valueType: "plus",
331
+ plusLen: plusLen,
332
+ valueLen: valueLen,
333
+ format: format
334
+ }
335
+ };
336
+ }
337
+ }
338
+ }
339
+ }
340
+ }
341
+ }
342
+ }
343
+ } else if (type === "colorGradation") {
344
+ var max = null;
345
+ var min = null;
346
+ var sum = 0;
347
+ var count = 0;
348
+ for (var s = 0; s < cellrange.length; s += 1) {
349
+ for (var r = cellrange[s].row[0]; r <= cellrange[s].row[1]; r += 1) {
350
+ for (var c = cellrange[s].column[0]; c <= cellrange[s].column[1]; c += 1) {
351
+ if (_.isNil(d[r]) || _.isNil(d[r][c])) {
352
+ continue;
353
+ }
354
+ var cell = d[r][c];
355
+ if (!_.isNil(cell) && !_.isNil(cell.ct) && cell.ct.t === "n" && !_.isNil(cell.v)) {
356
+ count += 1;
357
+ sum += parseInt("".concat(cell.v), 10);
358
+ if (_.isNil(max) || parseInt("".concat(cell.v), 10) > max) {
359
+ max = parseInt("".concat(cell.v), 10);
360
+ }
361
+ if (_.isNil(min) || parseInt("".concat(cell.v), 10) < min) {
362
+ min = parseInt("".concat(cell.v), 10);
363
+ }
364
+ }
365
+ }
366
+ }
367
+ }
368
+ if (!_.isNil(max) && !_.isNil(min)) {
369
+ if (format.length === 3) {
370
+ var avg = Math.floor(sum / count);
371
+ for (var s = 0; s < cellrange.length; s += 1) {
372
+ for (var r = cellrange[s].row[0]; r <= cellrange[s].row[1]; r += 1) {
373
+ for (var c = cellrange[s].column[0]; c <= cellrange[s].column[1]; c += 1) {
374
+ if (_.isNil(d[r]) || _.isNil(d[r][c])) {
375
+ continue;
376
+ }
377
+ var cell = d[r][c];
378
+ if (!_.isNil(cell) && !_.isNil(cell.ct) && cell.ct.t === "n" && !_.isNil(cell.v)) {
379
+ if (parseInt("".concat(cell.v), 10) === min) {
380
+ if ("".concat(r, "_").concat(c) in computeMap) {
381
+ computeMap["".concat(r, "_").concat(c)].cellColor = format.cellColor;
382
+ } else {
383
+ computeMap["".concat(r, "_").concat(c)] = {
384
+ cellColor: format.cellColor
385
+ };
386
+ }
387
+ } else if (parseInt("".concat(cell.v), 10) > min && parseInt("".concat(cell.v), 10) < avg) {
388
+ if ("".concat(r, "_").concat(c) in computeMap) {
389
+ computeMap["".concat(r, "_").concat(c)].cellColor = getColorGradation(format.cellColor, format.textColor, min, avg, parseInt("".concat(cell.v), 10));
390
+ } else {
391
+ computeMap["".concat(r, "_").concat(c)] = {
392
+ cellColor: getColorGradation(format[2], format[1], min, avg, parseInt("".concat(cell.v), 10))
393
+ };
394
+ }
395
+ } else if (parseInt("".concat(cell.v), 10) === avg) {
396
+ if ("".concat(r, "_").concat(c) in computeMap) {
397
+ computeMap["".concat(r, "_").concat(c)].cellColor = format.cellColor;
398
+ } else {
399
+ computeMap["".concat(r, "_").concat(c)] = {
400
+ cellColor: format[1]
401
+ };
402
+ }
403
+ } else if (parseInt("".concat(cell.v), 10) > avg && parseInt("".concat(cell.v), 10) < max) {
404
+ if ("".concat(r, "_").concat(c) in computeMap) {
405
+ computeMap["".concat(r, "_").concat(c)].cellColor = getColorGradation(format[1], format[0], avg, max, parseInt("".concat(cell.v), 10));
406
+ } else {
407
+ computeMap["".concat(r, "_").concat(c)] = {
408
+ cellColor: getColorGradation(format[1], format[0], avg, max, parseInt("".concat(cell.v), 10))
409
+ };
410
+ }
411
+ } else if (parseInt("".concat(cell.v), 10) === max) {
412
+ if ("".concat(r, "_").concat(c) in computeMap) {
413
+ computeMap["".concat(r, "_").concat(c)].cellColor = format.cellColor;
414
+ } else {
415
+ computeMap["".concat(r, "_").concat(c)] = {
416
+ cellColor: format[0]
417
+ };
418
+ }
419
+ }
420
+ }
421
+ }
422
+ }
423
+ }
424
+ } else if (format.length === 2) {
425
+ for (var s = 0; s < cellrange.length; s += 1) {
426
+ for (var r = cellrange[s].row[0]; r <= cellrange[s].row[1]; r += 1) {
427
+ for (var c = cellrange[s].column[0]; c <= cellrange[s].column[1]; c += 1) {
428
+ if (_.isNil(d[r]) || _.isNil(d[r][c])) {
429
+ continue;
430
+ }
431
+ var cell = d[r][c];
432
+ if (!_.isNil(cell) && !_.isNil(cell.ct) && cell.ct.t === "n" && !_.isNil(cell.v)) {
433
+ if (parseInt("".concat(cell.v), 10) === min) {
434
+ if ("".concat(r, "_").concat(c) in computeMap) {
435
+ computeMap["".concat(r, "_").concat(c)].cellColor = format.cellColor;
436
+ } else {
437
+ computeMap["".concat(r, "_").concat(c)] = {
438
+ cellColor: format[1]
439
+ };
440
+ }
441
+ } else if (parseInt("".concat(cell.v), 10) > min && parseInt("".concat(cell.v), 10) < max) {
442
+ if ("".concat(r, "_").concat(c) in computeMap) {
443
+ computeMap["".concat(r, "_").concat(c)].cellColor = getColorGradation(format[1], format[0], min, max, parseInt("".concat(cell.v), 10));
444
+ } else {
445
+ computeMap["".concat(r, "_").concat(c)] = {
446
+ cellColor: getColorGradation(format[1], format[0], min, max, parseInt("".concat(cell.v), 10))
447
+ };
448
+ }
449
+ } else if (parseInt("".concat(cell.v), 10) === max) {
450
+ if ("".concat(r, "_").concat(c) in computeMap) {
451
+ computeMap["".concat(r, "_").concat(c)].cellColor = format.textColor;
452
+ } else {
453
+ computeMap["".concat(r, "_").concat(c)] = {
454
+ cellColor: format[0]
455
+ };
456
+ }
457
+ }
458
+ }
459
+ }
460
+ }
461
+ }
462
+ }
463
+ }
464
+ } else if (type === "icons") {} else {
465
+ var conditionName = ruleArr[i].conditionName;
466
+ var conditionValue0 = ruleArr[i].conditionValue[0];
467
+ var conditionValue1 = ruleArr[i].conditionValue[1];
468
+ var textColor_1 = format.textColor,
469
+ cellColor_1 = format.cellColor;
470
+ for (var s = 0; s < cellrange.length; s += 1) {
471
+ if (conditionName === "greaterThan" || conditionName === "lessThan" || conditionName === "equal" || conditionName === "textContains") {
472
+ for (var r = cellrange[s].row[0]; r <= cellrange[s].row[1]; r += 1) {
473
+ for (var c = cellrange[s].column[0]; c <= cellrange[s].column[1]; c += 1) {
474
+ if (_.isNil(d[r]) || _.isNil(d[r][c])) {
475
+ continue;
476
+ }
477
+ var cell = d[r][c];
478
+ if (_.isNil(cell) || _.isNil(cell.v) || isRealNull(cell.v)) {
479
+ continue;
480
+ }
481
+ if (conditionName === "greaterThan" && Number(cell.v) > Number(conditionValue0)) {
482
+ if ("".concat(r, "_").concat(c) in computeMap) {
483
+ computeMap["".concat(r, "_").concat(c)].textColor = textColor_1;
484
+ computeMap["".concat(r, "_").concat(c)].cellColor = cellColor_1;
485
+ } else {
486
+ computeMap["".concat(r, "_").concat(c)] = {
487
+ textColor: textColor_1,
488
+ cellColor: cellColor_1
489
+ };
490
+ }
491
+ } else if (conditionName === "lessThan" && Number(cell.v) < Number(conditionValue0)) {
492
+ if ("".concat(r, "_").concat(c) in computeMap) {
493
+ computeMap["".concat(r, "_").concat(c)].textColor = textColor_1;
494
+ computeMap["".concat(r, "_").concat(c)].cellColor = cellColor_1;
495
+ } else {
496
+ computeMap["".concat(r, "_").concat(c)] = {
497
+ textColor: textColor_1,
498
+ cellColor: cellColor_1
499
+ };
500
+ }
501
+ } else if (conditionName === "equal" && cell.v.toString() === conditionValue0) {
502
+ if ("".concat(r, "_").concat(c) in computeMap) {
503
+ computeMap["".concat(r, "_").concat(c)].textColor = textColor_1;
504
+ computeMap["".concat(r, "_").concat(c)].cellColor = cellColor_1;
505
+ } else {
506
+ computeMap["".concat(r, "_").concat(c)] = {
507
+ textColor: textColor_1,
508
+ cellColor: cellColor_1
509
+ };
510
+ }
511
+ } else if (conditionName === "textContains" && cell.v.toString().indexOf(conditionValue0) !== -1) {
512
+ if ("".concat(r, "_").concat(c) in computeMap) {
513
+ computeMap["".concat(r, "_").concat(c)].textColor = textColor_1;
514
+ computeMap["".concat(r, "_").concat(c)].cellColor = cellColor_1;
515
+ } else {
516
+ computeMap["".concat(r, "_").concat(c)] = {
517
+ textColor: textColor_1,
518
+ cellColor: cellColor_1
519
+ };
520
+ }
521
+ }
522
+ }
523
+ }
524
+ } else if (conditionName === "between") {
525
+ var vBig = 0;
526
+ var vSmall = 0;
527
+ if (conditionValue0 > conditionValue1) {
528
+ vBig = conditionValue0;
529
+ vSmall = conditionValue1;
530
+ } else {
531
+ vBig = conditionValue1;
532
+ vSmall = conditionValue0;
533
+ }
534
+ for (var r = cellrange[s].row[0]; r <= cellrange[s].row[1]; r += 1) {
535
+ for (var c = cellrange[s].column[0]; c <= cellrange[s].column[1]; c += 1) {
536
+ if (_.isNil(d[r]) || _.isNil(d[r][c])) {
537
+ continue;
538
+ }
539
+ var cell = d[r][c];
540
+ if (_.isNil(cell) || _.isNil(cell.v) || isRealNull(cell.v)) {
541
+ continue;
542
+ }
543
+ if (Number(cell.v) >= Number(vSmall) && Number(cell.v) <= Number(vBig)) {
544
+ if ("".concat(r, "_").concat(c) in computeMap) {
545
+ computeMap["".concat(r, "_").concat(c)].textColor = textColor_1;
546
+ computeMap["".concat(r, "_").concat(c)].cellColor = cellColor_1;
547
+ } else {
548
+ computeMap["".concat(r, "_").concat(c)] = {
549
+ textColor: textColor_1,
550
+ cellColor: cellColor_1
551
+ };
552
+ }
553
+ }
554
+ }
555
+ }
556
+ } else if (conditionName === "occurrenceDate") {
557
+ var dBig = void 0;
558
+ var dSmall = void 0;
559
+ if (conditionValue0.toString().indexOf("-") === -1) {
560
+ dBig = genarate(conditionValue0)[2].toString();
561
+ dSmall = genarate(conditionValue0)[2].toString();
562
+ } else {
563
+ var str = conditionValue0.toString().split("-");
564
+ dBig = genarate(str[1].trim())[2].toString();
565
+ dSmall = genarate(str[0].trim()[2].toString());
566
+ }
567
+ for (var r = cellrange[s].row[0]; r <= cellrange[s].row[1]; r += 1) {
568
+ for (var c = cellrange[s].column[0]; c <= cellrange[s].column[1]; c += 1) {
569
+ if (_.isNil(d[r]) || _.isNil(d[r][c])) {
570
+ continue;
571
+ }
572
+ if (!_.isNil(d[r][c]) && !_.isNil(d[r][c].ct) && d[r][c].ct.t === "d") {
573
+ var cellVal = getCellValue(r, c, d);
574
+ if (cellVal >= dSmall && cellVal <= dBig) {
575
+ if ("".concat(r, "_").concat(c) in computeMap) {
576
+ computeMap["".concat(r, "_").concat(c)].textColor = textColor_1;
577
+ computeMap["".concat(r, "_").concat(c)].cellColor = cellColor_1;
578
+ } else {
579
+ computeMap["".concat(r, "_").concat(c)] = {
580
+ textColor: textColor_1,
581
+ cellColor: cellColor_1
582
+ };
583
+ }
584
+ }
585
+ }
586
+ }
587
+ }
588
+ } else if (conditionName === "duplicateValue") {
589
+ var dmap = {};
590
+ for (var r = cellrange[s].row[0]; r <= cellrange[s].row[1]; r += 1) {
591
+ for (var c = cellrange[s].column[0]; c <= cellrange[s].column[1]; c += 1) {
592
+ var item = getCellValue(r, c, d);
593
+ if (!(item in dmap)) {
594
+ dmap[item] = [];
595
+ }
596
+ dmap[item].push({
597
+ r: r,
598
+ c: c
599
+ });
600
+ }
601
+ }
602
+ if (conditionValue0 === "0") {
603
+ _.forEach(dmap, function (x) {
604
+ if (x.length > 1) {
605
+ for (var j = 0; j < x.length; j += 1) {
606
+ if ("".concat(x[j].r, "_").concat(x[j].c) in computeMap) {
607
+ computeMap["".concat(x[j].r, "_").concat(x[j].c)].textColor = textColor_1;
608
+ computeMap["".concat(x[j].r, "_").concat(x[j].c)].cellColor = cellColor_1;
609
+ } else {
610
+ computeMap["".concat(x[j].r, "_").concat(x[j].c)] = {
611
+ textColor: textColor_1,
612
+ cellColor: cellColor_1
613
+ };
614
+ }
615
+ }
616
+ }
617
+ });
618
+ } else if (conditionValue0 === "1") {
619
+ _.forEach(dmap, function (x) {
620
+ if (x.length === 1) {
621
+ if ("".concat(x[0].r, "_").concat(x[0].c) in computeMap) {
622
+ computeMap["".concat(x[0].r, "_").concat(x[0].c)].textColor = textColor_1;
623
+ computeMap["".concat(x[0].r, "_").concat(x[0].c)].cellColor = cellColor_1;
624
+ } else {
625
+ computeMap["".concat(x[0].r, "_").concat(x[0].c)] = {
626
+ textColor: textColor_1,
627
+ cellColor: cellColor_1
628
+ };
629
+ }
630
+ }
631
+ });
632
+ }
633
+ } else if (conditionName === "top10" || conditionName === "top10_percent" || conditionName === "last10" || conditionName === "last10_percent" || conditionName === "aboveAverage" || conditionName === "belowAverage") {
634
+ var dArr = [];
635
+ for (var r = cellrange[s].row[0]; r <= cellrange[s].row[1]; r += 1) {
636
+ for (var c = cellrange[s].column[0]; c <= cellrange[s].column[1]; c += 1) {
637
+ if (_.isNil(d[r]) || _.isNil(d[r][c])) {
638
+ continue;
639
+ }
640
+ if (!_.isNil(d[r][c]) && !_.isNil(d[r][c].ct) && d[r][c].ct.t === "n") {
641
+ dArr.push(getCellValue(r, c, d));
642
+ }
643
+ }
644
+ }
645
+ if (conditionName === "top10" || conditionName === "top10_percent" || conditionName === "last10" || conditionName === "last10_percent") {
646
+ for (var j = 0; j < dArr.length; j += 1) {
647
+ for (var k = 0; k < dArr.length - 1 - j; k += 1) {
648
+ if (dArr[k] < dArr[k + 1]) {
649
+ var temp = dArr[k];
650
+ dArr[k] = dArr[k + 1];
651
+ dArr[k + 1] = temp;
652
+ }
653
+ }
654
+ }
655
+ var cArr = void 0;
656
+ if (conditionName === "top10") {
657
+ cArr = dArr.slice(0, conditionValue0);
658
+ } else if (conditionName === "top10_percent") {
659
+ cArr = dArr.slice(0, Math.floor(conditionValue0 * dArr.length / 100));
660
+ } else if (conditionName === "last10") {
661
+ cArr = dArr.slice(dArr.length - conditionValue0, dArr.length);
662
+ } else if (conditionName === "last10_percent") {
663
+ cArr = dArr.slice(dArr.length - Math.floor(conditionValue0 * dArr.length / 100), dArr.length);
664
+ }
665
+ for (var r = cellrange[s].row[0]; r <= cellrange[s].row[1]; r += 1) {
666
+ for (var c = cellrange[s].column[0]; c <= cellrange[s].column[1]; c += 1) {
667
+ if (_.isNil(d[r]) || _.isNil(d[r][c])) {
668
+ continue;
669
+ }
670
+ var cellVal = getCellValue(r, c, d);
671
+ if (!_.isNil(cArr) && cArr.indexOf(cellVal) !== -1) {
672
+ if ("".concat(r, "_").concat(c) in computeMap) {
673
+ computeMap["".concat(r, "_").concat(c)].textColor = textColor_1;
674
+ computeMap["".concat(r, "_").concat(c)].cellColor = cellColor_1;
675
+ } else {
676
+ computeMap["".concat(r, "_").concat(c)] = {
677
+ textColor: textColor_1,
678
+ cellColor: cellColor_1
679
+ };
680
+ }
681
+ }
682
+ }
683
+ }
684
+ } else if (conditionName === "aboveAverage" || conditionName === "belowAverage") {
685
+ var sum = 0;
686
+ for (var j = 0; j < dArr.length; j += 1) {
687
+ sum += dArr[j];
688
+ }
689
+ var averageNum = sum / dArr.length;
690
+ if (conditionName === "aboveAverage") {
691
+ for (var r = cellrange[s].row[0]; r <= cellrange[s].row[1]; r += 1) {
692
+ for (var c = cellrange[s].column[0]; c <= cellrange[s].column[1]; c += 1) {
693
+ if (_.isNil(d[r]) || _.isNil(d[r][c])) {
694
+ continue;
695
+ }
696
+ var cellVal = getCellValue(r, c, d);
697
+ if (cellVal > averageNum) {
698
+ if ("".concat(r, "_").concat(c) in computeMap) {
699
+ computeMap["".concat(r, "_").concat(c)].textColor = textColor_1;
700
+ computeMap["".concat(r, "_").concat(c)].cellColor = cellColor_1;
701
+ } else {
702
+ computeMap["".concat(r, "_").concat(c)] = {
703
+ textColor: textColor_1,
704
+ cellColor: cellColor_1
705
+ };
706
+ }
707
+ }
708
+ }
709
+ }
710
+ } else if (conditionName === "belowAverage") {
711
+ for (var r = cellrange[s].row[0]; r <= cellrange[s].row[1]; r += 1) {
712
+ for (var c = cellrange[s].column[0]; c <= cellrange[s].column[1]; c += 1) {
713
+ if (_.isNil(d[r]) || _.isNil(d[r][c])) {
714
+ continue;
715
+ }
716
+ var cellVal = getCellValue(r, c, d);
717
+ if (cellVal < averageNum) {
718
+ if ("".concat(r, "_").concat(c) in computeMap) {
719
+ computeMap["".concat(r, "_").concat(c)].textColor = textColor_1;
720
+ computeMap["".concat(r, "_").concat(c)].cellColor = cellColor_1;
721
+ } else {
722
+ computeMap["".concat(r, "_").concat(c)] = {
723
+ textColor: textColor_1,
724
+ cellColor: cellColor_1
725
+ };
726
+ }
727
+ }
728
+ }
729
+ }
730
+ }
731
+ }
732
+ } else if (conditionName === "formula") {
733
+ var str = cellrange[s].row[0];
734
+ var edr = cellrange[s].row[1];
735
+ var stc = cellrange[s].column[0];
736
+ var edc = cellrange[s].column[1];
737
+ var formulaTxt = conditionValue0;
738
+ if (conditionValue0.toString().slice(0, 1) !== "=") {
739
+ formulaTxt = "=".concat(conditionValue0);
740
+ }
741
+ for (var r = str; r <= edr; r += 1) {
742
+ for (var c = stc; c <= edc; c += 1) {
743
+ var func = formulaTxt;
744
+ var offsetRow = r - str;
745
+ var offsetCol = c - stc;
746
+ if (offsetRow > 0) {
747
+ func = "=".concat(functionCopy(ctx, func, "down", offsetRow));
748
+ }
749
+ if (offsetCol > 0) {
750
+ func = "=".concat(functionCopy(ctx, func, "right", offsetCol));
751
+ }
752
+ var funcV = execfunction(ctx, func, r, c);
753
+ var v = funcV[1];
754
+ if (typeof v !== "boolean") {
755
+ v = !!Number(v);
756
+ }
757
+ if (!v) {
758
+ continue;
759
+ }
760
+ if ("".concat(r, "_").concat(c) in computeMap) {
761
+ computeMap["".concat(r, "_").concat(c)].textColor = textColor_1;
762
+ computeMap["".concat(r, "_").concat(c)].cellColor = cellColor_1;
763
+ } else {
764
+ computeMap["".concat(r, "_").concat(c)] = {
765
+ textColor: textColor_1,
766
+ cellColor: cellColor_1
767
+ };
768
+ }
769
+ }
770
+ }
771
+ }
772
+ }
773
+ }
774
+ };
775
+ for (var i = 0; i < ruleArr.length; i += 1) {
776
+ _loop_1(i);
777
+ }
778
+ }
779
+ return computeMap;
780
+ }
781
+ export function getComputeMap(ctx) {
782
+ var index = getSheetIndex(ctx, ctx.currentSheetId);
783
+ var ruleArr = ctx.luckysheetfile[index].luckysheet_conditionformat_save;
784
+ var data = ctx.luckysheetfile[index].data;
785
+ if (_.isNil(data)) return null;
786
+ var computeMap = compute(ctx, ruleArr, data);
787
+ return computeMap;
788
+ }
789
+ export function checkCF(r, c, computeMap) {
790
+ if (!_.isNil(computeMap) && "".concat(r, "_").concat(c) in computeMap) {
791
+ return computeMap["".concat(r, "_").concat(c)];
792
+ }
793
+ return null;
794
+ }
795
+ export function updateItem(ctx, type) {
796
+ var _a, _b;
797
+ if (!checkProtectionFormatCells(ctx)) {
798
+ return;
799
+ }
800
+ var index = getSheetIndex(ctx, ctx.currentSheetId);
801
+ var ruleArr = [];
802
+ if (type === "delSheet") {
803
+ ruleArr = [];
804
+ } else {
805
+ var rule = {
806
+ type: type,
807
+ cellrange: (_a = ctx.luckysheet_select_save) !== null && _a !== void 0 ? _a : [],
808
+ format: {
809
+ textColor: ctx.conditionRules.textColor,
810
+ cellColor: ctx.conditionRules.cellColor
811
+ }
812
+ };
813
+ ruleArr = (_b = ctx.luckysheetfile[index].luckysheet_conditionformat_save) !== null && _b !== void 0 ? _b : [];
814
+ ruleArr.push(rule);
815
+ }
816
+ ctx.luckysheetfile[index].luckysheet_conditionformat_save = ruleArr;
817
+ }
818
+ export function CFSplitRange(range1, range2, range3, type) {
819
+ var range = [];
820
+ var offset_r = range3.row[0] - range2.row[0];
821
+ var offset_c = range3.column[0] - range2.column[0];
822
+ var r1 = range1.row[0];
823
+ var r2 = range1.row[1];
824
+ var c1 = range1.column[0];
825
+ var c2 = range1.column[1];
826
+ if (r1 >= range2.row[0] && r2 <= range2.row[1] && c1 >= range2.column[0] && c2 <= range2.column[1]) {
827
+ if (type === "allPart") {
828
+ range = [{
829
+ row: [r1 + offset_r, r2 + offset_r],
830
+ column: [c1 + offset_c, c2 + offset_c]
831
+ }];
832
+ } else if (type === "restPart") {
833
+ range = [];
834
+ } else if (type === "operatePart") {
835
+ range = [{
836
+ row: [r1 + offset_r, r2 + offset_r],
837
+ column: [c1 + offset_c, c2 + offset_c]
838
+ }];
839
+ }
840
+ } else if (r1 >= range2.row[0] && r1 <= range2.row[1] && c1 >= range2.column[0] && c2 <= range2.column[1]) {
841
+ if (type === "allPart") {
842
+ range = [{
843
+ row: [range2.row[1] + 1, r2],
844
+ column: [c1, c2]
845
+ }, {
846
+ row: [r1 + offset_r, range2.row[1] + offset_r],
847
+ column: [c1 + offset_c, c2 + offset_c]
848
+ }];
849
+ } else if (type === "restPart") {
850
+ range = [{
851
+ row: [range2.row[1] + 1, r2],
852
+ column: [c1, c2]
853
+ }];
854
+ } else if (type === "operatePart") {
855
+ range = [{
856
+ row: [r1 + offset_r, range2.row[1] + offset_r],
857
+ column: [c1 + offset_c, c2 + offset_c]
858
+ }];
859
+ }
860
+ } else if (r2 >= range2.row[0] && r2 <= range2.row[1] && c1 >= range2.column[0] && c2 <= range2.column[1]) {
861
+ if (type === "allPart") {
862
+ range = [{
863
+ row: [r1, range2.row[0] - 1],
864
+ column: [c1, c2]
865
+ }, {
866
+ row: [range2.row[0] + offset_r, r2 + offset_r],
867
+ column: [c1 + offset_c, c2 + offset_c]
868
+ }];
869
+ } else if (type === "restPart") {
870
+ range = [{
871
+ row: [r1, range2.row[0] - 1],
872
+ column: [c1, c2]
873
+ }];
874
+ } else if (type === "operatePart") {
875
+ range = [{
876
+ row: [range2.row[0] + offset_r, r2 + offset_r],
877
+ column: [c1 + offset_c, c2 + offset_c]
878
+ }];
879
+ }
880
+ } else if (r1 < range2.row[0] && r2 > range2.row[1] && c1 >= range2.column[0] && c2 <= range2.column[1]) {
881
+ if (type === "allPart") {
882
+ range = [{
883
+ row: [r1, range2.row[0] - 1],
884
+ column: [c1, c2]
885
+ }, {
886
+ row: [range2.row[1] + 1, r2],
887
+ column: [c1, c2]
888
+ }, {
889
+ row: [range2.row[0] + offset_r, range2.row[1] + offset_r],
890
+ column: [c1 + offset_c, c2 + offset_c]
891
+ }];
892
+ } else if (type === "restPart") {
893
+ range = [{
894
+ row: [r1, range2.row[0] - 1],
895
+ column: [c1, c2]
896
+ }, {
897
+ row: [range2.row[1] + 1, r2],
898
+ column: [c1, c2]
899
+ }];
900
+ } else if (type === "operatePart") {
901
+ range = [{
902
+ row: [range2.row[0] + offset_r, range2.row[1] + offset_r],
903
+ column: [c1 + offset_c, c2 + offset_c]
904
+ }];
905
+ }
906
+ } else if (c1 >= range2.column[0] && c1 <= range2.column[1] && r1 >= range2.row[0] && r2 <= range2.row[1]) {
907
+ if (type === "allPart") {
908
+ range = [{
909
+ row: [r1, r2],
910
+ column: [range2.column[1] + 1, c2]
911
+ }, {
912
+ row: [r1 + offset_r, r2 + offset_r],
913
+ column: [c1 + offset_c, range2.column[1] + offset_c]
914
+ }];
915
+ } else if (type === "restPart") {
916
+ range = [{
917
+ row: [r1, r2],
918
+ column: [range2.column[1] + 1, c2]
919
+ }];
920
+ } else if (type === "operatePart") {
921
+ range = [{
922
+ row: [r1 + offset_r, r2 + offset_r],
923
+ column: [c1 + offset_c, range2.column[1] + offset_c]
924
+ }];
925
+ }
926
+ } else if (c2 >= range2.column[0] && c2 <= range2.column[1] && r1 >= range2.row[0] && r2 <= range2.row[1]) {
927
+ if (type === "allPart") {
928
+ range = [{
929
+ row: [r1, r2],
930
+ column: [c1, range2.column[0] - 1]
931
+ }, {
932
+ row: [r1 + offset_r, r2 + offset_r],
933
+ column: [range2.column[0] + offset_c, c2 + offset_c]
934
+ }];
935
+ } else if (type === "restPart") {
936
+ range = [{
937
+ row: [r1, r2],
938
+ column: [c1, range2.column[0] - 1]
939
+ }];
940
+ } else if (type === "operatePart") {
941
+ range = [{
942
+ row: [r1 + offset_r, r2 + offset_r],
943
+ column: [range2.column[0] + offset_c, c2 + offset_c]
944
+ }];
945
+ }
946
+ } else if (c1 < range2.column[0] && c2 > range2.column[1] && r1 >= range2.row[0] && r2 <= range2.row[1]) {
947
+ if (type === "allPart") {
948
+ range = [{
949
+ row: [r1, r2],
950
+ column: [c1, range2.column[0] - 1]
951
+ }, {
952
+ row: [r1, r2],
953
+ column: [range2.column[1] + 1, c2]
954
+ }, {
955
+ row: [r1 + offset_r, r2 + offset_r],
956
+ column: [range2.column[0] + offset_c, range2.column[1] + offset_c]
957
+ }];
958
+ } else if (type === "restPart") {
959
+ range = [{
960
+ row: [r1, r2],
961
+ column: [c1, range2.column[0] - 1]
962
+ }, {
963
+ row: [r1, r2],
964
+ column: [range2.column[1] + 1, c2]
965
+ }];
966
+ } else if (type === "operatePart") {
967
+ range = [{
968
+ row: [r1 + offset_r, r2 + offset_r],
969
+ column: [range2.column[0] + offset_c, range2.column[1] + offset_c]
970
+ }];
971
+ }
972
+ } else if (r1 >= range2.row[0] && r1 <= range2.row[1] && c1 >= range2.column[0] && c1 <= range2.column[1]) {
973
+ if (type === "allPart") {
974
+ range = [{
975
+ row: [r1, range2.row[1]],
976
+ column: [range2.column[1] + 1, c2]
977
+ }, {
978
+ row: [range2.row[1] + 1, r2],
979
+ column: [c1, c2]
980
+ }, {
981
+ row: [r1 + offset_r, range2.row[1] + offset_r],
982
+ column: [c1 + offset_c, range2.column[1] + offset_c]
983
+ }];
984
+ } else if (type === "restPart") {
985
+ range = [{
986
+ row: [r1, range2.row[1]],
987
+ column: [range2.column[1] + 1, c2]
988
+ }, {
989
+ row: [range2.row[1] + 1, r2],
990
+ column: [c1, c2]
991
+ }];
992
+ } else if (type === "operatePart") {
993
+ range = [{
994
+ row: [r1 + offset_r, range2.row[1] + offset_r],
995
+ column: [c1 + offset_c, range2.column[1] + offset_c]
996
+ }];
997
+ }
998
+ } else if (r1 >= range2.row[0] && r1 <= range2.row[1] && c2 >= range2.column[0] && c2 <= range2.column[1]) {
999
+ if (type === "allPart") {
1000
+ range = [{
1001
+ row: [r1, range2.row[1]],
1002
+ column: [c1, range2.column[0] - 1]
1003
+ }, {
1004
+ row: [range2.row[1] + 1, r2],
1005
+ column: [c1, c2]
1006
+ }, {
1007
+ row: [r1 + offset_r, range2.row[1] + offset_r],
1008
+ column: [range2.column[0] + offset_c, c2 + offset_c]
1009
+ }];
1010
+ } else if (type === "restPart") {
1011
+ range = [{
1012
+ row: [r1, range2.row[1]],
1013
+ column: [c1, range2.column[0] - 1]
1014
+ }, {
1015
+ row: [range2.row[1] + 1, r2],
1016
+ column: [c1, c2]
1017
+ }];
1018
+ } else if (type === "operatePart") {
1019
+ range = [{
1020
+ row: [r1 + offset_r, range2.row[1] + offset_r],
1021
+ column: [range2.column[0] + offset_c, c2 + offset_c]
1022
+ }];
1023
+ }
1024
+ } else if (r2 >= range2.row[0] && r2 <= range2.row[1] && c1 >= range2.column[0] && c1 <= range2.column[1]) {
1025
+ if (type === "allPart") {
1026
+ range = [{
1027
+ row: [r1, range2.row[0] - 1],
1028
+ column: [c1, c2]
1029
+ }, {
1030
+ row: [range2.row[0], r2],
1031
+ column: [range2.column[1] + 1, c2]
1032
+ }, {
1033
+ row: [range2.row[0] + offset_r, r2 + offset_r],
1034
+ column: [c1 + offset_c, range2.column[1] + offset_c]
1035
+ }];
1036
+ } else if (type === "restPart") {
1037
+ range = [{
1038
+ row: [r1, range2.row[0] - 1],
1039
+ column: [c1, c2]
1040
+ }, {
1041
+ row: [range2.row[0], r2],
1042
+ column: [range2.column[1] + 1, c2]
1043
+ }];
1044
+ } else if (type === "operatePart") {
1045
+ range = [{
1046
+ row: [range2.row[0] + offset_r, r2 + offset_r],
1047
+ column: [c1 + offset_c, range2.column[1] + offset_c]
1048
+ }];
1049
+ }
1050
+ } else if (r2 >= range2.row[0] && r2 <= range2.row[1] && c2 >= range2.column[0] && c2 <= range2.column[1]) {
1051
+ if (type === "allPart") {
1052
+ range = [{
1053
+ row: [r1, range2.row[0] - 1],
1054
+ column: [c1, c2]
1055
+ }, {
1056
+ row: [range2.row[0], r2],
1057
+ column: [c1, range2.column[0] - 1]
1058
+ }, {
1059
+ row: [range2.row[0] + offset_r, r2 + offset_r],
1060
+ column: [range2.column[0] + offset_c, c2 + offset_c]
1061
+ }];
1062
+ } else if (type === "restPart") {
1063
+ range = [{
1064
+ row: [r1, range2.row[0] - 1],
1065
+ column: [c1, c2]
1066
+ }, {
1067
+ row: [range2.row[0], r2],
1068
+ column: [c1, range2.column[0] - 1]
1069
+ }];
1070
+ } else if (type === "operatePart") {
1071
+ range = [{
1072
+ row: [range2.row[0] + offset_r, r2 + offset_r],
1073
+ column: [range2.column[0] + offset_c, c2 + offset_c]
1074
+ }];
1075
+ }
1076
+ } else if (r1 < range2.row[0] && r2 > range2.row[1] && c1 >= range2.column[0] && c1 <= range2.column[1]) {
1077
+ if (type === "allPart") {
1078
+ range = [{
1079
+ row: [r1, range2.row[0] - 1],
1080
+ column: [c1, c2]
1081
+ }, {
1082
+ row: [range2.row[0], range2.row[1]],
1083
+ column: [range2.column[1] + 1, c2]
1084
+ }, {
1085
+ row: [range2.row[1] + 1, r2],
1086
+ column: [c1, c2]
1087
+ }, {
1088
+ row: [range2.row[0] + offset_r, range2.row[1] + offset_r],
1089
+ column: [c1 + offset_c, range2.column[1] + offset_c]
1090
+ }];
1091
+ } else if (type === "restPart") {
1092
+ range = [{
1093
+ row: [r1, range2.row[0] - 1],
1094
+ column: [c1, c2]
1095
+ }, {
1096
+ row: [range2.row[0], range2.row[1]],
1097
+ column: [range2.column[1] + 1, c2]
1098
+ }, {
1099
+ row: [range2.row[1] + 1, r2],
1100
+ column: [c1, c2]
1101
+ }];
1102
+ } else if (type === "operatePart") {
1103
+ range = [{
1104
+ row: [range2.row[0] + offset_r, range2.row[1] + offset_r],
1105
+ column: [c1 + offset_c, range2.column[1] + offset_c]
1106
+ }];
1107
+ }
1108
+ } else if (r1 < range2.row[0] && r2 > range2.row[1] && c2 >= range2.column[0] && c2 <= range2.column[1]) {
1109
+ if (type === "allPart") {
1110
+ range = [{
1111
+ row: [r1, range2.row[0] - 1],
1112
+ column: [c1, c2]
1113
+ }, {
1114
+ row: [range2.row[0], range2.row[1]],
1115
+ column: [c1, range2.column[0] - 1]
1116
+ }, {
1117
+ row: [range2.row[1] + 1, r2],
1118
+ column: [c1, c2]
1119
+ }, {
1120
+ row: [range2.row[0] + offset_r, range2.row[1] + offset_r],
1121
+ column: [range2.column[0] + offset_c, c2 + offset_c]
1122
+ }];
1123
+ } else if (type === "restPart") {
1124
+ range = [{
1125
+ row: [r1, range2.row[0] - 1],
1126
+ column: [c1, c2]
1127
+ }, {
1128
+ row: [range2.row[0], range2.row[1]],
1129
+ column: [c1, range2.column[0] - 1]
1130
+ }, {
1131
+ row: [range2.row[1] + 1, r2],
1132
+ column: [c1, c2]
1133
+ }];
1134
+ } else if (type === "operatePart") {
1135
+ range = [{
1136
+ row: [range2.row[0] + offset_r, range2.row[1] + offset_r],
1137
+ column: [range2.column[0] + offset_c, c2 + offset_c]
1138
+ }];
1139
+ }
1140
+ } else if (c1 < range2.column[0] && c2 > range2.column[1] && r1 >= range2.row[0] && r1 <= range2.row[1]) {
1141
+ if (type === "allPart") {
1142
+ range = [{
1143
+ row: [r1, range2.row[1]],
1144
+ column: [c1, range2.column[0] - 1]
1145
+ }, {
1146
+ row: [r1, range2.row[1]],
1147
+ column: [range2.column[1] + 1, c2]
1148
+ }, {
1149
+ row: [range2.row[1] + 1, r2],
1150
+ column: [c1, c2]
1151
+ }, {
1152
+ row: [r1 + offset_r, range2.row[1] + offset_r],
1153
+ column: [range2.column[0] + offset_c, range2.column[1] + offset_c]
1154
+ }];
1155
+ } else if (type === "restPart") {
1156
+ range = [{
1157
+ row: [r1, range2.row[1]],
1158
+ column: [c1, range2.column[0] - 1]
1159
+ }, {
1160
+ row: [r1, range2.row[1]],
1161
+ column: [range2.column[1] + 1, c2]
1162
+ }, {
1163
+ row: [range2.row[1] + 1, r2],
1164
+ column: [c1, c2]
1165
+ }];
1166
+ } else if (type === "operatePart") {
1167
+ range = [{
1168
+ row: [r1 + offset_r, range2.row[1] + offset_r],
1169
+ column: [range2.column[0] + offset_c, range2.column[1] + offset_c]
1170
+ }];
1171
+ }
1172
+ } else if (c1 < range2.column[0] && c2 > range2.column[1] && r2 >= range2.row[0] && r2 <= range2.row[1]) {
1173
+ if (type === "allPart") {
1174
+ range = [{
1175
+ row: [r1, range2.row[0] - 1],
1176
+ column: [c1, c2]
1177
+ }, {
1178
+ row: [range2.row[0], r2],
1179
+ column: [c1, range2.column[0] - 1]
1180
+ }, {
1181
+ row: [range2.row[0], r2],
1182
+ column: [range2.column[1] + 1, c2]
1183
+ }, {
1184
+ row: [range2.row[0] + offset_r, r2 + offset_r],
1185
+ column: [range2.column[0] + offset_c, range2.column[1] + offset_c]
1186
+ }];
1187
+ } else if (type === "restPart") {
1188
+ range = [{
1189
+ row: [r1, range2.row[0] - 1],
1190
+ column: [c1, c2]
1191
+ }, {
1192
+ row: [range2.row[0], r2],
1193
+ column: [c1, range2.column[0] - 1]
1194
+ }, {
1195
+ row: [range2.row[0], r2],
1196
+ column: [range2.column[1] + 1, c2]
1197
+ }];
1198
+ } else if (type === "operatePart") {
1199
+ range = [{
1200
+ row: [range2.row[0] + offset_r, r2 + offset_r],
1201
+ column: [range2.column[0] + offset_c, range2.column[1] + offset_c]
1202
+ }];
1203
+ }
1204
+ } else if (r1 < range2.row[0] && r2 > range2.row[1] && c1 < range2.column[0] && c2 > range2.column[1]) {
1205
+ if (type === "allPart") {
1206
+ range = [{
1207
+ row: [r1, range2.row[0] - 1],
1208
+ column: [c1, c2]
1209
+ }, {
1210
+ row: [range2.row[0], range2.row[1]],
1211
+ column: [c1, range2.column[0] - 1]
1212
+ }, {
1213
+ row: [range2.row[0], range2.row[1]],
1214
+ column: [range2.column[1] + 1, c2]
1215
+ }, {
1216
+ row: [range2.row[1] + 1, r2],
1217
+ column: [c1, c2]
1218
+ }, {
1219
+ row: [range2.row[0] + offset_r, range2.row[1] + offset_r],
1220
+ column: [range2.column[0] + offset_c, range2.column[1] + offset_c]
1221
+ }];
1222
+ } else if (type === "restPart") {
1223
+ range = [{
1224
+ row: [r1, range2.row[0] - 1],
1225
+ column: [c1, c2]
1226
+ }, {
1227
+ row: [range2.row[0], range2.row[1]],
1228
+ column: [c1, range2.column[0] - 1]
1229
+ }, {
1230
+ row: [range2.row[0], range2.row[1]],
1231
+ column: [range2.column[1] + 1, c2]
1232
+ }, {
1233
+ row: [range2.row[1] + 1, r2],
1234
+ column: [c1, c2]
1235
+ }];
1236
+ } else if (type === "operatePart") {
1237
+ range = [{
1238
+ row: [range2.row[0] + offset_r, range2.row[1] + offset_r],
1239
+ column: [range2.column[0] + offset_c, range2.column[1] + offset_c]
1240
+ }];
1241
+ }
1242
+ } else {
1243
+ if (type === "allPart") {
1244
+ range = [{
1245
+ row: [r1, r2],
1246
+ column: [c1, c2]
1247
+ }];
1248
+ } else if (type === "restPart") {
1249
+ range = [{
1250
+ row: [r1, r2],
1251
+ column: [c1, c2]
1252
+ }];
1253
+ } else if (type === "operatePart") {
1254
+ range = [];
1255
+ }
1256
+ }
1257
+ return range;
1258
+ }