@fileverse-dev/fortune-core 1.0.26 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (346) hide show
  1. package/dist/index.esm.js +80254 -0
  2. package/dist/index.js +80600 -0
  3. package/{es → dist/packages/core/src}/api/cell.d.ts +10 -10
  4. package/{lib → dist/packages/core/src}/api/common.d.ts +66 -71
  5. package/{es → dist/packages/core/src}/api/errors.d.ts +2 -2
  6. package/{es → dist/packages/core/src}/api/index.d.ts +9 -9
  7. package/{es → dist/packages/core/src}/api/merge.d.ts +5 -5
  8. package/{lib → dist/packages/core/src}/api/range.d.ts +22 -22
  9. package/{lib → dist/packages/core/src}/api/rowcol.d.ts +14 -14
  10. package/{lib → dist/packages/core/src}/api/sheet.d.ts +10 -10
  11. package/{lib → dist/packages/core/src}/api/workbook.d.ts +15 -15
  12. package/{lib → dist/packages/core/src}/canvas.d.ts +46 -46
  13. package/{es → dist/packages/core/src}/context.d.ts +197 -198
  14. package/{es → dist/packages/core/src}/events/copy.d.ts +2 -2
  15. package/{lib → dist/packages/core/src}/events/index.d.ts +4 -4
  16. package/{lib → dist/packages/core/src}/events/keyboard.d.ts +6 -6
  17. package/{es → dist/packages/core/src}/events/mouse.d.ts +22 -22
  18. package/{es → dist/packages/core/src}/events/paste.d.ts +3 -3
  19. package/{lib → dist/packages/core/src}/index.d.ts +10 -10
  20. package/{lib → dist/packages/core/src}/locale/en.d.ts +992 -992
  21. package/{lib → dist/packages/core/src}/locale/es.d.ts +1134 -1134
  22. package/{lib → dist/packages/core/src}/locale/hi.d.ts +1030 -1030
  23. package/{lib → dist/packages/core/src}/locale/index.d.ts +1049 -1049
  24. package/{es → dist/packages/core/src}/locale/zh.d.ts +1048 -1048
  25. package/{lib → dist/packages/core/src}/locale/zh_tw.d.ts +1187 -1187
  26. package/{lib → dist/packages/core/src}/modules/ConditionFormat.d.ts +17 -17
  27. package/{lib → dist/packages/core/src}/modules/border.d.ts +3 -3
  28. package/{lib → dist/packages/core/src}/modules/cell.d.ts +32 -32
  29. package/{es → dist/packages/core/src}/modules/clipboard.d.ts +3 -3
  30. package/{es → dist/packages/core/src}/modules/color.d.ts +1 -1
  31. package/{lib → dist/packages/core/src}/modules/comment.d.ts +97 -97
  32. package/{es → dist/packages/core/src}/modules/conditionalFormat.d.ts +2 -2
  33. package/{es → dist/packages/core/src}/modules/cursor.d.ts +3 -3
  34. package/{es → dist/packages/core/src}/modules/dataVerification.d.ts +11 -11
  35. package/{es → dist/packages/core/src}/modules/dropCell.d.ts +10 -10
  36. package/{lib → dist/packages/core/src}/modules/filter.d.ts +45 -45
  37. package/{es → dist/packages/core/src}/modules/format.d.ts +6 -6
  38. package/{lib → dist/packages/core/src}/modules/formula.d.ts +54 -54
  39. package/{es → dist/packages/core/src}/modules/freeze.d.ts +5 -5
  40. package/{es → dist/packages/core/src}/modules/hyperlink.d.ts +21 -21
  41. package/{lib → dist/packages/core/src}/modules/iframe.d.ts +12 -12
  42. package/{es → dist/packages/core/src}/modules/image.d.ts +31 -31
  43. package/{es → dist/packages/core/src}/modules/index.d.ts +36 -36
  44. package/{lib → dist/packages/core/src}/modules/inline-string.d.ts +36 -36
  45. package/{es → dist/packages/core/src}/modules/location.d.ts +6 -6
  46. package/{es → dist/packages/core/src}/modules/locationCondition.d.ts +21 -21
  47. package/{es → dist/packages/core/src}/modules/merge.d.ts +3 -3
  48. package/{es → dist/packages/core/src}/modules/mobile.d.ts +5 -5
  49. package/{lib → dist/packages/core/src}/modules/moveCells.d.ts +5 -5
  50. package/{lib → dist/packages/core/src}/modules/protection.d.ts +5 -5
  51. package/{lib → dist/packages/core/src}/modules/refresh.d.ts +3 -3
  52. package/{es → dist/packages/core/src}/modules/rowcol.d.ts +19 -19
  53. package/{lib → dist/packages/core/src}/modules/screenshot.d.ts +2 -2
  54. package/{es → dist/packages/core/src}/modules/searchReplace.d.ts +36 -36
  55. package/{lib → dist/packages/core/src}/modules/selection.d.ts +46 -46
  56. package/{es → dist/packages/core/src}/modules/sheet.d.ts +10 -10
  57. package/{es → dist/packages/core/src}/modules/sort.d.ts +7 -7
  58. package/{es → dist/packages/core/src}/modules/splitColumn.d.ts +5 -5
  59. package/{es → dist/packages/core/src}/modules/text.d.ts +10 -10
  60. package/{lib → dist/packages/core/src}/modules/toolbar.d.ts +32 -32
  61. package/{es → dist/packages/core/src}/modules/validation.d.ts +19 -19
  62. package/{es → dist/packages/core/src}/modules/zoom.d.ts +3 -3
  63. package/{es → dist/packages/core/src}/settings.d.ts +100 -100
  64. package/{es → dist/packages/core/src}/types.d.ts +371 -376
  65. package/{es → dist/packages/core/src}/utils/freeze.d.ts +7 -7
  66. package/{es → dist/packages/core/src}/utils/index.d.ts +18 -19
  67. package/{lib → dist/packages/core/src}/utils/patch.d.ts +37 -37
  68. package/dist/packages/react/src/components/ChangeColor/index.d.ts +7 -0
  69. package/dist/packages/react/src/components/ConditionFormat/ConditionRules.d.ts +6 -0
  70. package/dist/packages/react/src/components/ConditionFormat/index.d.ts +7 -0
  71. package/dist/packages/react/src/components/ContextMenu/Divider.d.ts +3 -0
  72. package/dist/packages/react/src/components/ContextMenu/FilterMenu.d.ts +3 -0
  73. package/dist/packages/react/src/components/ContextMenu/Menu.d.ts +8 -0
  74. package/dist/packages/react/src/components/ContextMenu/SheetTab.d.ts +4 -0
  75. package/dist/packages/react/src/components/ContextMenu/index.d.ts +5 -0
  76. package/dist/packages/react/src/components/CustomSort/index.d.ts +4 -0
  77. package/dist/packages/react/src/components/DataVerification/DropdownList.d.ts +4 -0
  78. package/dist/packages/react/src/components/DataVerification/RangeDialog.d.ts +4 -0
  79. package/dist/packages/react/src/components/DataVerification/getDisplayedRangeTxt.d.ts +2 -0
  80. package/dist/packages/react/src/components/DataVerification/index.d.ts +4 -0
  81. package/dist/packages/react/src/components/Dialog/index.d.ts +15 -0
  82. package/dist/packages/react/src/components/DuneChartsInputModal/DuneChartsInputModal.d.ts +11 -0
  83. package/dist/packages/react/src/components/DunePreview/DunePreview.d.ts +13 -0
  84. package/dist/packages/react/src/components/FilterOption/index.d.ts +5 -0
  85. package/dist/packages/react/src/components/FormatSearch/index.d.ts +6 -0
  86. package/dist/packages/react/src/components/FormulaSearch/index.d.ts +5 -0
  87. package/dist/packages/react/src/components/FxEditor/NameBox.d.ts +3 -0
  88. package/dist/packages/react/src/components/FxEditor/index.d.ts +4 -0
  89. package/dist/packages/react/src/components/IFrameBoxs/iFrameBoxs.d.ts +4 -0
  90. package/dist/packages/react/src/components/ImgBoxs/index.d.ts +3 -0
  91. package/dist/packages/react/src/components/LinkEidtCard/index.d.ts +5 -0
  92. package/dist/packages/react/src/components/LocationCondition/index.d.ts +3 -0
  93. package/dist/packages/react/src/components/MessageBox/index.d.ts +9 -0
  94. package/dist/packages/react/src/components/NotationBoxes/index.d.ts +3 -0
  95. package/dist/packages/react/src/components/ResetColumnWidth/index.d.ts +2 -0
  96. package/dist/packages/react/src/components/SVGDefines.d.ts +5 -0
  97. package/dist/packages/react/src/components/SVGIcon.d.ts +9 -0
  98. package/dist/packages/react/src/components/SearchReplace/index.d.ts +6 -0
  99. package/dist/packages/react/src/components/Sheet/index.d.ts +8 -0
  100. package/dist/packages/react/src/components/SheetList/SheetHiddenButton.d.ts +8 -0
  101. package/dist/packages/react/src/components/SheetList/SheetListItem.d.ts +9 -0
  102. package/dist/packages/react/src/components/SheetList/index.d.ts +4 -0
  103. package/dist/packages/react/src/components/SheetOverlay/ColumnHeader.d.ts +3 -0
  104. package/dist/packages/react/src/components/SheetOverlay/ContentEditable.d.ts +11 -0
  105. package/dist/packages/react/src/components/SheetOverlay/FormulaHint/index.d.ts +4 -0
  106. package/dist/packages/react/src/components/SheetOverlay/FormulaSearch/constant.d.ts +63 -0
  107. package/dist/packages/react/src/components/SheetOverlay/FormulaSearch/index.d.ts +4 -0
  108. package/dist/packages/react/src/components/SheetOverlay/InputBox.d.ts +3 -0
  109. package/dist/packages/react/src/components/SheetOverlay/RowHeader.d.ts +3 -0
  110. package/dist/packages/react/src/components/SheetOverlay/ScrollBar/index.d.ts +7 -0
  111. package/dist/packages/react/src/components/SheetOverlay/index.d.ts +4 -0
  112. package/dist/packages/react/src/components/SheetTab/SheetItem.d.ts +8 -0
  113. package/dist/packages/react/src/components/SheetTab/index.d.ts +4 -0
  114. package/dist/packages/react/src/components/SplitColumn/index.d.ts +3 -0
  115. package/dist/packages/react/src/components/Toolbar/Button.d.ts +12 -0
  116. package/dist/packages/react/src/components/Toolbar/ColorPicker.d.ts +6 -0
  117. package/dist/packages/react/src/components/Toolbar/Combo.d.ts +12 -0
  118. package/dist/packages/react/src/components/Toolbar/CustomBorder.d.ts +7 -0
  119. package/dist/packages/react/src/components/Toolbar/CustomButton.d.ts +11 -0
  120. package/dist/packages/react/src/components/Toolbar/CustomColor.d.ts +8 -0
  121. package/dist/packages/react/src/components/Toolbar/CustomIcon.d.ts +9 -0
  122. package/dist/packages/react/src/components/Toolbar/Divider.d.ts +4 -0
  123. package/dist/packages/react/src/components/Toolbar/MoreItemsContainer.d.ts +6 -0
  124. package/dist/packages/react/src/components/Toolbar/Select.d.ts +14 -0
  125. package/dist/packages/react/src/components/Toolbar/index.d.ts +10 -0
  126. package/dist/packages/react/src/components/Workbook/api.d.ts +1177 -0
  127. package/dist/packages/react/src/components/Workbook/index.d.ts +1185 -0
  128. package/dist/packages/react/src/components/ZoomControl/index.d.ts +4 -0
  129. package/dist/packages/react/src/components/index.d.ts +4 -0
  130. package/dist/packages/react/src/constants.d.ts +1 -0
  131. package/dist/packages/react/src/context/index.d.ts +25 -0
  132. package/dist/packages/react/src/context/modal.d.ts +10 -0
  133. package/dist/packages/react/src/hooks/useAlert.d.ts +4 -0
  134. package/dist/packages/react/src/hooks/useDialog.d.ts +5 -0
  135. package/dist/packages/react/src/hooks/useOutsideClick.d.ts +2 -0
  136. package/dist/packages/react/src/hooks/usePrevious.d.ts +2 -0
  137. package/dist/packages/react/src/index.d.ts +1 -0
  138. package/dist/packages/react/src/utils/datepickerStyles.d.ts +2 -0
  139. package/dist/stories/API.stories.d.ts +1210 -0
  140. package/dist/stories/Collabration.stories.d.ts +2359 -0
  141. package/dist/stories/Features.stories.d.ts +9430 -0
  142. package/dist/stories/data/cell.d.ts +983 -0
  143. package/dist/stories/data/dataVerification.d.ts +131 -0
  144. package/dist/stories/data/empty.d.ts +10 -0
  145. package/dist/stories/data/formula.d.ts +362 -0
  146. package/dist/stories/data/freeze.d.ts +34 -0
  147. package/dist/stories/data/protected.d.ts +40 -0
  148. package/dist/stories/utils.d.ts +1 -0
  149. package/package.json +6 -7
  150. package/es/api/cell.js +0 -204
  151. package/es/api/common.d.ts +0 -71
  152. package/es/api/common.js +0 -79
  153. package/es/api/errors.js +0 -2
  154. package/es/api/index.js +0 -8
  155. package/es/api/merge.js +0 -15
  156. package/es/api/range.d.ts +0 -22
  157. package/es/api/range.js +0 -123
  158. package/es/api/rowcol.d.ts +0 -14
  159. package/es/api/rowcol.js +0 -207
  160. package/es/api/sheet.d.ts +0 -10
  161. package/es/api/sheet.js +0 -128
  162. package/es/api/workbook.d.ts +0 -15
  163. package/es/api/workbook.js +0 -85
  164. package/es/canvas.d.ts +0 -46
  165. package/es/canvas.js +0 -1350
  166. package/es/context.js +0 -381
  167. package/es/events/copy.js +0 -78
  168. package/es/events/index.d.ts +0 -4
  169. package/es/events/index.js +0 -4
  170. package/es/events/keyboard.d.ts +0 -6
  171. package/es/events/keyboard.js +0 -332
  172. package/es/events/mouse.js +0 -1725
  173. package/es/events/paste.js +0 -1378
  174. package/es/index.d.ts +0 -10
  175. package/es/index.js +0 -10
  176. package/es/locale/en.d.ts +0 -992
  177. package/es/locale/en.js +0 -10564
  178. package/es/locale/es.d.ts +0 -1134
  179. package/es/locale/es.js +0 -10010
  180. package/es/locale/hi.d.ts +0 -1030
  181. package/es/locale/hi.js +0 -10550
  182. package/es/locale/index.d.ts +0 -1049
  183. package/es/locale/index.js +0 -23
  184. package/es/locale/zh.js +0 -10568
  185. package/es/locale/zh_tw.d.ts +0 -1187
  186. package/es/locale/zh_tw.js +0 -10072
  187. package/es/modules/ConditionFormat.d.ts +0 -17
  188. package/es/modules/ConditionFormat.js +0 -1258
  189. package/es/modules/border.d.ts +0 -3
  190. package/es/modules/border.js +0 -1240
  191. package/es/modules/cell.d.ts +0 -32
  192. package/es/modules/cell.js +0 -1055
  193. package/es/modules/clipboard.js +0 -36
  194. package/es/modules/color.js +0 -1
  195. package/es/modules/comment.d.ts +0 -97
  196. package/es/modules/comment.js +0 -597
  197. package/es/modules/conditionalFormat.js +0 -441
  198. package/es/modules/cursor.js +0 -62
  199. package/es/modules/dataVerification.js +0 -701
  200. package/es/modules/dropCell.js +0 -2267
  201. package/es/modules/filter.d.ts +0 -45
  202. package/es/modules/filter.js +0 -434
  203. package/es/modules/format.js +0 -323
  204. package/es/modules/formula.d.ts +0 -54
  205. package/es/modules/formula.js +0 -2301
  206. package/es/modules/freeze.js +0 -148
  207. package/es/modules/hyperlink.js +0 -216
  208. package/es/modules/iframe.d.ts +0 -12
  209. package/es/modules/iframe.js +0 -220
  210. package/es/modules/image.js +0 -253
  211. package/es/modules/index.js +0 -36
  212. package/es/modules/inline-string.d.ts +0 -36
  213. package/es/modules/inline-string.js +0 -437
  214. package/es/modules/location.js +0 -46
  215. package/es/modules/locationCondition.js +0 -218
  216. package/es/modules/merge.js +0 -216
  217. package/es/modules/mobile.js +0 -33
  218. package/es/modules/moveCells.d.ts +0 -5
  219. package/es/modules/moveCells.js +0 -348
  220. package/es/modules/protection.d.ts +0 -5
  221. package/es/modules/protection.js +0 -96
  222. package/es/modules/refresh.d.ts +0 -3
  223. package/es/modules/refresh.js +0 -34
  224. package/es/modules/rowcol.js +0 -1922
  225. package/es/modules/screenshot.d.ts +0 -2
  226. package/es/modules/screenshot.js +0 -90
  227. package/es/modules/searchReplace.js +0 -388
  228. package/es/modules/selection.d.ts +0 -46
  229. package/es/modules/selection.js +0 -1674
  230. package/es/modules/sheet.js +0 -237
  231. package/es/modules/sort.js +0 -134
  232. package/es/modules/splitColumn.js +0 -126
  233. package/es/modules/ssf.js +0 -1533
  234. package/es/modules/text.js +0 -1207
  235. package/es/modules/toolbar.d.ts +0 -32
  236. package/es/modules/toolbar.js +0 -970
  237. package/es/modules/validation.js +0 -190
  238. package/es/modules/zoom.js +0 -29
  239. package/es/settings.js +0 -36
  240. package/es/types.js +0 -1
  241. package/es/utils/freeze.js +0 -86
  242. package/es/utils/index.js +0 -198
  243. package/es/utils/patch.d.ts +0 -37
  244. package/es/utils/patch.js +0 -381
  245. package/lib/api/cell.d.ts +0 -10
  246. package/lib/api/cell.js +0 -215
  247. package/lib/api/common.js +0 -88
  248. package/lib/api/errors.d.ts +0 -2
  249. package/lib/api/errors.js +0 -8
  250. package/lib/api/index.d.ts +0 -9
  251. package/lib/api/index.js +0 -101
  252. package/lib/api/merge.d.ts +0 -5
  253. package/lib/api/merge.js +0 -22
  254. package/lib/api/range.js +0 -138
  255. package/lib/api/rowcol.js +0 -222
  256. package/lib/api/sheet.js +0 -145
  257. package/lib/api/workbook.js +0 -98
  258. package/lib/canvas.js +0 -1356
  259. package/lib/context.d.ts +0 -198
  260. package/lib/context.js +0 -393
  261. package/lib/events/copy.d.ts +0 -2
  262. package/lib/events/copy.js +0 -85
  263. package/lib/events/index.js +0 -49
  264. package/lib/events/keyboard.js +0 -342
  265. package/lib/events/mouse.d.ts +0 -22
  266. package/lib/events/mouse.js +0 -1744
  267. package/lib/events/paste.d.ts +0 -3
  268. package/lib/events/paste.js +0 -1386
  269. package/lib/index.js +0 -109
  270. package/lib/locale/en.js +0 -10570
  271. package/lib/locale/es.js +0 -10016
  272. package/lib/locale/hi.js +0 -10556
  273. package/lib/locale/index.js +0 -29
  274. package/lib/locale/zh.d.ts +0 -1048
  275. package/lib/locale/zh.js +0 -10574
  276. package/lib/locale/zh_tw.js +0 -10078
  277. package/lib/modules/ConditionFormat.js +0 -1273
  278. package/lib/modules/border.js +0 -1248
  279. package/lib/modules/cell.js +0 -1085
  280. package/lib/modules/clipboard.d.ts +0 -3
  281. package/lib/modules/clipboard.js +0 -42
  282. package/lib/modules/color.d.ts +0 -1
  283. package/lib/modules/color.js +0 -7
  284. package/lib/modules/comment.js +0 -625
  285. package/lib/modules/conditionalFormat.d.ts +0 -2
  286. package/lib/modules/conditionalFormat.js +0 -447
  287. package/lib/modules/cursor.d.ts +0 -3
  288. package/lib/modules/cursor.js +0 -70
  289. package/lib/modules/dataVerification.d.ts +0 -11
  290. package/lib/modules/dataVerification.js +0 -716
  291. package/lib/modules/dropCell.d.ts +0 -10
  292. package/lib/modules/dropCell.js +0 -2283
  293. package/lib/modules/filter.js +0 -448
  294. package/lib/modules/format.d.ts +0 -6
  295. package/lib/modules/format.js +0 -334
  296. package/lib/modules/formula.js +0 -2330
  297. package/lib/modules/freeze.d.ts +0 -5
  298. package/lib/modules/freeze.js +0 -158
  299. package/lib/modules/hyperlink.d.ts +0 -21
  300. package/lib/modules/hyperlink.js +0 -232
  301. package/lib/modules/iframe.js +0 -236
  302. package/lib/modules/image.d.ts +0 -31
  303. package/lib/modules/image.js +0 -272
  304. package/lib/modules/index.d.ts +0 -36
  305. package/lib/modules/index.js +0 -401
  306. package/lib/modules/inline-string.js +0 -452
  307. package/lib/modules/location.d.ts +0 -6
  308. package/lib/modules/location.js +0 -57
  309. package/lib/modules/locationCondition.d.ts +0 -21
  310. package/lib/modules/locationCondition.js +0 -229
  311. package/lib/modules/merge.d.ts +0 -3
  312. package/lib/modules/merge.js +0 -223
  313. package/lib/modules/mobile.d.ts +0 -5
  314. package/lib/modules/mobile.js +0 -41
  315. package/lib/modules/moveCells.js +0 -357
  316. package/lib/modules/protection.js +0 -106
  317. package/lib/modules/refresh.js +0 -40
  318. package/lib/modules/rowcol.d.ts +0 -19
  319. package/lib/modules/rowcol.js +0 -1935
  320. package/lib/modules/screenshot.js +0 -96
  321. package/lib/modules/searchReplace.d.ts +0 -36
  322. package/lib/modules/searchReplace.js +0 -402
  323. package/lib/modules/selection.js +0 -1703
  324. package/lib/modules/sheet.d.ts +0 -10
  325. package/lib/modules/sheet.js +0 -250
  326. package/lib/modules/sort.d.ts +0 -7
  327. package/lib/modules/sort.js +0 -143
  328. package/lib/modules/splitColumn.d.ts +0 -5
  329. package/lib/modules/splitColumn.js +0 -136
  330. package/lib/modules/ssf.js +0 -1539
  331. package/lib/modules/text.d.ts +0 -10
  332. package/lib/modules/text.js +0 -1221
  333. package/lib/modules/toolbar.js +0 -1003
  334. package/lib/modules/validation.d.ts +0 -19
  335. package/lib/modules/validation.js +0 -205
  336. package/lib/modules/zoom.d.ts +0 -3
  337. package/lib/modules/zoom.js +0 -36
  338. package/lib/settings.d.ts +0 -100
  339. package/lib/settings.js +0 -42
  340. package/lib/types.d.ts +0 -376
  341. package/lib/types.js +0 -5
  342. package/lib/utils/freeze.d.ts +0 -7
  343. package/lib/utils/freeze.js +0 -92
  344. package/lib/utils/index.d.ts +0 -19
  345. package/lib/utils/index.js +0 -258
  346. package/lib/utils/patch.js +0 -392
@@ -1,1258 +0,0 @@
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
- }