@zohodesk/components 1.0.0-alpha-271 → 1.0.0-alpha-272

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 (352) hide show
  1. package/README.md +4 -0
  2. package/es/Accordion/Accordion.js +7 -3
  3. package/es/Accordion/AccordionItem.js +4 -2
  4. package/es/Animation/Animation.js +3 -3
  5. package/es/AppContainer/AppContainer.js +13 -5
  6. package/es/Avatar/Avatar.js +23 -11
  7. package/es/AvatarTeam/AvatarTeam.js +3 -3
  8. package/es/Button/Button.js +4 -3
  9. package/es/Buttongroup/Buttongroup.js +3 -3
  10. package/es/Card/Card.js +21 -10
  11. package/es/CheckBox/CheckBox.js +5 -3
  12. package/es/DateTime/CalendarView.js +32 -20
  13. package/es/DateTime/DateTime.js +75 -10
  14. package/es/DateTime/DateTimePopupFooter.js +4 -2
  15. package/es/DateTime/DateTimePopupHeader.js +8 -2
  16. package/es/DateTime/DateWidget.js +98 -35
  17. package/es/DateTime/DaysRow.js +4 -2
  18. package/es/DateTime/Time.js +10 -2
  19. package/es/DateTime/YearView.js +28 -4
  20. package/es/DateTime/__tests__/CalendarView.spec.js +1 -0
  21. package/es/DateTime/__tests__/DateTime.spec.js +1 -0
  22. package/es/DateTime/__tests__/DateWidget.spec.js +2 -3
  23. package/es/DateTime/common.js +3 -0
  24. package/es/DateTime/constants.js +1 -0
  25. package/es/DateTime/dateFormatUtils/dateFormat.js +63 -30
  26. package/es/DateTime/dateFormatUtils/dateFormats.js +0 -1
  27. package/es/DateTime/dateFormatUtils/dayChange.js +13 -4
  28. package/es/DateTime/dateFormatUtils/index.js +32 -2
  29. package/es/DateTime/dateFormatUtils/monthChange.js +8 -0
  30. package/es/DateTime/dateFormatUtils/timeChange.js +22 -6
  31. package/es/DateTime/dateFormatUtils/yearChange.js +11 -2
  32. package/es/DateTime/objectUtils.js +14 -20
  33. package/es/DateTime/props/defaultProps.js +2 -1
  34. package/es/DateTime/typeChecker.js +3 -0
  35. package/es/DateTime/validator.js +58 -6
  36. package/es/DropBox/DropBox.js +6 -2
  37. package/es/DropBox/DropBoxElement/DropBoxElement.js +7 -0
  38. package/es/DropBox/DropBoxElement/css/cssJSLogic.js +5 -3
  39. package/es/DropBox/DropBoxElement/useDropboxPosCalc.js +3 -0
  40. package/es/DropBox/props/defaultProps.js +1 -2
  41. package/es/DropBox/props/propTypes.js +1 -2
  42. package/es/DropDown/DropDown.js +8 -4
  43. package/es/DropDown/DropDownHeading.js +4 -5
  44. package/es/DropDown/DropDownItem.js +6 -0
  45. package/es/DropDown/DropDownSearch.js +4 -0
  46. package/es/DropDown/DropDownSeparator.js +1 -0
  47. package/es/DropDown/__tests__/DropDown.spec.js +1 -2
  48. package/es/Heading/Heading.js +2 -3
  49. package/es/Label/Label.js +2 -3
  50. package/es/Layout/Box.js +13 -0
  51. package/es/Layout/Container.js +12 -1
  52. package/es/Layout/index.js +1 -2
  53. package/es/ListItem/ListContainer.js +8 -3
  54. package/es/ListItem/ListItem.js +9 -3
  55. package/es/ListItem/ListItemWithAvatar.js +9 -3
  56. package/es/ListItem/ListItemWithCheckBox.js +7 -2
  57. package/es/ListItem/ListItemWithIcon.js +8 -3
  58. package/es/ListItem/ListItemWithRadio.js +7 -3
  59. package/es/Modal/Modal.js +28 -11
  60. package/es/MultiSelect/AdvancedGroupMultiSelect.js +89 -13
  61. package/es/MultiSelect/AdvancedMultiSelect.js +32 -9
  62. package/es/MultiSelect/EmptyState.js +2 -0
  63. package/es/MultiSelect/MultiSelect.js +99 -32
  64. package/es/MultiSelect/MultiSelectHeader.js +3 -0
  65. package/es/MultiSelect/MultiSelectWithAvatar.js +12 -6
  66. package/es/MultiSelect/SelectedOptions.js +6 -3
  67. package/es/MultiSelect/Suggestions.js +7 -3
  68. package/es/MultiSelect/__tests__/MultiSelect.spec.js +4 -6
  69. package/es/MultiSelect/props/propTypes.js +2 -0
  70. package/es/PopOver/PopOver.js +18 -2
  71. package/es/PopOver/__tests__/PopOver.spec.js +2 -1
  72. package/es/Popup/Popup.js +77 -24
  73. package/es/Popup/__tests__/Popup.spec.js +17 -5
  74. package/es/Popup/viewPort.js +16 -4
  75. package/es/Provider/IdProvider.js +10 -5
  76. package/es/Provider/LibraryContext.js +6 -4
  77. package/es/Provider/NumberGenerator/NumberGenerator.js +21 -7
  78. package/es/Provider/ZindexProvider.js +9 -2
  79. package/es/Radio/Radio.js +4 -2
  80. package/es/Responsive/CustomResponsive.js +30 -18
  81. package/es/Responsive/RefWrapper.js +6 -7
  82. package/es/Responsive/ResizeComponent.js +35 -25
  83. package/es/Responsive/ResizeObserver.js +26 -6
  84. package/es/Responsive/Responsive.js +34 -20
  85. package/es/Responsive/index.js +1 -3
  86. package/es/Responsive/sizeObservers.js +28 -7
  87. package/es/Responsive/utils/index.js +7 -5
  88. package/es/Responsive/utils/shallowCompare.js +7 -2
  89. package/es/Responsive/windowResizeObserver.js +7 -0
  90. package/es/ResponsiveDropBox/ResponsiveDropBox.js +4 -0
  91. package/es/Ribbon/Ribbon.js +3 -2
  92. package/es/RippleEffect/RippleEffect.js +1 -3
  93. package/es/Select/GroupSelect.js +58 -14
  94. package/es/Select/Select.js +79 -33
  95. package/es/Select/SelectWithAvatar.js +17 -4
  96. package/es/Select/SelectWithIcon.js +46 -5
  97. package/es/Select/__tests__/Select.spec.js +6 -8
  98. package/es/Select/props/propTypes.js +1 -0
  99. package/es/Stencils/Stencils.js +3 -3
  100. package/es/Switch/Switch.js +5 -3
  101. package/es/Tab/Tab.js +4 -4
  102. package/es/Tab/TabContent.js +1 -0
  103. package/es/Tab/TabContentWrapper.js +2 -0
  104. package/es/Tab/TabWrapper.js +5 -2
  105. package/es/Tab/Tabs.js +54 -7
  106. package/es/Tab/__tests__/Tab.spec.js +1 -3
  107. package/es/Tab/__tests__/TabWrapper.spec.js +1 -0
  108. package/es/Tag/Tag.js +6 -3
  109. package/es/TextBox/TextBox.js +15 -3
  110. package/es/TextBox/__tests__/TextBox.spec.js +1 -4
  111. package/es/TextBoxIcon/TextBoxIcon.js +9 -2
  112. package/es/TextBoxIcon/__tests__/TextBoxIcon.spec.js +2 -7
  113. package/es/Textarea/Textarea.js +12 -3
  114. package/es/Textarea/__tests__/Textarea.spec.js +2 -2
  115. package/es/Tooltip/Tooltip.js +58 -14
  116. package/es/Tooltip/__tests__/Tooltip.spec.js +5 -0
  117. package/es/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +3 -2
  118. package/es/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +7 -5
  119. package/es/deprecated/PortalLayer/PortalLayer.js +25 -20
  120. package/es/semantic/Button/Button.js +3 -2
  121. package/es/utils/Common.js +54 -9
  122. package/es/utils/ContextOptimizer.js +4 -5
  123. package/es/utils/__tests__/debounce.spec.js +2 -2
  124. package/es/utils/constructFullName.js +2 -0
  125. package/es/utils/css/compileClassNames.js +5 -0
  126. package/es/utils/css/mergeStyle.js +7 -6
  127. package/es/utils/css/utils.js +1 -0
  128. package/es/utils/datetime/GMTZones.js +48 -0
  129. package/es/utils/datetime/common.js +31 -7
  130. package/es/utils/debounce.js +5 -1
  131. package/es/utils/dropDownUtils.js +68 -11
  132. package/es/utils/getInitial.js +4 -0
  133. package/es/utils/shallowEqual.js +6 -0
  134. package/lib/Accordion/Accordion.js +42 -18
  135. package/lib/Accordion/AccordionItem.js +40 -18
  136. package/lib/Accordion/__tests__/Accordion.spec.js +3 -0
  137. package/lib/Accordion/index.js +3 -0
  138. package/lib/Accordion/props/propTypes.js +3 -0
  139. package/lib/Animation/Animation.js +38 -18
  140. package/lib/Animation/__tests__/Animation.spec.js +11 -7
  141. package/lib/Animation/props/propTypes.js +3 -0
  142. package/lib/AppContainer/AppContainer.js +56 -21
  143. package/lib/AppContainer/props/propTypes.js +3 -0
  144. package/lib/Avatar/Avatar.js +78 -38
  145. package/lib/Avatar/__tests__/Avatar.spec.js +44 -0
  146. package/lib/Avatar/props/propTypes.js +3 -0
  147. package/lib/AvatarTeam/AvatarTeam.js +52 -30
  148. package/lib/AvatarTeam/__tests__/AvatarTeam.spec.js +13 -0
  149. package/lib/AvatarTeam/props/propTypes.js +3 -0
  150. package/lib/Button/Button.js +31 -20
  151. package/lib/Button/css/cssJSLogic.js +18 -17
  152. package/lib/Button/index.js +3 -0
  153. package/lib/Button/props/defaultProps.js +2 -0
  154. package/lib/Button/props/propTypes.js +3 -0
  155. package/lib/Buttongroup/Buttongroup.js +32 -12
  156. package/lib/Buttongroup/__test__/Buttongroup.spec.js +10 -0
  157. package/lib/Buttongroup/props/propTypes.js +3 -0
  158. package/lib/Card/Card.js +102 -46
  159. package/lib/Card/__tests__/Card.spec.js +10 -1
  160. package/lib/Card/index.js +4 -0
  161. package/lib/Card/props/propTypes.js +3 -0
  162. package/lib/CheckBox/CheckBox.js +71 -47
  163. package/lib/CheckBox/__tests__/CheckBox.spec.js +3 -0
  164. package/lib/CheckBox/props/propTypes.js +3 -0
  165. package/lib/DateTime/CalendarView.js +82 -42
  166. package/lib/DateTime/DateTime.js +246 -158
  167. package/lib/DateTime/DateTimePopupFooter.js +31 -8
  168. package/lib/DateTime/DateTimePopupHeader.js +48 -17
  169. package/lib/DateTime/DateWidget.js +352 -250
  170. package/lib/DateTime/DaysRow.js +27 -5
  171. package/lib/DateTime/Time.js +73 -32
  172. package/lib/DateTime/YearView.js +77 -28
  173. package/lib/DateTime/__tests__/CalendarView.spec.js +13 -5
  174. package/lib/DateTime/__tests__/DateTime.spec.js +51 -37
  175. package/lib/DateTime/__tests__/DateWidget.spec.js +10 -8
  176. package/lib/DateTime/common.js +6 -0
  177. package/lib/DateTime/constants.js +1 -0
  178. package/lib/DateTime/dateFormatUtils/dateFormat.js +184 -122
  179. package/lib/DateTime/dateFormatUtils/dateFormats.js +0 -1
  180. package/lib/DateTime/dateFormatUtils/dayChange.js +14 -7
  181. package/lib/DateTime/dateFormatUtils/index.js +74 -16
  182. package/lib/DateTime/dateFormatUtils/monthChange.js +19 -9
  183. package/lib/DateTime/dateFormatUtils/timeChange.js +54 -22
  184. package/lib/DateTime/dateFormatUtils/yearChange.js +22 -11
  185. package/lib/DateTime/index.js +2 -0
  186. package/lib/DateTime/objectUtils.js +24 -20
  187. package/lib/DateTime/props/defaultProps.js +2 -1
  188. package/lib/DateTime/props/propTypes.js +11 -1
  189. package/lib/DateTime/typeChecker.js +4 -0
  190. package/lib/DateTime/validator.js +73 -10
  191. package/lib/DropBox/DropBox.js +34 -10
  192. package/lib/DropBox/DropBoxElement/DropBoxElement.js +59 -38
  193. package/lib/DropBox/DropBoxElement/css/cssJSLogic.js +42 -34
  194. package/lib/DropBox/DropBoxElement/props/propTypes.js +3 -0
  195. package/lib/DropBox/DropBoxElement/useDropboxPosCalc.js +14 -9
  196. package/lib/DropBox/__tests__/DropBox.spec.js +6 -2
  197. package/lib/DropBox/css/cssJSLogic.js +3 -1
  198. package/lib/DropBox/props/defaultProps.js +8 -4
  199. package/lib/DropBox/props/propTypes.js +10 -4
  200. package/lib/DropDown/DropDown.js +52 -8
  201. package/lib/DropDown/DropDownHeading.js +39 -20
  202. package/lib/DropDown/DropDownItem.js +42 -20
  203. package/lib/DropDown/DropDownSearch.js +40 -17
  204. package/lib/DropDown/DropDownSeparator.js +24 -4
  205. package/lib/DropDown/__tests__/DropDown.spec.js +15 -9
  206. package/lib/DropDown/__tests__/DropDownItem.spec.js +9 -4
  207. package/lib/DropDown/__tests__/DropDownSearch.spec.js +3 -0
  208. package/lib/DropDown/index.js +9 -0
  209. package/lib/DropDown/props/propTypes.js +6 -4
  210. package/lib/Heading/Heading.js +37 -15
  211. package/lib/Heading/props/propTypes.js +3 -0
  212. package/lib/Label/Label.js +39 -19
  213. package/lib/Label/__tests__/Label.spec.js +14 -1
  214. package/lib/Label/props/propTypes.js +3 -0
  215. package/lib/Layout/Box.js +31 -11
  216. package/lib/Layout/Container.js +29 -10
  217. package/lib/Layout/__tests__/Box.spec.js +65 -49
  218. package/lib/Layout/__tests__/Container.spec.js +67 -50
  219. package/lib/Layout/index.js +3 -0
  220. package/lib/Layout/props/propTypes.js +3 -0
  221. package/lib/Layout/utils.js +10 -0
  222. package/lib/ListItem/ListContainer.js +48 -27
  223. package/lib/ListItem/ListItem.js +69 -45
  224. package/lib/ListItem/ListItemWithAvatar.js +75 -48
  225. package/lib/ListItem/ListItemWithCheckBox.js +64 -39
  226. package/lib/ListItem/ListItemWithIcon.js +68 -44
  227. package/lib/ListItem/ListItemWithRadio.js +65 -41
  228. package/lib/ListItem/index.js +7 -0
  229. package/lib/ListItem/props/propTypes.js +6 -4
  230. package/lib/Modal/Modal.js +45 -10
  231. package/lib/Modal/props/propTypes.js +3 -0
  232. package/lib/MultiSelect/AdvancedGroupMultiSelect.js +294 -166
  233. package/lib/MultiSelect/AdvancedMultiSelect.js +202 -125
  234. package/lib/MultiSelect/EmptyState.js +45 -24
  235. package/lib/MultiSelect/MultiSelect.js +323 -206
  236. package/lib/MultiSelect/MultiSelectHeader.js +30 -8
  237. package/lib/MultiSelect/MultiSelectWithAvatar.js +105 -63
  238. package/lib/MultiSelect/SelectedOptions.js +43 -17
  239. package/lib/MultiSelect/Suggestions.js +64 -32
  240. package/lib/MultiSelect/__tests__/MultiSelect.spec.js +86 -75
  241. package/lib/MultiSelect/index.js +5 -0
  242. package/lib/MultiSelect/props/defaultProps.js +2 -0
  243. package/lib/MultiSelect/props/propTypes.js +5 -0
  244. package/lib/PopOver/PopOver.js +95 -49
  245. package/lib/PopOver/__tests__/PopOver.spec.js +4 -1
  246. package/lib/PopOver/index.js +4 -0
  247. package/lib/PopOver/props/propTypes.js +3 -0
  248. package/lib/Popup/Popup.js +158 -81
  249. package/lib/Popup/__tests__/Popup.spec.js +43 -8
  250. package/lib/Popup/viewPort.js +28 -14
  251. package/lib/Provider/AvatarSize.js +4 -0
  252. package/lib/Provider/Config.js +2 -0
  253. package/lib/Provider/CssProvider.js +4 -0
  254. package/lib/Provider/IdProvider.js +17 -6
  255. package/lib/Provider/LibraryContext.js +35 -15
  256. package/lib/Provider/LibraryContextInit.js +4 -0
  257. package/lib/Provider/NumberGenerator/NumberGenerator.js +44 -15
  258. package/lib/Provider/ZindexProvider.js +15 -3
  259. package/lib/Provider/index.js +5 -0
  260. package/lib/Radio/Radio.js +61 -38
  261. package/lib/Radio/__tests__/Radiospec.js +9 -5
  262. package/lib/Radio/props/propTypes.js +3 -0
  263. package/lib/Responsive/CustomResponsive.js +73 -29
  264. package/lib/Responsive/RefWrapper.js +17 -11
  265. package/lib/Responsive/ResizeComponent.js +62 -36
  266. package/lib/Responsive/ResizeObserver.js +24 -10
  267. package/lib/Responsive/Responsive.js +80 -30
  268. package/lib/Responsive/index.js +4 -0
  269. package/lib/Responsive/props/propTypes.js +3 -0
  270. package/lib/Responsive/sizeObservers.js +53 -17
  271. package/lib/Responsive/utils/index.js +11 -3
  272. package/lib/Responsive/utils/shallowCompare.js +11 -2
  273. package/lib/Responsive/windowResizeObserver.js +8 -0
  274. package/lib/ResponsiveDropBox/ResponsiveDropBox.js +45 -17
  275. package/lib/ResponsiveDropBox/props/propTypes.js +3 -0
  276. package/lib/Ribbon/Ribbon.js +33 -13
  277. package/lib/Ribbon/__tests__/Ribbon.spec.js +22 -0
  278. package/lib/Ribbon/props/propTypes.js +3 -0
  279. package/lib/RippleEffect/RippleEffect.js +18 -10
  280. package/lib/RippleEffect/props/propTypes.js +3 -0
  281. package/lib/Select/GroupSelect.js +229 -130
  282. package/lib/Select/Select.js +290 -209
  283. package/lib/Select/SelectWithAvatar.js +102 -56
  284. package/lib/Select/SelectWithIcon.js +132 -76
  285. package/lib/Select/__tests__/Select.spec.js +133 -91
  286. package/lib/Select/index.js +5 -0
  287. package/lib/Select/props/defaultProps.js +5 -4
  288. package/lib/Select/props/propTypes.js +4 -0
  289. package/lib/Stencils/Stencils.js +29 -10
  290. package/lib/Stencils/__tests__/Stencils.spec.js +12 -0
  291. package/lib/Stencils/props/propTypes.js +3 -0
  292. package/lib/Switch/Switch.js +57 -34
  293. package/lib/Switch/props/propTypes.js +3 -0
  294. package/lib/Tab/Tab.js +40 -27
  295. package/lib/Tab/TabContent.js +12 -5
  296. package/lib/Tab/TabContentWrapper.js +13 -6
  297. package/lib/Tab/TabWrapper.js +37 -19
  298. package/lib/Tab/Tabs.js +171 -91
  299. package/lib/Tab/__tests__/Tab.spec.js +67 -58
  300. package/lib/Tab/__tests__/TabContent.spec.js +10 -6
  301. package/lib/Tab/__tests__/TabContentWrapper.spec.js +28 -20
  302. package/lib/Tab/__tests__/TabWrapper.spec.js +12 -0
  303. package/lib/Tab/__tests__/Tabs.spec.js +53 -39
  304. package/lib/Tab/index.js +6 -0
  305. package/lib/Tab/props/propTypes.js +3 -0
  306. package/lib/Tag/Tag.js +72 -43
  307. package/lib/Tag/__tests__/Tag.spec.js +14 -8
  308. package/lib/Tag/props/propTypes.js +3 -0
  309. package/lib/TextBox/TextBox.js +85 -59
  310. package/lib/TextBox/__tests__/TextBox.spec.js +14 -4
  311. package/lib/TextBox/props/propTypes.js +6 -4
  312. package/lib/TextBoxIcon/TextBoxIcon.js +79 -52
  313. package/lib/TextBoxIcon/__tests__/TextBoxIcon.spec.js +14 -5
  314. package/lib/TextBoxIcon/props/propTypes.js +3 -0
  315. package/lib/Textarea/Textarea.js +54 -29
  316. package/lib/Textarea/__tests__/Textarea.spec.js +14 -2
  317. package/lib/Textarea/props/propTypes.js +3 -0
  318. package/lib/Tooltip/Tooltip.js +94 -31
  319. package/lib/Tooltip/__tests__/Tooltip.spec.js +24 -3
  320. package/lib/Tooltip/props/propTypes.js +3 -0
  321. package/lib/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +40 -16
  322. package/lib/VelocityAnimation/VelocityAnimation/props/propTypes.js +3 -0
  323. package/lib/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +53 -25
  324. package/lib/VelocityAnimation/VelocityAnimationGroup/props/propTypes.js +3 -0
  325. package/lib/VelocityAnimation/index.js +3 -0
  326. package/lib/css.js +40 -0
  327. package/lib/deprecated/PortalLayer/PortalLayer.js +46 -23
  328. package/lib/deprecated/PortalLayer/props/propTypes.js +3 -0
  329. package/lib/index.js +57 -0
  330. package/lib/semantic/Button/Button.js +42 -22
  331. package/lib/semantic/Button/props/propTypes.js +3 -0
  332. package/lib/semantic/index.js +2 -0
  333. package/lib/utils/Common.js +110 -18
  334. package/lib/utils/ContextOptimizer.js +16 -10
  335. package/lib/utils/__tests__/constructFullName.spec.js +1 -0
  336. package/lib/utils/__tests__/debounce.spec.js +3 -2
  337. package/lib/utils/__tests__/getInitial.spec.js +1 -0
  338. package/lib/utils/constructFullName.js +13 -4
  339. package/lib/utils/css/compileClassNames.js +6 -0
  340. package/lib/utils/css/mergeStyle.js +10 -7
  341. package/lib/utils/css/utils.js +8 -0
  342. package/lib/utils/datetime/GMTZones.js +55 -0
  343. package/lib/utils/datetime/common.js +52 -7
  344. package/lib/utils/debounce.js +6 -1
  345. package/lib/utils/dropDownUtils.js +175 -59
  346. package/lib/utils/dummyFunction.js +2 -0
  347. package/lib/utils/getHTMLFontSize.js +1 -0
  348. package/lib/utils/getInitial.js +6 -0
  349. package/lib/utils/index.js +4 -0
  350. package/lib/utils/scrollTo.js +2 -0
  351. package/lib/utils/shallowEqual.js +8 -0
  352. package/package.json +1 -1
package/es/Popup/Popup.js CHANGED
@@ -1,16 +1,18 @@
1
1
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+
2
3
  /**** Libraries ****/
3
4
  import React from 'react';
4
5
  import PropTypes from 'prop-types';
5
6
  import hoistStatics from 'hoist-non-react-statics';
6
-
7
7
  /**** Methods ****/
8
+
8
9
  import { debounce, isDescendant, isTextSelected, cancelBubblingEffect } from '../utils/Common.js';
9
10
  import viewPort from './viewPort';
10
11
  import { absolutePositionMapping, rtlAbsolutePositionMapping, rtlFixedPositionMapping } from './PositionMapping.json';
11
12
  import ResizeObserver from '@zohodesk/virtualizer/lib/commons/ResizeObserver.js';
12
13
  let lastOpenedGroup = [];
13
14
  let popups = {};
15
+
14
16
  global.closeGroupPopups = function (groupName) {
15
17
  const groupPopups = popups[groupName] || [];
16
18
  groupPopups.forEach(popup => {
@@ -20,6 +22,7 @@ global.closeGroupPopups = function (groupName) {
20
22
  });
21
23
  });
22
24
  };
25
+
23
26
  const defaultState = {
24
27
  position: 'bottomCenter',
25
28
  height: '0px',
@@ -33,8 +36,8 @@ const defaultState = {
33
36
  //{height: ‘’, width: ‘’,}
34
37
  isAbsolutePositioningNeeded: true
35
38
  };
36
-
37
39
  /* eslint-disable react/no-deprecated */
40
+
38
41
  /* eslint-disable react/prop-types */
39
42
 
40
43
  const Popup = function (Component) {
@@ -47,6 +50,7 @@ const Popup = function (Component) {
47
50
  scrollDebounceTime: popupScrollDebounceTime = 0,
48
51
  closeOnScroll: closeOnScrollPopup = false
49
52
  } = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
53
+
50
54
  class Popup extends React.Component {
51
55
  constructor(props) {
52
56
  super(props);
@@ -87,9 +91,8 @@ const Popup = function (Component) {
87
91
  this.handleDocumentMouseDown = this.handleDocumentMouseDown.bind(this);
88
92
  this.handleDocumentFocus = this.handleDocumentFocus.bind(this);
89
93
  this.handleGetNeedPrevent = this.handleGetNeedPrevent.bind(this);
90
- this.popupObserver = new ResizeObserver(this.handlePopupResize);
94
+ this.popupObserver = new ResizeObserver(this.handlePopupResize); //dropBoxSize
91
95
 
92
- //dropBoxSize
93
96
  this.size = null;
94
97
  this.isAbsolutePopup = isAbsolutePopup;
95
98
  this.needPopupArrow = needPopupArrow;
@@ -101,25 +104,29 @@ const Popup = function (Component) {
101
104
  } = this.getScrollDebounceTime(this);
102
105
  this.handleScroll = debounce(this.handleScroll.bind(this), scrollDebounceTime);
103
106
  }
107
+
104
108
  componentDidMount() {
105
109
  const group = this.getGroup();
106
110
  const groupPopups = popups[group] || [];
107
111
  groupPopups.push(this);
108
112
  popups[group] = groupPopups;
113
+
109
114
  if (Object.keys(popups).length === 1 && groupPopups.length === 1) {
110
115
  document.addEventListener('click', this.documentClickHandler, false);
111
- document.addEventListener('keyup', this.documentKeyupHandler, false);
112
- // document.addEventListener('scroll', this.handleScroll, true);
116
+ document.addEventListener('keyup', this.documentKeyupHandler, false); // document.addEventListener('scroll', this.handleScroll, true);
117
+
113
118
  window.addEventListener('resize', this.handleResize);
114
119
  document.addEventListener('click', this.documentClickHandler1, true);
115
120
  document.addEventListener('mousedown', this.handleDocumentMouseDown, true);
116
121
  document.addEventListener('focus', this.handleDocumentFocus, true);
117
122
  }
118
123
  }
124
+
119
125
  componentWillReceiveProps(nextProps) {
120
126
  const {
121
127
  isPopupOpen
122
128
  } = this.state;
129
+
123
130
  if (typeof nextProps.isPopupOpen !== 'undefined' && nextProps.isPopupOpen !== isPopupOpen) {
124
131
  this.setState({
125
132
  isPopupOpen: nextProps.isPopupOpen,
@@ -127,6 +134,7 @@ const Popup = function (Component) {
127
134
  });
128
135
  }
129
136
  }
137
+
130
138
  componentDidUpdate(prevProps, prevState) {
131
139
  const {
132
140
  isPopupReady
@@ -140,6 +148,7 @@ const Popup = function (Component) {
140
148
  const {
141
149
  needResizeHandling: propResizeHandling
142
150
  } = this.props;
151
+
143
152
  if (oldStateOpen !== isPopupReady) {
144
153
  if (isPopupReady && dropElement && (propResizeHandling !== undefined ? propResizeHandling : needResizeHandling)) {
145
154
  this.popupObserver.replaceObservationElement(dropElement);
@@ -149,6 +158,7 @@ const Popup = function (Component) {
149
158
  }
150
159
  }
151
160
  }
161
+
152
162
  componentWillUnmount() {
153
163
  const group = this.getGroup();
154
164
  popups = Object.keys(popups).reduce((res, groupName) => {
@@ -158,34 +168,40 @@ const Popup = function (Component) {
158
168
  newGroupPopups.length === 0 && lastOpenedGroup.indexOf(group) >= 0 && lastOpenedGroup.splice(lastOpenedGroup.indexOf(group), 1);
159
169
  res[group] = newGroupPopups;
160
170
  }
171
+
161
172
  return res;
162
173
  }, popups);
163
174
  let noPopups = true;
175
+
164
176
  for (const i in popups) {
165
177
  if (popups[i].length >= 1) {
166
178
  noPopups = false;
167
179
  break;
168
180
  }
169
181
  }
182
+
170
183
  if (this.popupObserver) {
171
184
  this.popupObserver.disconnect();
172
185
  }
186
+
173
187
  if (noPopups) {
174
188
  document.removeEventListener('click', this.documentClickHandler);
175
- document.removeEventListener('keyup', this.documentKeyupHandler);
176
- // document.removeEventListener('scroll', this.handleScroll);
189
+ document.removeEventListener('keyup', this.documentKeyupHandler); // document.removeEventListener('scroll', this.handleScroll);
190
+
177
191
  window.removeEventListener('resize', this.handleResize);
178
192
  document.removeEventListener('click', this.documentClickHandler1, true);
179
193
  document.removeEventListener('mousedown', this.handleDocumentMouseDown, true);
180
194
  document.removeEventListener('focus', this.handleDocumentFocus, true);
181
195
  }
182
196
  }
197
+
183
198
  getGroup() {
184
199
  const {
185
200
  popupGroup
186
201
  } = this.props;
187
202
  return popupGroup || group;
188
203
  }
204
+
189
205
  getNeedArrow(popup) {
190
206
  const {
191
207
  isArrow
@@ -195,6 +211,7 @@ const Popup = function (Component) {
195
211
  } = popup;
196
212
  return isArrow !== undefined ? isArrow : needPopupArrow;
197
213
  }
214
+
198
215
  getScrollDebounceTime(popup) {
199
216
  const {
200
217
  scrollDebounceTime
@@ -204,6 +221,7 @@ const Popup = function (Component) {
204
221
  } = popup;
205
222
  return scrollDebounceTime !== undefined ? scrollDebounceTime : popupScrollDebounceTime;
206
223
  }
224
+
207
225
  getCloseOnScrollPopup(popup) {
208
226
  const {
209
227
  closeOnScroll
@@ -213,6 +231,7 @@ const Popup = function (Component) {
213
231
  } = popup;
214
232
  return closeOnScroll !== undefined ? closeOnScroll : closeOnScrollPopup;
215
233
  }
234
+
216
235
  getIsAbsolutePopup(popup) {
217
236
  const {
218
237
  isAbsolutePositioningNeeded
@@ -222,6 +241,7 @@ const Popup = function (Component) {
222
241
  } = popup;
223
242
  return isAbsolutePositioningNeeded !== undefined ? isAbsolutePositioningNeeded : isAbsolutePopup;
224
243
  }
244
+
225
245
  getCustomPositionOrder(popup) {
226
246
  const {
227
247
  customOrder = []
@@ -231,6 +251,7 @@ const Popup = function (Component) {
231
251
  } = popup;
232
252
  return customOrder.length !== 0 ? customOrder : customPositionOrder;
233
253
  }
254
+
234
255
  togglePopup(e, defaultPosition) {
235
256
  const group = this.getGroup();
236
257
  this.removeClose(e);
@@ -248,6 +269,7 @@ const Popup = function (Component) {
248
269
  });
249
270
  }
250
271
  });
272
+
251
273
  if (isPopupOpen) {
252
274
  this.setState({
253
275
  isPopupOpen: false,
@@ -257,18 +279,21 @@ const Popup = function (Component) {
257
279
  this.handlePopupPosition(defaultPosition);
258
280
  }
259
281
  }
282
+
260
283
  openPopupOnly(e, defaultPosition) {
261
284
  const group = this.getGroup();
262
285
  this.removeClose(e);
263
286
  lastOpenedGroup = lastOpenedGroup.indexOf(group) === -1 ? [group, ...lastOpenedGroup] : lastOpenedGroup;
264
287
  this.handlePopupPosition(defaultPosition);
265
288
  }
289
+
266
290
  closePopupOnly(e) {
267
291
  this.removeClose(e);
268
292
  lastOpenedGroup.splice(0, 1);
269
293
  const {
270
294
  isPopupOpen
271
295
  } = this.state;
296
+
272
297
  if (isPopupOpen) {
273
298
  this.setState({
274
299
  isPopupOpen: false,
@@ -276,6 +301,7 @@ const Popup = function (Component) {
276
301
  });
277
302
  }
278
303
  }
304
+
279
305
  handleCloseLastOpenedGroup() {
280
306
  const groupPopups = lastOpenedGroup.length ? popups[lastOpenedGroup[0]] || [] : [];
281
307
  lastOpenedGroup.splice(0, 1);
@@ -286,44 +312,51 @@ const Popup = function (Component) {
286
312
  });
287
313
  });
288
314
  }
315
+
289
316
  handleDocumentMouseDown(e) {
290
317
  const needPrevent = this.handleGetNeedPrevent(e);
318
+
291
319
  if (needPrevent) {
292
320
  this.removeClose(e);
293
321
  }
294
322
  }
323
+
295
324
  handleDocumentFocus(e) {
296
325
  const needPrevent = this.handleGetNeedPrevent(e);
326
+
297
327
  if (needPrevent) {
298
328
  this.removeClose(e);
299
329
  }
300
330
  }
331
+
301
332
  handleGetNeedPrevent(e) {
302
333
  let needPrevent = false;
334
+
303
335
  if (lastOpenedGroup.length > 1) {
304
336
  const {
305
337
  target
306
338
  } = e;
307
339
  const groupPopups = lastOpenedGroup.length ? popups[lastOpenedGroup[0]] : [];
308
- let openedPopup = null;
309
- // eslint-disable-next-line guard-for-in
340
+ let openedPopup = null; // eslint-disable-next-line guard-for-in
341
+
310
342
  for (const i in groupPopups) {
311
343
  const {
312
344
  isPopupOpen
313
345
  } = groupPopups[i].state;
346
+
314
347
  if (isPopupOpen) {
315
348
  openedPopup = groupPopups[i];
316
349
  break;
317
350
  }
318
351
  }
352
+
319
353
  if (openedPopup) {
320
354
  const {
321
355
  dropElement,
322
356
  placeHolderElement
323
357
  } = openedPopup;
324
358
  const isDropBoxChild = isDescendant(dropElement, target);
325
- const isTargetChild = isDescendant(placeHolderElement, target);
326
- // const massUpdateParent = document.querySelector(
359
+ const isTargetChild = isDescendant(placeHolderElement, target); // const massUpdateParent = document.querySelector(
327
360
  // '[data-id=massUpdatePopup]'
328
361
  // );
329
362
  // const isPopupMassUpdateChild = isDescendant(
@@ -331,22 +364,25 @@ const Popup = function (Component) {
331
364
  // dropElement
332
365
  // );
333
366
 
334
- if (!isDropBoxChild && !isTargetChild
335
- // && isPopupMassUpdateChild
367
+ if (!isDropBoxChild && !isTargetChild // && isPopupMassUpdateChild
336
368
  ) {
337
369
  needPrevent = true;
338
370
  }
339
371
  }
340
372
  }
373
+
341
374
  return needPrevent;
342
375
  }
376
+
343
377
  documentClickHandler1(e) {
344
378
  const needPrevent = this.handleGetNeedPrevent(e);
379
+
345
380
  if (needPrevent) {
346
381
  this.removeClose(e);
347
382
  this.handleCloseLastOpenedGroup();
348
383
  }
349
384
  }
385
+
350
386
  documentClickHandler() {
351
387
  try {
352
388
  Object.keys(popups).forEach(groupName => {
@@ -359,25 +395,26 @@ const Popup = function (Component) {
359
395
  });
360
396
  });
361
397
  lastOpenedGroup = [];
362
- } catch (e) {
363
- // eslint-disable-next-line no-console
398
+ } catch (e) {// eslint-disable-next-line no-console
364
399
  //console.error('popup component not unmounted properly', e);
365
400
  }
366
401
  }
402
+
367
403
  documentKeyupHandler(e) {
368
404
  try {
369
405
  if (e.keyCode === 27) {
370
406
  this.handleCloseLastOpenedGroup();
371
407
  }
372
- } catch (e) {
373
- // eslint-disable-next-line no-console
408
+ } catch (e) {// eslint-disable-next-line no-console
374
409
  //console.log('error', e);
375
410
  }
376
411
  }
412
+
377
413
  removeClose(e) {
378
414
  // e && e.preventDefault && e.preventDefault();
379
415
  cancelBubblingEffect(e);
380
416
  }
417
+
381
418
  handlePopupPosition() {
382
419
  let defaultPosition = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'bottomCenter';
383
420
  let isResizeHandling = arguments.length > 1 ? arguments[1] : undefined;
@@ -392,11 +429,13 @@ const Popup = function (Component) {
392
429
  const needArrow = this.getNeedArrow(this);
393
430
  const isAbsolute = this.getIsAbsolutePopup(this);
394
431
  const customOrder = this.getCustomPositionOrder(this);
432
+
395
433
  if (direction === 'rtl') {
396
434
  defaultPosition = isAbsolute ? rtlAbsolutePositionMapping[defaultPosition] : rtlFixedPositionMapping[defaultPosition];
397
435
  } else {
398
436
  defaultPosition = isAbsolute ? absolutePositionMapping[defaultPosition] : defaultPosition;
399
437
  }
438
+
400
439
  if (!placeHolderElement && !dropElement) {
401
440
  this.setState({
402
441
  isPopupOpen: true,
@@ -404,6 +443,7 @@ const Popup = function (Component) {
404
443
  });
405
444
  return;
406
445
  }
446
+
407
447
  const setPosition = () => {
408
448
  requestAnimationFrame(() => {
409
449
  const {
@@ -427,6 +467,7 @@ const Popup = function (Component) {
427
467
  targetOffset,
428
468
  popupOffset
429
469
  } = betterPosition || {};
470
+
430
471
  if (position !== view || !isPopupReady) {
431
472
  this.setState({
432
473
  isPopupReady: true,
@@ -440,6 +481,7 @@ const Popup = function (Component) {
440
481
  }
441
482
  });
442
483
  };
484
+
443
485
  if (isResizeHandling) {
444
486
  setPosition();
445
487
  } else {
@@ -450,6 +492,7 @@ const Popup = function (Component) {
450
492
  }, setPosition);
451
493
  }
452
494
  }
495
+
453
496
  handleOpenPopupPositionChange() {
454
497
  Object.keys(popups).forEach(groupName => {
455
498
  const groupPopups = popups[groupName] || [];
@@ -464,6 +507,7 @@ const Popup = function (Component) {
464
507
  position,
465
508
  positionsOffset = {}
466
509
  } = popup.state;
510
+
467
511
  if (placeHolderElement && dropElement) {
468
512
  const scrollContainer = placeHolderElement.closest('[data-scroll=true]') || document.body;
469
513
  requestAnimationFrame(() => {
@@ -490,9 +534,7 @@ const Popup = function (Component) {
490
534
  left = '',
491
535
  top = ''
492
536
  } = viewsOffset[view] || {};
493
- const changeState = isAbsolute ? position !== view : oldLeft !== left || oldTop !== top;
494
-
495
- // let isInViewPort = viewPort.isInViewPort(
537
+ const changeState = isAbsolute ? position !== view : oldLeft !== left || oldTop !== top; // let isInViewPort = viewPort.isInViewPort(
496
538
  // placeHolderElement,
497
539
  // scrollContainer
498
540
  // );
@@ -506,9 +548,7 @@ const Popup = function (Component) {
506
548
  popupOffset,
507
549
  isAbsolutePositioningNeeded: isAbsolute
508
550
  });
509
- }
510
-
511
- // if (!isInViewPort && !isAbsolute) {
551
+ } // if (!isInViewPort && !isAbsolute) {
512
552
  // popup.setState({ isPopupOpen: false, isPopupReady: false });
513
553
  // } else if (view && changeState) {
514
554
  // popup.setState({
@@ -520,6 +560,7 @@ const Popup = function (Component) {
520
560
  // isAbsolutePositioningNeeded: isAbsolute
521
561
  // });
522
562
  // }
563
+
523
564
  });
524
565
  }
525
566
  }
@@ -530,6 +571,7 @@ const Popup = function (Component) {
530
571
  handleResize() {
531
572
  this.handleOpenPopupPositionChange();
532
573
  }
574
+
533
575
  handleScroll(e) {
534
576
  // this.handleOpenPopupPositionChange();
535
577
  const {
@@ -538,14 +580,17 @@ const Popup = function (Component) {
538
580
  const {
539
581
  isPopupReady
540
582
  } = this.state;
583
+
541
584
  if (isPopupReady) {
542
585
  console.log('onscrollPopupREady');
543
586
  }
587
+
544
588
  if (isPopupReady && closeOnScroll) {
545
589
  console.log(this, 'handle Scroll');
546
590
  this.togglePopup(e);
547
591
  }
548
592
  }
593
+
549
594
  handlePopupResize(popupSize) {
550
595
  const {
551
596
  height,
@@ -559,17 +604,22 @@ const Popup = function (Component) {
559
604
  isPopupReady,
560
605
  position
561
606
  } = this.state;
607
+
562
608
  if (isPopupReady && this.size && (oldHeight !== height || width !== oldWidth)) {
563
609
  this.handlePopupPosition(position, true);
564
610
  }
611
+
565
612
  this.size = popupSize;
566
613
  }
614
+
567
615
  getTargetRef(el) {
568
616
  this.placeHolderElement = el;
569
617
  }
618
+
570
619
  getContainerRef(el) {
571
620
  this.dropElement = el;
572
621
  }
622
+
573
623
  render() {
574
624
  const {
575
625
  isPopupReady,
@@ -585,11 +635,14 @@ const Popup = function (Component) {
585
635
  getContainerRef: this.getContainerRef
586
636
  }));
587
637
  }
638
+
588
639
  }
640
+
589
641
  Popup.displayName = Component.displayName || Component.name || Popup.name;
590
642
  Popup.contextTypes = {
591
643
  direction: PropTypes.string
592
644
  };
593
645
  return hoistStatics(Popup, Component);
594
646
  };
647
+
595
648
  export default Popup;
@@ -1,22 +1,29 @@
1
1
  /* eslint-disable no-undef */
2
+
2
3
  /**** Libraries ****/
3
4
  import React from 'react';
4
5
  import ReactDOM from 'react-dom';
5
6
  import PropTypes from 'prop-types';
6
7
  /**** Components ****/
8
+
7
9
  import Popup from '../Popup';
10
+
8
11
  class SamplePopup extends React.Component {
9
12
  constructor(props) {
10
13
  super(props);
11
14
  }
15
+
12
16
  render() {
13
17
  return /*#__PURE__*/React.createElement("div", null, "Sample Popup");
14
18
  }
19
+
15
20
  }
21
+
16
22
  class SamplePopupCopy extends React.Component {
17
23
  constructor(props) {
18
24
  super(props);
19
25
  }
26
+
20
27
  render() {
21
28
  return /*#__PURE__*/React.createElement("div", {
22
29
  "data-id": "samplePopup",
@@ -25,26 +32,33 @@ class SamplePopupCopy extends React.Component {
25
32
  }
26
33
  }, "Sample Popup");
27
34
  }
35
+
28
36
  }
37
+
29
38
  SamplePopupCopy.propTypes = {
30
39
  removeClose: PropTypes.func
31
40
  };
41
+
32
42
  class SamplePopupCopy1 extends React.Component {
33
43
  constructor(props) {
34
44
  super(props);
35
45
  }
46
+
36
47
  render() {
37
48
  return /*#__PURE__*/React.createElement("div", {
38
49
  "data-id": "samplePopup"
39
50
  }, "Sample Popup");
40
51
  }
52
+
41
53
  }
54
+
42
55
  describe('Popup component conditions', () => {
43
56
  it('should click same popup with removeClose', () => {
44
57
  let PopupWrapperComponent = Popup(SamplePopupCopy);
45
58
  let div = document.createElement('div');
46
59
  document.body.append(div);
47
60
  /*eslint-disable */
61
+
48
62
  let popupDom = ReactDOM.render( /*#__PURE__*/React.createElement(PopupWrapperComponent, null), div);
49
63
  /*eslint-enable */
50
64
 
@@ -87,6 +101,7 @@ describe('Popup component conditions', () => {
87
101
  let div = document.createElement('div');
88
102
  document.body.append(div);
89
103
  /*eslint-disable */
104
+
90
105
  let popupDom = ReactDOM.render( /*#__PURE__*/React.createElement(PopupWrapperComponent, null), div);
91
106
  /*eslint-enable */
92
107
 
@@ -108,15 +123,12 @@ describe('Popup component conditions', () => {
108
123
  let PopupWrapperComponent = Popup(SamplePopupCopy1);
109
124
  let popupDom = TestUtils.renderIntoDocument( /*#__PURE__*/React.createElement(PopupWrapperComponent, null));
110
125
  popupDom.togglePopup();
111
- expect(popupDom.state.isPopupOpen).toBeTruthy();
126
+ expect(popupDom.state.isPopupOpen).toBeTruthy(); //TestUtils.Simulate.keyUp(document, {keyCode:27});
112
127
 
113
- //TestUtils.Simulate.keyUp(document, {keyCode:27});
114
128
  let e = document.createEvent('HTMLEvents');
115
129
  e.initEvent('keyup', false, true);
116
130
  e.keyCode = 27;
117
131
  document.dispatchEvent(e);
118
132
  expect(popupDom.state.isPopupOpen).toBeFalsy();
119
133
  });
120
- });
121
-
122
- //Group Popup Handling Open and close
134
+ }); //Group Popup Handling Open and close
@@ -4,6 +4,7 @@ let viewPort = {
4
4
  if (!el) {
5
5
  return;
6
6
  }
7
+
7
8
  let rectTemp = el.getBoundingClientRect();
8
9
  let rect = {
9
10
  height: rectTemp.height || el.clientHeight,
@@ -26,9 +27,11 @@ let viewPort = {
26
27
  x: 0,
27
28
  y: 0
28
29
  };
30
+
29
31
  if (customFrame) {
30
32
  customFrameRect = customFrame.getBoundingClientRect();
31
33
  }
34
+
32
35
  let newRect = {
33
36
  top: rect.top - customFrameRect.top,
34
37
  left: rect.left - customFrameRect.left,
@@ -61,6 +64,7 @@ let viewPort = {
61
64
  if (!el) {
62
65
  return;
63
66
  }
67
+
64
68
  let elRects = viewPort.frameRelativeRects(el, customFrame);
65
69
  let {
66
70
  rect
@@ -78,9 +82,11 @@ let viewPort = {
78
82
  needArrow,
79
83
  isAbsolute
80
84
  } = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
85
+
81
86
  if (!el) {
82
87
  return;
83
88
  }
89
+
84
90
  let elViewPortEle = viewPort.getViewPortEle(el);
85
91
  let elRects = viewPort.frameRelativeRects(el, customFrame, elViewPortEle);
86
92
  let {
@@ -95,13 +101,12 @@ let viewPort = {
95
101
  let relativeBoxDocumentRects = viewPort.frameRelativeRects(relativeBox, customFrame);
96
102
  let {
97
103
  rectGap: documentGap
98
- } = relativeBoxDocumentRects;
99
-
100
- //rect => PopOverContainer, relativeBoxGap => PopOverTarget
101
-
104
+ } = relativeBoxDocumentRects; //rect => PopOverContainer, relativeBoxGap => PopOverTarget
102
105
  //Horizontal ~ ----- X axis
103
106
  //Vertical ~ ||||||| Y axis
107
+
104
108
  let paddingSpace = 5; // space between target and relative element
109
+
105
110
  let arrowSize = needArrow ? 10 : 0;
106
111
  rect.height = rect.height + (needArrow ? arrowSize : paddingSpace);
107
112
  rect.width = rect.width + (needArrow ? arrowSize : paddingSpace);
@@ -284,6 +289,7 @@ let viewPort = {
284
289
  if (!el) {
285
290
  return;
286
291
  }
292
+
287
293
  let elRects = viewPort.frameRelativeRects(el, customFrame);
288
294
  let {
289
295
  rectGap
@@ -310,9 +316,11 @@ let viewPort = {
310
316
  needArrow,
311
317
  isAbsolute
312
318
  });
319
+
313
320
  if (!viewPortPossibilities) {
314
321
  return;
315
322
  }
323
+
316
324
  let {
317
325
  views,
318
326
  viewsOffset,
@@ -321,10 +329,12 @@ let viewPort = {
321
329
  } = viewPortPossibilities;
322
330
  let view = null;
323
331
  let isViewFound = false;
332
+
324
333
  if (!isViewFound && defaultView && views[defaultView]) {
325
334
  view = defaultView;
326
335
  isViewFound = true;
327
336
  }
337
+
328
338
  if (!isViewFound) {
329
339
  if (customOrder.length > 0) {
330
340
  isViewFound = customOrder.some(position => {
@@ -342,9 +352,11 @@ let viewPort = {
342
352
  });
343
353
  }
344
354
  }
355
+
345
356
  if (!isViewFound) {
346
357
  view = defaultView;
347
358
  }
359
+
348
360
  return {
349
361
  view,
350
362
  views,