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