@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,1273 +0,0 @@
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
- }