@elliemae/ds-shared 1.57.1-rc.0 → 2.0.0-alpha.11

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 (264) hide show
  1. package/cjs/Animations/BaseAnimation.js +25 -36
  2. package/cjs/Animations/Grow.js +31 -39
  3. package/cjs/Animations/GrowRight.js +31 -40
  4. package/cjs/Animations/GrowVertical.js +3 -2
  5. package/cjs/CheckableGroup.js +36 -50
  6. package/cjs/DeferRenderAfterComputation.js +12 -22
  7. package/cjs/FocusGroup/FocusGrid.js +94 -102
  8. package/cjs/FocusGroup/FocusGroup.js +215 -270
  9. package/cjs/FocusGroup/FocusGroupContext.js +1 -2
  10. package/cjs/FocusGroup/FocusGroupManager.js +88 -124
  11. package/cjs/FocusGroup/focusGroupManagerHoc.js +24 -29
  12. package/cjs/FocusGroup/index.js +14 -28
  13. package/cjs/FocusGroup/useFocusGroupItem.js +24 -27
  14. package/cjs/FocusGroup/utils/getNextCellPosition.js +14 -16
  15. package/cjs/GroupContext/Group.js +76 -104
  16. package/cjs/GroupContext/GroupContext.js +1 -2
  17. package/cjs/GroupContext/GroupItem.js +10 -11
  18. package/cjs/GroupContext/index.js +6 -15
  19. package/cjs/ScrollSync/ScrollSync.js +86 -112
  20. package/cjs/ScrollSync/ScrollSyncPane.js +49 -92
  21. package/cjs/ScrollSync/ScrollSyncProvider.js +32 -28
  22. package/cjs/ScrollSync/index.js +4 -14
  23. package/cjs/ScrollSync/useScrollSync.js +0 -1
  24. package/cjs/constants.js +43 -4
  25. package/cjs/createDataInstance/createInstancePlugin.js +6 -10
  26. package/cjs/createDataInstance/createInstanceRef.js +34 -42
  27. package/cjs/createDataInstance/utils.js +42 -76
  28. package/cjs/defer-render-hoc/index.js +19 -64
  29. package/cjs/dimsum.config.js +7 -0
  30. package/cjs/index.js +10 -21
  31. package/cjs/prop-types.js +59 -0
  32. package/cjs/react-spring/index.js +3 -6
  33. package/cjs/react-spring/renderprops.js +3 -6
  34. package/cjs/toolbar/ToolbarProvider.js +60 -81
  35. package/cjs/useDataGrid/VolatileRowsListener.js +13 -27
  36. package/cjs/useDataGrid/index.js +2 -17
  37. package/cjs/useDataGrid/initColumnDefinition.js +45 -53
  38. package/cjs/useDataGrid/useDataGrid.js +105 -152
  39. package/cjs/useDataList/index.js +2 -15
  40. package/cjs/useDataList/recordIterator.js +7 -11
  41. package/cjs/useDataList/useDataList.js +42 -63
  42. package/cjs/utils.js +39 -59
  43. package/cjs/virtualization/AutoHeightList.js +34 -27
  44. package/cjs/virtualization/FluidHeightList.js +23 -17
  45. package/cjs/virtualization/index.js +12 -18
  46. package/esm/Animations/BaseAnimation.js +24 -35
  47. package/esm/Animations/Grow.js +29 -37
  48. package/esm/Animations/GrowRight.js +29 -38
  49. package/esm/Animations/GrowVertical.js +3 -2
  50. package/esm/CheckableGroup.js +33 -46
  51. package/esm/DeferRenderAfterComputation.js +12 -21
  52. package/esm/FocusGroup/FocusGrid.js +86 -96
  53. package/esm/FocusGroup/FocusGroup.js +210 -263
  54. package/esm/FocusGroup/FocusGroupContext.js +0 -1
  55. package/esm/FocusGroup/FocusGroupManager.js +85 -115
  56. package/esm/FocusGroup/focusGroupManagerHoc.js +19 -23
  57. package/esm/FocusGroup/index.js +0 -14
  58. package/esm/FocusGroup/useFocusGroupItem.js +22 -25
  59. package/esm/FocusGroup/utils/getNextCellPosition.js +14 -16
  60. package/esm/GroupContext/Group.js +75 -96
  61. package/esm/GroupContext/GroupContext.js +1 -2
  62. package/esm/GroupContext/GroupItem.js +8 -9
  63. package/esm/GroupContext/index.js +0 -9
  64. package/esm/ScrollSync/ScrollSync.js +83 -104
  65. package/esm/ScrollSync/ScrollSyncPane.js +47 -83
  66. package/esm/ScrollSync/ScrollSyncProvider.js +31 -28
  67. package/esm/ScrollSync/index.js +0 -10
  68. package/esm/ScrollSync/useScrollSync.js +0 -1
  69. package/esm/constants.js +31 -5
  70. package/esm/createDataInstance/createInstancePlugin.js +5 -8
  71. package/esm/createDataInstance/createInstanceRef.js +29 -36
  72. package/esm/createDataInstance/utils.js +40 -74
  73. package/esm/defer-render-hoc/index.js +19 -57
  74. package/esm/dimsum.config.js +5 -0
  75. package/esm/index.js +0 -11
  76. package/esm/prop-types.js +43 -0
  77. package/esm/react-spring/index.js +1 -2
  78. package/esm/react-spring/renderprops.js +1 -2
  79. package/esm/toolbar/ToolbarProvider.js +55 -75
  80. package/esm/useDataGrid/VolatileRowsListener.js +12 -24
  81. package/esm/useDataGrid/index.js +0 -15
  82. package/esm/useDataGrid/initColumnDefinition.js +38 -45
  83. package/esm/useDataGrid/useDataGrid.js +85 -131
  84. package/esm/useDataList/index.js +0 -13
  85. package/esm/useDataList/recordIterator.js +7 -11
  86. package/esm/useDataList/useDataList.js +31 -51
  87. package/esm/utils.js +37 -57
  88. package/esm/virtualization/AutoHeightList.js +26 -19
  89. package/esm/virtualization/FluidHeightList.js +20 -14
  90. package/esm/virtualization/index.js +6 -12
  91. package/package.json +202 -13
  92. package/types/Animations/BaseAnimation.d.ts +12 -0
  93. package/types/Animations/Grow.d.ts +11 -0
  94. package/types/Animations/GrowRight.d.ts +11 -0
  95. package/types/Animations/GrowVertical.d.ts +1 -0
  96. package/types/CheckableGroup.d.ts +20 -0
  97. package/types/DeferRenderAfterComputation.d.ts +6 -0
  98. package/types/FocusGroup/FocusGrid.d.ts +10 -0
  99. package/types/FocusGroup/FocusGroup.d.ts +36 -0
  100. package/types/FocusGroup/FocusGroupContext.d.ts +3 -0
  101. package/types/FocusGroup/FocusGroupManager.d.ts +24 -0
  102. package/types/FocusGroup/focusGroupManagerHoc.d.ts +7 -0
  103. package/types/FocusGroup/index.d.ts +6 -0
  104. package/types/FocusGroup/useFocusGroupItem.d.ts +2 -0
  105. package/types/FocusGroup/utils/getNextCellPosition.d.ts +12 -0
  106. package/types/GroupContext/Group.d.ts +14 -0
  107. package/types/GroupContext/GroupContext.d.ts +2 -0
  108. package/types/GroupContext/GroupItem.d.ts +5 -0
  109. package/types/GroupContext/index.d.ts +3 -0
  110. package/types/ScrollSync/ScrollSync.d.ts +21 -0
  111. package/types/ScrollSync/ScrollSyncPane.d.ts +3 -0
  112. package/types/ScrollSync/ScrollSyncProvider.d.ts +12 -0
  113. package/types/ScrollSync/index.d.ts +2 -0
  114. package/types/ScrollSync/useScrollSync.d.ts +6 -0
  115. package/types/constants.d.ts +30 -0
  116. package/types/createDataInstance/createInstancePlugin.d.ts +1 -0
  117. package/types/createDataInstance/createInstanceRef.d.ts +12 -0
  118. package/types/createDataInstance/tests/createInstanceRef.test.d.ts +0 -0
  119. package/types/createDataInstance/utils.d.ts +9 -0
  120. package/types/dimsum.config.d.ts +4 -0
  121. package/types/index.d.ts +2 -0
  122. package/types/prop-types.d.ts +41 -0
  123. package/types/react-spring/index.d.ts +1 -0
  124. package/types/react-spring/renderprops.d.ts +1 -0
  125. package/types/toolbar/ToolbarProvider.d.ts +10 -0
  126. package/types/useDataGrid/VolatileRowsListener.d.ts +5 -0
  127. package/types/useDataGrid/index.d.ts +1 -0
  128. package/types/useDataGrid/initColumnDefinition.d.ts +4 -0
  129. package/types/useDataGrid/useDataGrid.d.ts +8 -0
  130. package/types/useDataList/index.d.ts +1 -0
  131. package/types/useDataList/recordIterator.d.ts +1 -0
  132. package/types/useDataList/useDataList.d.ts +13 -0
  133. package/types/utils.d.ts +22 -0
  134. package/types/virtualization/AutoHeightList.d.ts +2 -0
  135. package/types/virtualization/FluidHeightList.d.ts +2 -0
  136. package/types/virtualization/index.d.ts +9 -0
  137. package/Animations/BaseAnimation/package.json +0 -10
  138. package/Animations/Grow/package.json +0 -10
  139. package/Animations/GrowRight/package.json +0 -10
  140. package/Animations/GrowVertical/package.json +0 -10
  141. package/CheckableGroup/package.json +0 -10
  142. package/DeferRenderAfterComputation/package.json +0 -10
  143. package/FocusGroup/FocusGrid/package.json +0 -10
  144. package/FocusGroup/FocusGroup/package.json +0 -10
  145. package/FocusGroup/FocusGroupContext/package.json +0 -10
  146. package/FocusGroup/FocusGroupManager/package.json +0 -10
  147. package/FocusGroup/focusGroupManagerHoc/package.json +0 -10
  148. package/FocusGroup/package.json +0 -10
  149. package/FocusGroup/useFocusGroupItem/package.json +0 -10
  150. package/FocusGroup/utils/getNextCellPosition/package.json +0 -10
  151. package/GroupContext/Group/package.json +0 -10
  152. package/GroupContext/GroupContext/package.json +0 -10
  153. package/GroupContext/GroupItem/package.json +0 -10
  154. package/GroupContext/package.json +0 -10
  155. package/ScrollSync/ScrollSync/package.json +0 -10
  156. package/ScrollSync/ScrollSyncPane/package.json +0 -10
  157. package/ScrollSync/ScrollSyncProvider/package.json +0 -10
  158. package/ScrollSync/package.json +0 -10
  159. package/ScrollSync/useScrollSync/package.json +0 -10
  160. package/cjs/Animations/BaseAnimation.js.map +0 -1
  161. package/cjs/Animations/Grow.js.map +0 -1
  162. package/cjs/Animations/GrowRight.js.map +0 -1
  163. package/cjs/Animations/GrowVertical.js.map +0 -1
  164. package/cjs/CheckableGroup.js.map +0 -1
  165. package/cjs/DeferRenderAfterComputation.js.map +0 -1
  166. package/cjs/FocusGroup/FocusGrid.js.map +0 -1
  167. package/cjs/FocusGroup/FocusGroup.js.map +0 -1
  168. package/cjs/FocusGroup/FocusGroupContext.js.map +0 -1
  169. package/cjs/FocusGroup/FocusGroupManager.js.map +0 -1
  170. package/cjs/FocusGroup/focusGroupManagerHoc.js.map +0 -1
  171. package/cjs/FocusGroup/index.js.map +0 -1
  172. package/cjs/FocusGroup/useFocusGroupItem.js.map +0 -1
  173. package/cjs/FocusGroup/utils/getNextCellPosition.js.map +0 -1
  174. package/cjs/GroupContext/Group.js.map +0 -1
  175. package/cjs/GroupContext/GroupContext.js.map +0 -1
  176. package/cjs/GroupContext/GroupItem.js.map +0 -1
  177. package/cjs/GroupContext/index.js.map +0 -1
  178. package/cjs/ScrollSync/ScrollSync.js.map +0 -1
  179. package/cjs/ScrollSync/ScrollSyncPane.js.map +0 -1
  180. package/cjs/ScrollSync/ScrollSyncProvider.js.map +0 -1
  181. package/cjs/ScrollSync/index.js.map +0 -1
  182. package/cjs/ScrollSync/useScrollSync.js.map +0 -1
  183. package/cjs/constants.js.map +0 -1
  184. package/cjs/createDataInstance/createInstancePlugin.js.map +0 -1
  185. package/cjs/createDataInstance/createInstanceRef.js.map +0 -1
  186. package/cjs/createDataInstance/utils.js.map +0 -1
  187. package/cjs/defer-render-hoc/index.js.map +0 -1
  188. package/cjs/index.js.map +0 -1
  189. package/cjs/react-spring/index.js.map +0 -1
  190. package/cjs/react-spring/renderprops.js.map +0 -1
  191. package/cjs/toolbar/ToolbarProvider.js.map +0 -1
  192. package/cjs/useDataGrid/VolatileRowsListener.js.map +0 -1
  193. package/cjs/useDataGrid/index.js.map +0 -1
  194. package/cjs/useDataGrid/initColumnDefinition.js.map +0 -1
  195. package/cjs/useDataGrid/useDataGrid.js.map +0 -1
  196. package/cjs/useDataList/index.js.map +0 -1
  197. package/cjs/useDataList/recordIterator.js.map +0 -1
  198. package/cjs/useDataList/useDataList.js.map +0 -1
  199. package/cjs/utils.js.map +0 -1
  200. package/cjs/virtualization/AutoHeightList.js.map +0 -1
  201. package/cjs/virtualization/FluidHeightList.js.map +0 -1
  202. package/cjs/virtualization/index.js.map +0 -1
  203. package/constants/package.json +0 -10
  204. package/createDataInstance/createInstancePlugin/package.json +0 -10
  205. package/createDataInstance/createInstanceRef/package.json +0 -10
  206. package/createDataInstance/utils/package.json +0 -10
  207. package/defer-render-hoc/package.json +0 -10
  208. package/esm/Animations/BaseAnimation.js.map +0 -1
  209. package/esm/Animations/Grow.js.map +0 -1
  210. package/esm/Animations/GrowRight.js.map +0 -1
  211. package/esm/Animations/GrowVertical.js.map +0 -1
  212. package/esm/CheckableGroup.js.map +0 -1
  213. package/esm/DeferRenderAfterComputation.js.map +0 -1
  214. package/esm/FocusGroup/FocusGrid.js.map +0 -1
  215. package/esm/FocusGroup/FocusGroup.js.map +0 -1
  216. package/esm/FocusGroup/FocusGroupContext.js.map +0 -1
  217. package/esm/FocusGroup/FocusGroupManager.js.map +0 -1
  218. package/esm/FocusGroup/focusGroupManagerHoc.js.map +0 -1
  219. package/esm/FocusGroup/index.js.map +0 -1
  220. package/esm/FocusGroup/useFocusGroupItem.js.map +0 -1
  221. package/esm/FocusGroup/utils/getNextCellPosition.js.map +0 -1
  222. package/esm/GroupContext/Group.js.map +0 -1
  223. package/esm/GroupContext/GroupContext.js.map +0 -1
  224. package/esm/GroupContext/GroupItem.js.map +0 -1
  225. package/esm/GroupContext/index.js.map +0 -1
  226. package/esm/ScrollSync/ScrollSync.js.map +0 -1
  227. package/esm/ScrollSync/ScrollSyncPane.js.map +0 -1
  228. package/esm/ScrollSync/ScrollSyncProvider.js.map +0 -1
  229. package/esm/ScrollSync/index.js.map +0 -1
  230. package/esm/ScrollSync/useScrollSync.js.map +0 -1
  231. package/esm/constants.js.map +0 -1
  232. package/esm/createDataInstance/createInstancePlugin.js.map +0 -1
  233. package/esm/createDataInstance/createInstanceRef.js.map +0 -1
  234. package/esm/createDataInstance/utils.js.map +0 -1
  235. package/esm/defer-render-hoc/index.js.map +0 -1
  236. package/esm/index.js.map +0 -1
  237. package/esm/react-spring/index.js.map +0 -1
  238. package/esm/react-spring/renderprops.js.map +0 -1
  239. package/esm/toolbar/ToolbarProvider.js.map +0 -1
  240. package/esm/useDataGrid/VolatileRowsListener.js.map +0 -1
  241. package/esm/useDataGrid/index.js.map +0 -1
  242. package/esm/useDataGrid/initColumnDefinition.js.map +0 -1
  243. package/esm/useDataGrid/useDataGrid.js.map +0 -1
  244. package/esm/useDataList/index.js.map +0 -1
  245. package/esm/useDataList/recordIterator.js.map +0 -1
  246. package/esm/useDataList/useDataList.js.map +0 -1
  247. package/esm/utils.js.map +0 -1
  248. package/esm/virtualization/AutoHeightList.js.map +0 -1
  249. package/esm/virtualization/FluidHeightList.js.map +0 -1
  250. package/esm/virtualization/index.js.map +0 -1
  251. package/react-spring/package.json +0 -10
  252. package/react-spring/renderprops/package.json +0 -10
  253. package/toolbar/ToolbarProvider/package.json +0 -10
  254. package/useDataGrid/VolatileRowsListener/package.json +0 -10
  255. package/useDataGrid/initColumnDefinition/package.json +0 -10
  256. package/useDataGrid/package.json +0 -10
  257. package/useDataGrid/useDataGrid/package.json +0 -10
  258. package/useDataList/package.json +0 -10
  259. package/useDataList/recordIterator/package.json +0 -10
  260. package/useDataList/useDataList/package.json +0 -10
  261. package/utils/package.json +0 -10
  262. package/virtualization/AutoHeightList/package.json +0 -10
  263. package/virtualization/FluidHeightList/package.json +0 -10
  264. package/virtualization/package.json +0 -10
@@ -1,155 +1,135 @@
1
- import _classCallCheck from '@babel/runtime/helpers/esm/classCallCheck';
2
- import _createClass from '@babel/runtime/helpers/esm/createClass';
3
- import _assertThisInitialized from '@babel/runtime/helpers/esm/assertThisInitialized';
4
- import _inherits from '@babel/runtime/helpers/esm/inherits';
5
- import _possibleConstructorReturn from '@babel/runtime/helpers/esm/possibleConstructorReturn';
6
- import _getPrototypeOf from '@babel/runtime/helpers/esm/getPrototypeOf';
1
+ import _jsx from '@babel/runtime/helpers/esm/jsx';
7
2
  import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
8
3
  import React, { Component } from 'react';
9
4
 
10
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
5
+ const ScrollSyncContext = /*#__PURE__*/React.createContext();
6
+ const {
7
+ Provider
8
+ } = ScrollSyncContext;
9
+ class ScrollSync extends Component {
10
+ constructor(props) {
11
+ super(props);
11
12
 
12
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
13
- var ScrollSyncContext = /*#__PURE__*/React.createContext();
14
- var Provider = ScrollSyncContext.Provider;
13
+ _defineProperty(this, "panes", {});
15
14
 
16
- var ScrollSync = /*#__PURE__*/function (_Component) {
17
- _inherits(ScrollSync, _Component);
18
-
19
- var _super = _createSuper(ScrollSync);
20
-
21
- function ScrollSync(props) {
22
- var _this;
23
-
24
- _classCallCheck(this, ScrollSync);
25
-
26
- _this = _super.call(this, props);
27
-
28
- _defineProperty(_assertThisInitialized(_this), "panes", {});
29
-
30
- _defineProperty(_assertThisInitialized(_this), "registerPane", function (node, groups) {
31
- groups.forEach(function (group) {
32
- if (!_this.panes[group]) {
33
- _this.panes[group] = [];
15
+ _defineProperty(this, "registerPane", (node, groups) => {
16
+ groups.forEach(group => {
17
+ if (!this.panes[group]) {
18
+ this.panes[group] = [];
34
19
  }
35
20
 
36
- if (_this.panes[group].length > 0) {
37
- _this.syncScrollPosition(_this.panes[group][0], node);
21
+ if (this.panes[group].length > 0) {
22
+ this.syncScrollPosition(this.panes[group][0], node);
38
23
  }
39
24
 
40
- _this.panes[group].push(node);
25
+ this.panes[group].push(node);
41
26
  });
42
-
43
- _this.addEvents(node, groups);
27
+ this.addEvents(node, groups);
44
28
  });
45
29
 
46
- _defineProperty(_assertThisInitialized(_this), "unregisterPane", function (node, groups) {
47
- groups.forEach(function (group) {
48
- if (_this.findPane(node, group)) {
49
- _this.removeEvents(node);
50
-
51
- _this.panes[group].splice(_this.panes[group].indexOf(node), 1);
30
+ _defineProperty(this, "unregisterPane", (node, groups) => {
31
+ groups.forEach(group => {
32
+ if (this.findPane(node, group)) {
33
+ this.removeEvents(node);
34
+ this.panes[group].splice(this.panes[group].indexOf(node), 1);
52
35
  }
53
36
  });
54
37
  });
55
38
 
56
- _defineProperty(_assertThisInitialized(_this), "addEvents", function (node, groups) {
39
+ _defineProperty(this, "addEvents", (node, groups) => {
57
40
  /* For some reason element.addEventListener doesnt work with document.body */
58
- node.onscroll = _this.handlePaneScroll.bind(_assertThisInitialized(_this), node, groups); // eslint-disable-line
41
+ node.onscroll = this.handlePaneScroll.bind(this, node, groups); // eslint-disable-line
59
42
  });
60
43
 
61
- _defineProperty(_assertThisInitialized(_this), "removeEvents", function (node) {
44
+ _defineProperty(this, "removeEvents", node => {
62
45
  /* For some reason element.removeEventListener doesnt work with document.body */
63
46
  node.onscroll = null; // eslint-disable-line
64
47
  });
65
48
 
66
- _defineProperty(_assertThisInitialized(_this), "findPane", function (node, group) {
67
- if (!_this.panes[group]) {
49
+ _defineProperty(this, "findPane", (node, group) => {
50
+ if (!this.panes[group]) {
68
51
  return false;
69
52
  }
70
53
 
71
- return _this.panes[group].find(function (pane) {
72
- return pane === node;
73
- });
54
+ return this.panes[group].find(pane => pane === node);
74
55
  });
75
56
 
76
- _defineProperty(_assertThisInitialized(_this), "handlePaneScroll", function (node, groups, e) {
77
- var enabled = _this.props.enabled;
78
- if (_this.props.onScroll) _this.props.onScroll(e);
57
+ _defineProperty(this, "handlePaneScroll", (node, groups, e) => {
58
+ const {
59
+ enabled
60
+ } = this.props;
61
+ if (this.props.onScroll) this.props.onScroll(e);
79
62
  if (!enabled) return;
80
- window.requestAnimationFrame(function () {
81
- _this.syncScrollPositions(node, groups);
63
+ window.requestAnimationFrame(() => {
64
+ this.syncScrollPositions(node, groups);
82
65
  });
83
66
  });
84
67
 
85
- _defineProperty(_assertThisInitialized(_this), "syncScrollPositions", function (scrolledPane, groups) {
86
- groups.forEach(function (group) {
87
- _this.panes[group].forEach(function (pane) {
68
+ _defineProperty(this, "syncScrollPositions", (scrolledPane, groups) => {
69
+ groups.forEach(group => {
70
+ this.panes[group].forEach(pane => {
88
71
  /* For all panes beside the currently scrolling one */
89
72
  if (scrolledPane !== pane) {
90
73
  /* Remove event listeners from the node that we'll manipulate */
91
- _this.removeEvents(pane, group);
92
-
93
- _this.syncScrollPosition(scrolledPane, pane);
74
+ this.removeEvents(pane, group);
75
+ this.syncScrollPosition(scrolledPane, pane);
94
76
  /* Re-attach event listeners after we're done scrolling */
95
77
 
96
-
97
- window.requestAnimationFrame(function () {
98
- _this.addEvents(pane, groups);
78
+ window.requestAnimationFrame(() => {
79
+ this.addEvents(pane, groups);
99
80
  });
100
81
  }
101
82
  });
102
83
  });
103
84
  });
104
85
 
105
- _this.syncContext = {
106
- registerPane: _this.registerPane,
107
- unregisterPane: _this.unregisterPane
86
+ this.syncContext = {
87
+ registerPane: this.registerPane,
88
+ unregisterPane: this.unregisterPane
108
89
  };
109
- return _this;
110
90
  }
111
91
 
112
- _createClass(ScrollSync, [{
113
- key: "syncScrollPosition",
114
- value: function syncScrollPosition(scrolledPane, pane) {
115
- var scrollTop = scrolledPane.scrollTop,
116
- scrollHeight = scrolledPane.scrollHeight,
117
- clientHeight = scrolledPane.clientHeight,
118
- scrollLeft = scrolledPane.scrollLeft,
119
- scrollWidth = scrolledPane.scrollWidth,
120
- clientWidth = scrolledPane.clientWidth;
121
- var scrollTopOffset = scrollHeight - clientHeight;
122
- var scrollLeftOffset = scrollWidth - clientWidth;
123
- var _this$props = this.props,
124
- proportional = _this$props.proportional,
125
- vertical = _this$props.vertical,
126
- horizontal = _this$props.horizontal;
127
- /* Calculate the actual pane height */
128
-
129
- var paneHeight = pane.scrollHeight - clientHeight;
130
- var paneWidth = pane.scrollWidth - clientWidth;
131
- /* Adjust the scrollTop position of it accordingly */
132
-
133
- if (vertical && scrollTopOffset > 0) {
134
- pane.scrollTop = proportional ? paneHeight * scrollTop / scrollTopOffset : scrollTop; // eslint-disable-line
135
- }
136
-
137
- if (horizontal && scrollLeftOffset > 0) {
138
- pane.scrollLeft = proportional ? paneWidth * scrollLeft / scrollLeftOffset : scrollLeft; // eslint-disable-line
139
- }
92
+ syncScrollPosition(scrolledPane, pane) {
93
+ const {
94
+ scrollTop,
95
+ scrollHeight,
96
+ clientHeight,
97
+ scrollLeft,
98
+ scrollWidth,
99
+ clientWidth
100
+ } = scrolledPane;
101
+ const scrollTopOffset = scrollHeight - clientHeight;
102
+ const scrollLeftOffset = scrollWidth - clientWidth;
103
+ const {
104
+ proportional,
105
+ vertical,
106
+ horizontal
107
+ } = this.props;
108
+ /* Calculate the actual pane height */
109
+
110
+ const paneHeight = pane.scrollHeight - clientHeight;
111
+ const paneWidth = pane.scrollWidth - clientWidth;
112
+ /* Adjust the scrollTop position of it accordingly */
113
+
114
+ if (vertical && scrollTopOffset > 0) {
115
+ pane.scrollTop = proportional ? paneHeight * scrollTop / scrollTopOffset : scrollTop; // eslint-disable-line
140
116
  }
141
- }, {
142
- key: "render",
143
- value: function render() {
144
- var children = this.props.children;
145
- return /*#__PURE__*/React.createElement(Provider, {
146
- value: this.syncContext
147
- }, React.Children.only(children));
117
+
118
+ if (horizontal && scrollLeftOffset > 0) {
119
+ pane.scrollLeft = proportional ? paneWidth * scrollLeft / scrollLeftOffset : scrollLeft; // eslint-disable-line
148
120
  }
149
- }]);
121
+ }
122
+
123
+ render() {
124
+ const {
125
+ children
126
+ } = this.props;
127
+ return /*#__PURE__*/_jsx(Provider, {
128
+ value: this.syncContext
129
+ }, void 0, React.Children.only(children));
130
+ }
150
131
 
151
- return ScrollSync;
152
- }(Component);
132
+ }
153
133
 
154
134
  _defineProperty(ScrollSync, "defaultProps", {
155
135
  proportional: true,
@@ -159,4 +139,3 @@ _defineProperty(ScrollSync, "defaultProps", {
159
139
  });
160
140
 
161
141
  export { ScrollSyncContext, ScrollSync as default };
162
- //# sourceMappingURL=ScrollSync.js.map
@@ -1,103 +1,67 @@
1
- import _extends from '@babel/runtime/helpers/esm/extends';
2
- import _classCallCheck from '@babel/runtime/helpers/esm/classCallCheck';
3
- import _createClass from '@babel/runtime/helpers/esm/createClass';
4
- import _assertThisInitialized from '@babel/runtime/helpers/esm/assertThisInitialized';
5
- import _inherits from '@babel/runtime/helpers/esm/inherits';
6
- import _possibleConstructorReturn from '@babel/runtime/helpers/esm/possibleConstructorReturn';
7
- import _getPrototypeOf from '@babel/runtime/helpers/esm/getPrototypeOf';
1
+ import _jsx from '@babel/runtime/helpers/esm/jsx';
8
2
  import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
9
- import React, { Component } from 'react';
3
+ import 'core-js/modules/web.dom-collections.iterator.js';
4
+ import { Component } from 'react';
10
5
  import { ScrollSyncContext } from './ScrollSync.js';
6
+ import { jsx } from 'react/jsx-runtime';
11
7
 
12
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
8
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
13
9
 
14
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
15
- /**
16
- * MODIFIED FROM react-scroll-sync
17
- *
18
- * ScrollSyncPane Component
19
- *
20
- * Wrap your content in it to keep its scroll position in sync with other panes
21
- *
22
- * @param groups
23
- * @example ./example.md
24
- */
10
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
25
11
 
26
- var ScrollSyncPane = /*#__PURE__*/function (_Component) {
27
- _inherits(ScrollSyncPane, _Component);
12
+ class ScrollSyncPane extends Component {
13
+ constructor(...args) {
14
+ super(...args);
28
15
 
29
- var _super = _createSuper(ScrollSyncPane);
30
-
31
- function ScrollSyncPane() {
32
- var _this;
33
-
34
- _classCallCheck(this, ScrollSyncPane);
35
-
36
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
37
- args[_key] = arguments[_key];
38
- }
39
-
40
- _this = _super.call.apply(_super, [this].concat(args));
41
-
42
- _defineProperty(_assertThisInitialized(_this), "toArray", function (groups) {
43
- return [].concat(groups);
44
- });
45
-
46
- return _this;
16
+ _defineProperty(this, "toArray", groups => [].concat(groups));
47
17
  }
48
18
 
49
- _createClass(ScrollSyncPane, [{
50
- key: "componentWillUnmount",
51
- value: function componentWillUnmount() {
52
- var _this$props = this.props,
53
- enabled = _this$props.enabled,
54
- group = _this$props.group,
55
- syncContext = _this$props.syncContext;
56
- var unregisterPane = syncContext.unregisterPane;
57
- if (enabled) unregisterPane(this.node, this.toArray(group));
58
- }
59
- }, {
60
- key: "render",
61
- value: function render() {
62
- var _this2 = this;
63
-
64
- var _this$props2 = this.props,
65
- children = _this$props2.children,
66
- group = _this$props2.group,
67
- syncContext = _this$props2.syncContext,
68
- notPaginated = _this$props2.notPaginated;
69
- var _registerPane = syncContext.registerPane;
70
- return children({
71
- registerPane: function registerPane(node) {
72
- if (notPaginated) {
73
- var virtualizedBody = node.querySelector('.virtualized-body-wrapper');
19
+ componentWillUnmount() {
20
+ const {
21
+ enabled,
22
+ group,
23
+ syncContext
24
+ } = this.props;
25
+ const {
26
+ unregisterPane
27
+ } = syncContext;
28
+ if (enabled) unregisterPane(this.node, this.toArray(group));
29
+ }
74
30
 
75
- if (virtualizedBody) {
76
- _registerPane(virtualizedBody, _this2.toArray(group));
77
- }
31
+ render() {
32
+ const {
33
+ children,
34
+ group,
35
+ syncContext,
36
+ notPaginated
37
+ } = this.props;
38
+ const {
39
+ registerPane
40
+ } = syncContext;
41
+ return children({
42
+ registerPane: node => {
43
+ if (notPaginated) {
44
+ const virtualizedBody = node.querySelector('.virtualized-body-wrapper');
45
+
46
+ if (virtualizedBody) {
47
+ registerPane(virtualizedBody, this.toArray(group));
78
48
  }
79
-
80
- return _registerPane(node, _this2.toArray(group));
81
49
  }
82
- });
83
- }
84
- }]);
85
50
 
86
- return ScrollSyncPane;
87
- }(Component);
51
+ return registerPane(node, this.toArray(group));
52
+ }
53
+ });
54
+ }
55
+
56
+ }
88
57
 
89
58
  _defineProperty(ScrollSyncPane, "defaultProps", {
90
59
  group: 'default',
91
60
  enabled: true
92
61
  });
93
62
 
94
- var ScrollSyncPane$1 = (function (props) {
95
- return /*#__PURE__*/React.createElement(ScrollSyncContext.Consumer, null, function (context) {
96
- return /*#__PURE__*/React.createElement(ScrollSyncPane, _extends({}, props, {
97
- syncContext: context
98
- }));
99
- });
100
- });
63
+ var ScrollSyncPane$1 = (props => /*#__PURE__*/_jsx(ScrollSyncContext.Consumer, {}, void 0, context => /*#__PURE__*/jsx(ScrollSyncPane, _objectSpread(_objectSpread({}, props), {}, {
64
+ syncContext: context
65
+ }))));
101
66
 
102
67
  export { ScrollSyncPane$1 as default };
103
- //# sourceMappingURL=ScrollSyncPane.js.map
@@ -1,35 +1,40 @@
1
+ import _jsx from '@babel/runtime/helpers/esm/jsx';
1
2
  import React from 'react';
2
3
  import raf from 'raf';
3
4
 
4
- var ScrollSyncContext = /*#__PURE__*/React.createContext();
5
- var Provider = ScrollSyncContext.Provider;
6
-
7
- function ScrollSyncProvider(_ref) {
8
- var _this = this;
9
-
10
- _ref.enabled;
11
- _ref.horizontal;
12
- _ref.vertical;
13
- var children = _ref.children;
5
+ const ScrollSyncContext = /*#__PURE__*/React.createContext();
6
+ const {
7
+ Provider
8
+ } = ScrollSyncContext;
9
+
10
+ function ScrollSyncProvider({
11
+ enabled,
12
+ horizontal,
13
+ vertical,
14
+ children
15
+ }) {
14
16
  useRef();
15
17
 
16
- raf(function (scrolledPane, pane) {
17
- var scrollTop = scrolledPane.scrollTop,
18
- scrollHeight = scrolledPane.scrollHeight,
19
- clientHeight = scrolledPane.clientHeight,
20
- scrollLeft = scrolledPane.scrollLeft,
21
- scrollWidth = scrolledPane.scrollWidth,
22
- clientWidth = scrolledPane.clientWidth;
23
- var scrollTopOffset = scrollHeight - clientHeight;
24
- var scrollLeftOffset = scrollWidth - clientWidth;
25
- var _this$props = _this.props,
26
- proportional = _this$props.proportional,
27
- vertical = _this$props.vertical,
28
- horizontal = _this$props.horizontal;
18
+ raf((scrolledPane, pane) => {
19
+ const {
20
+ scrollTop,
21
+ scrollHeight,
22
+ clientHeight,
23
+ scrollLeft,
24
+ scrollWidth,
25
+ clientWidth
26
+ } = scrolledPane;
27
+ const scrollTopOffset = scrollHeight - clientHeight;
28
+ const scrollLeftOffset = scrollWidth - clientWidth;
29
+ const {
30
+ proportional,
31
+ vertical,
32
+ horizontal
33
+ } = this.props;
29
34
  /* Calculate the actual pane height */
30
35
 
31
- var paneHeight = pane.scrollHeight - clientHeight;
32
- var paneWidth = pane.scrollWidth - clientWidth;
36
+ const paneHeight = pane.scrollHeight - clientHeight;
37
+ const paneWidth = pane.scrollWidth - clientWidth;
33
38
  /* Adjust the scrollTop position of it accordingly */
34
39
 
35
40
  if (vertical && scrollTopOffset > 0) {
@@ -40,11 +45,9 @@ function ScrollSyncProvider(_ref) {
40
45
  pane.scrollLeft = proportional ? paneWidth * scrollLeft / scrollLeftOffset : scrollLeft; // eslint-disable-line
41
46
  }
42
47
  });
43
- return /*#__PURE__*/React.createElement(Provider, null, children);
48
+ return /*#__PURE__*/_jsx(Provider, {}, void 0, children);
44
49
  }
45
50
 
46
- ScrollSyncProvider.propTypes = {};
47
51
  ScrollSyncProvider.defaultProps = {};
48
52
 
49
53
  export { ScrollSyncProvider as default };
50
- //# sourceMappingURL=ScrollSyncProvider.js.map
@@ -1,12 +1,2 @@
1
1
  export { default as ScrollSync } from './ScrollSync.js';
2
2
  export { default as ScrollSyncPane } from './ScrollSyncPane.js';
3
- import '@babel/runtime/helpers/esm/classCallCheck';
4
- import '@babel/runtime/helpers/esm/createClass';
5
- import '@babel/runtime/helpers/esm/assertThisInitialized';
6
- import '@babel/runtime/helpers/esm/inherits';
7
- import '@babel/runtime/helpers/esm/possibleConstructorReturn';
8
- import '@babel/runtime/helpers/esm/getPrototypeOf';
9
- import '@babel/runtime/helpers/esm/defineProperty';
10
- import 'react';
11
- import '@babel/runtime/helpers/esm/extends';
12
- //# sourceMappingURL=index.js.map
@@ -6,4 +6,3 @@ useScrollSync.propTypes = {};
6
6
  useScrollSync.defaultProps = {};
7
7
 
8
8
  export { useScrollSync as default };
9
- //# sourceMappingURL=useScrollSync.js.map
package/esm/constants.js CHANGED
@@ -1,6 +1,32 @@
1
- var DEFAULT_DELAY_OPEN = 200;
2
- var DEFAULT_DELAY_CLOSE = 300;
3
- var sizeOptions = ['small', 'medium', 'large', 'x-large'];
1
+ const DEFAULT_DELAY_OPEN = 200;
2
+ const DEFAULT_DELAY_CLOSE = 300;
3
+ const sizeOptions = ['small', 'medium', 'large', 'x-large'];
4
+ const AM = 'am';
5
+ const PM = 'pm';
6
+ const ARROW_UP = 'ArrowUp';
7
+ const ARROW_DOWN = 'ArrowDown';
8
+ const BACKSPACE = 'Backspace';
9
+ const ESCAPE = 'Escape';
10
+ const HOME = 'Home';
11
+ const SHIFT = 'Shift';
12
+ const END = 'End';
13
+ const HOUR_RANGE_12 = {
14
+ min: 0,
15
+ max: 12
16
+ };
17
+ const HOUR_RANGE_24 = {
18
+ min: 0,
19
+ max: 24
20
+ };
21
+ const GENERAL_TIME_RANGE = {
22
+ min: 0,
23
+ max: 59
24
+ };
25
+ const PLACEHOLDER_TIME = {
26
+ hour: 'hour',
27
+ minutes: 'minutes',
28
+ seconds: 'seconds',
29
+ meridiem: 'meridiem'
30
+ };
4
31
 
5
- export { DEFAULT_DELAY_CLOSE, DEFAULT_DELAY_OPEN, sizeOptions };
6
- //# sourceMappingURL=constants.js.map
32
+ export { AM, ARROW_DOWN, ARROW_UP, BACKSPACE, DEFAULT_DELAY_CLOSE, DEFAULT_DELAY_OPEN, END, ESCAPE, GENERAL_TIME_RANGE, HOME, HOUR_RANGE_12, HOUR_RANGE_24, PLACEHOLDER_TIME, PM, SHIFT, sizeOptions };
@@ -1,16 +1,16 @@
1
- import _toConsumableArray from '@babel/runtime/helpers/esm/toConsumableArray';
2
1
  import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
2
+ import 'core-js/modules/web.dom-collections.iterator.js';
3
3
 
4
4
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
5
5
 
6
6
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
7
7
 
8
8
  function getDecoratorsFromHooks(hooks, decorators) {
9
- var nextDecorators = _objectSpread({}, decorators);
9
+ const nextDecorators = _objectSpread({}, decorators);
10
10
 
11
- Object.keys(hooks).forEach(function (decorator) {
11
+ Object.keys(hooks).forEach(decorator => {
12
12
  if (Array.isArray(decorators[decorator])) {
13
- nextDecorators[decorator] = [].concat(_toConsumableArray(decorators[decorator]), [hooks[decorator]]);
13
+ nextDecorators[decorator] = [...decorators[decorator], hooks[decorator]];
14
14
  } else {
15
15
  nextDecorators[decorator] = hooks[decorator];
16
16
  }
@@ -19,10 +19,7 @@ function getDecoratorsFromHooks(hooks, decorators) {
19
19
  }
20
20
 
21
21
  function createInstancePlugin(name, hooks) {
22
- return function (decorators) {
23
- return getDecoratorsFromHooks(hooks, decorators);
24
- };
22
+ return decorators => getDecoratorsFromHooks(hooks, decorators);
25
23
  }
26
24
 
27
25
  export { createInstancePlugin as default };
28
- //# sourceMappingURL=createInstancePlugin.js.map