@elliemae/ds-shared 1.60.0 → 2.0.0-alpha.12

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 +19 -27
  2. package/cjs/Animations/Grow.js +17 -22
  3. package/cjs/Animations/GrowRight.js +17 -23
  4. package/cjs/Animations/GrowVertical.js +3 -2
  5. package/cjs/CheckableGroup.js +40 -46
  6. package/cjs/DeferRenderAfterComputation.js +12 -21
  7. package/cjs/FocusGroup/FocusGrid.js +91 -92
  8. package/cjs/FocusGroup/FocusGroup.js +225 -262
  9. package/cjs/FocusGroup/FocusGroupContext.js +1 -2
  10. package/cjs/FocusGroup/FocusGroupManager.js +88 -126
  11. package/cjs/FocusGroup/focusGroupManagerHoc.js +28 -27
  12. package/cjs/FocusGroup/index.js +14 -28
  13. package/cjs/FocusGroup/useFocusGroupItem.js +27 -24
  14. package/cjs/FocusGroup/utils/getNextCellPosition.js +14 -15
  15. package/cjs/GroupContext/Group.js +81 -103
  16. package/cjs/GroupContext/GroupContext.js +1 -2
  17. package/cjs/GroupContext/GroupItem.js +12 -10
  18. package/cjs/GroupContext/index.js +6 -15
  19. package/cjs/ScrollSync/ScrollSync.js +90 -112
  20. package/cjs/ScrollSync/ScrollSyncPane.js +58 -90
  21. package/cjs/ScrollSync/ScrollSyncProvider.js +36 -26
  22. package/cjs/ScrollSync/index.js +4 -13
  23. package/cjs/ScrollSync/useScrollSync.js +0 -1
  24. package/cjs/constants.js +43 -4
  25. package/cjs/createDataInstance/createInstancePlugin.js +11 -10
  26. package/cjs/createDataInstance/createInstanceRef.js +41 -42
  27. package/cjs/createDataInstance/utils.js +56 -58
  28. package/cjs/defer-render-hoc/index.js +26 -61
  29. package/cjs/dimsum.config.js +7 -0
  30. package/cjs/index.js +10 -20
  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 +65 -77
  35. package/cjs/useDataGrid/VolatileRowsListener.js +13 -27
  36. package/cjs/useDataGrid/index.js +2 -17
  37. package/cjs/useDataGrid/initColumnDefinition.js +46 -47
  38. package/cjs/useDataGrid/useDataGrid.js +104 -144
  39. package/cjs/useDataList/index.js +2 -15
  40. package/cjs/useDataList/recordIterator.js +9 -10
  41. package/cjs/useDataList/useDataList.js +51 -59
  42. package/cjs/utils.js +46 -59
  43. package/cjs/virtualization/AutoHeightList.js +31 -22
  44. package/cjs/virtualization/FluidHeightList.js +26 -12
  45. package/cjs/virtualization/index.js +12 -17
  46. package/esm/Animations/BaseAnimation.js +18 -26
  47. package/esm/Animations/Grow.js +15 -20
  48. package/esm/Animations/GrowRight.js +15 -21
  49. package/esm/Animations/GrowVertical.js +3 -2
  50. package/esm/CheckableGroup.js +38 -42
  51. package/esm/DeferRenderAfterComputation.js +12 -20
  52. package/esm/FocusGroup/FocusGrid.js +87 -89
  53. package/esm/FocusGroup/FocusGroup.js +222 -257
  54. package/esm/FocusGroup/FocusGroupContext.js +0 -1
  55. package/esm/FocusGroup/FocusGroupManager.js +82 -114
  56. package/esm/FocusGroup/focusGroupManagerHoc.js +24 -22
  57. package/esm/FocusGroup/index.js +0 -14
  58. package/esm/FocusGroup/useFocusGroupItem.js +25 -22
  59. package/esm/FocusGroup/utils/getNextCellPosition.js +14 -15
  60. package/esm/GroupContext/Group.js +80 -95
  61. package/esm/GroupContext/GroupContext.js +1 -2
  62. package/esm/GroupContext/GroupItem.js +10 -8
  63. package/esm/GroupContext/index.js +0 -9
  64. package/esm/ScrollSync/ScrollSync.js +88 -105
  65. package/esm/ScrollSync/ScrollSyncPane.js +56 -83
  66. package/esm/ScrollSync/ScrollSyncProvider.js +35 -26
  67. package/esm/ScrollSync/index.js +0 -9
  68. package/esm/ScrollSync/useScrollSync.js +0 -1
  69. package/esm/constants.js +31 -5
  70. package/esm/createDataInstance/createInstancePlugin.js +10 -8
  71. package/esm/createDataInstance/createInstanceRef.js +36 -36
  72. package/esm/createDataInstance/utils.js +55 -57
  73. package/esm/defer-render-hoc/index.js +25 -55
  74. package/esm/dimsum.config.js +5 -0
  75. package/esm/index.js +0 -10
  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 +60 -71
  80. package/esm/useDataGrid/VolatileRowsListener.js +14 -23
  81. package/esm/useDataGrid/index.js +0 -15
  82. package/esm/useDataGrid/initColumnDefinition.js +43 -43
  83. package/esm/useDataGrid/useDataGrid.js +90 -127
  84. package/esm/useDataList/index.js +0 -13
  85. package/esm/useDataList/recordIterator.js +9 -10
  86. package/esm/useDataList/useDataList.js +39 -46
  87. package/esm/utils.js +44 -57
  88. package/esm/virtualization/AutoHeightList.js +28 -18
  89. package/esm/virtualization/FluidHeightList.js +24 -10
  90. package/esm/virtualization/index.js +6 -11
  91. package/package.json +201 -8
  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 +5 -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,31 +1,22 @@
1
- import _classCallCheck from '@babel/runtime/helpers/esm/classCallCheck';
2
- import _createClass from '@babel/runtime/helpers/esm/createClass';
1
+ import 'core-js/modules/esnext.async-iterator.for-each.js';
2
+ import 'core-js/modules/esnext.iterator.constructor.js';
3
+ import 'core-js/modules/esnext.iterator.for-each.js';
3
4
  import { safeCall } from '@elliemae/ds-utilities';
4
5
 
5
- var VolatileRowsListener = /*#__PURE__*/function () {
6
- function VolatileRowsListener() {
7
- _classCallCheck(this, VolatileRowsListener);
8
-
6
+ class VolatileRowsListener {
7
+ constructor() {
9
8
  this.observers = [];
10
9
  }
11
10
 
12
- _createClass(VolatileRowsListener, [{
13
- key: "observe",
14
- value: function observe(listener) {
15
- this.observers.push(listener);
16
- }
17
- }, {
18
- key: "notify",
19
- value: function notify(nextRows) {
20
- this.observers.forEach(function (observer) {
21
- return safeCall(observer, nextRows);
22
- });
23
- this.observers = [];
24
- }
25
- }]);
11
+ observe(listener) {
12
+ this.observers.push(listener);
13
+ }
14
+
15
+ notify(nextRows) {
16
+ this.observers.forEach(observer => safeCall(observer, nextRows));
17
+ this.observers = [];
18
+ }
26
19
 
27
- return VolatileRowsListener;
28
- }();
20
+ }
29
21
 
30
22
  export { VolatileRowsListener as default };
31
- //# sourceMappingURL=VolatileRowsListener.js.map
@@ -1,16 +1 @@
1
1
  export { default } from './useDataGrid.js';
2
- import '@babel/runtime/helpers/esm/defineProperty';
3
- import '@babel/runtime/helpers/esm/slicedToArray';
4
- import '@babel/runtime/helpers/esm/objectWithoutProperties';
5
- import '@elliemae/ds-utilities';
6
- import 'react';
7
- import 'uuid';
8
- import 'table-resolver';
9
- import './initColumnDefinition.js';
10
- import '@babel/runtime/helpers/esm/toConsumableArray';
11
- import '../createDataInstance/utils.js';
12
- import './VolatileRowsListener.js';
13
- import '@babel/runtime/helpers/esm/classCallCheck';
14
- import '@babel/runtime/helpers/esm/createClass';
15
- import '../utils.js';
16
- //# sourceMappingURL=index.js.map
@@ -1,6 +1,13 @@
1
- import _toConsumableArray from '@babel/runtime/helpers/esm/toConsumableArray';
1
+ import 'core-js/modules/esnext.async-iterator.filter.js';
2
+ import 'core-js/modules/esnext.iterator.constructor.js';
3
+ import 'core-js/modules/esnext.iterator.filter.js';
4
+ import 'core-js/modules/esnext.async-iterator.for-each.js';
5
+ import 'core-js/modules/esnext.iterator.for-each.js';
6
+ import _jsx from '@babel/runtime/helpers/esm/jsx';
2
7
  import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
3
- import React from 'react';
8
+ import 'core-js/modules/web.dom-collections.iterator.js';
9
+ import 'core-js/modules/es.string.replace.js';
10
+ import 'react';
4
11
  import { v4 } from 'uuid';
5
12
  import { curry, get, cloneDeep, set, isFunction } from '@elliemae/ds-utilities';
6
13
 
@@ -8,18 +15,16 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
8
15
 
9
16
  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; }
10
17
 
11
- var appendHeaderFormatter = curry(function (formatter, column) {
12
- return _objectSpread(_objectSpread({}, column), {}, {
13
- header: _objectSpread(_objectSpread({}, column.header), {}, {
14
- formatters: [].concat(_toConsumableArray(get(column, 'header.formatters', [])), [formatter])
15
- })
16
- });
17
- });
18
- var appendCellFormatter = curry(function (formatter, column) {
19
- var path = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'formatters';
20
- var nextColumn = cloneDeep(column);
21
- var formatters = get(nextColumn, ['cell', path], []);
22
- var scrollingFormatters = get(nextColumn, 'cell.scrollingFormatters', []);
18
+ const appendHeaderFormatter = curry((formatter, column) => _objectSpread(_objectSpread({}, column), {}, {
19
+ header: _objectSpread(_objectSpread({}, column.header), {}, {
20
+ formatters: [...get(column, 'header.formatters', []), formatter]
21
+ })
22
+ }));
23
+ const appendCellFormatter = curry(function (formatter, column) {
24
+ let path = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'formatters';
25
+ const nextColumn = cloneDeep(column);
26
+ const formatters = get(nextColumn, ['cell', path], []);
27
+ const scrollingFormatters = get(nextColumn, 'cell.scrollingFormatters', []);
23
28
 
24
29
  if (Array.isArray(formatter)) {
25
30
  if (formatter[1]) scrollingFormatters.push(formatter[1]);
@@ -33,15 +38,15 @@ var appendCellFormatter = curry(function (formatter, column) {
33
38
  set(nextColumn, 'cell.scrollingFormatters', scrollingFormatters);
34
39
  return nextColumn;
35
40
  });
36
- var defaultColumnDefinitionOptions = {
41
+ const defaultColumnDefinitionOptions = {
37
42
  normalize: false,
38
43
  useTextTruncation: true,
39
44
  isUserColumn: true,
40
45
  visible: true
41
46
  };
42
- var mergeClassNameToColumnHeader = curry(function (className, column) {
43
- var headerProps = get(column, ['header', 'props'], {});
44
- var headerClassName = headerProps.className || '';
47
+ const mergeClassNameToColumnHeader = curry((className, column) => {
48
+ const headerProps = get(column, ['header', 'props'], {});
49
+ const headerClassName = headerProps.className || '';
45
50
  return _objectSpread(_objectSpread({}, column), {}, {
46
51
  header: _objectSpread(_objectSpread({}, column.header), {}, {
47
52
  props: _objectSpread(_objectSpread({}, headerProps), {}, {
@@ -51,9 +56,9 @@ var mergeClassNameToColumnHeader = curry(function (className, column) {
51
56
  });
52
57
  });
53
58
  function initColumnDefinition() {
54
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
59
+ let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
55
60
  // eslint-disable-next-line complexity
56
- return function (column) {
61
+ return column => {
57
62
  // todo: clean this
58
63
  if (column.type === 'number') {
59
64
  // eslint-disable-next-line no-param-reassign
@@ -62,12 +67,12 @@ function initColumnDefinition() {
62
67
  };
63
68
  }
64
69
 
65
- var _defaultColumnDefinit = _objectSpread(_objectSpread({}, defaultColumnDefinitionOptions), options),
66
- _defaultColumnDefinit2 = _defaultColumnDefinit.useTextTruncation,
67
- useTextTruncation = _defaultColumnDefinit2 === void 0 ? true : _defaultColumnDefinit2,
68
- isUserColumn = _defaultColumnDefinit.isUserColumn,
69
- visible = _defaultColumnDefinit.visible,
70
- normalize = _defaultColumnDefinit.normalize;
70
+ const {
71
+ useTextTruncation = true,
72
+ isUserColumn,
73
+ visible,
74
+ normalize
75
+ } = _objectSpread(_objectSpread({}, defaultColumnDefinitionOptions), options);
71
76
 
72
77
  if (normalize) {
73
78
  // eslint-disable-next-line no-param-reassign
@@ -83,39 +88,35 @@ function initColumnDefinition() {
83
88
 
84
89
  column.header = _objectSpread(_objectSpread({}, column.header), {}, {
85
90
  label: column.label,
86
- formatters: _toConsumableArray(get(column, ['header', 'formatters'], [])),
91
+ formatters: [...get(column, ['header', 'formatters'], [])],
87
92
  props: {
88
93
  style: column.headerStyle || {}
89
94
  }
90
95
  });
91
96
 
92
97
  if (useTextTruncation && !(isFunction(column.customHeaderRenderer) || column.header.formatters.length)) {
93
- column.header.formatters.push(function (value) {
94
- return /*#__PURE__*/React.createElement("span", {
95
- className: "cell-value"
96
- }, value);
97
- });
98
+ column.header.formatters.push(value => /*#__PURE__*/_jsx("span", {
99
+ className: "cell-value"
100
+ }, void 0, value));
98
101
  } // eslint-disable-next-line no-param-reassign
99
102
 
100
103
 
101
104
  column.cell = _objectSpread(_objectSpread({}, column.cell), {}, {
102
105
  transforms: [],
103
- formatters: _toConsumableArray(get(column, ['cell', 'formatters'], [])),
104
- scrollingFormatters: _toConsumableArray(get(column, ['cell', 'formatters'], [])),
106
+ formatters: [...get(column, ['cell', 'formatters'], [])],
107
+ scrollingFormatters: [...get(column, ['cell', 'formatters'], [])],
105
108
  props: {
106
109
  style: column.cellStyle || {}
107
110
  }
108
111
  });
109
112
 
110
113
  if (useTextTruncation && !(isFunction(column.customRenderer) || column.cell.formatters.length)) {
111
- column.cell.formatters.push(function (value) {
112
- return /*#__PURE__*/React.createElement("span", {
113
- className: "cell-value",
114
- style: {
115
- justifyContent: column.type === 'number' ? 'flex-end' : 'flex-start'
116
- }
117
- }, value);
118
- });
114
+ column.cell.formatters.push(value => /*#__PURE__*/_jsx("span", {
115
+ className: "cell-value",
116
+ style: {
117
+ justifyContent: column.type === 'number' ? 'flex-end' : 'flex-start'
118
+ }
119
+ }, void 0, value));
119
120
  } // eslint-disable-next-line no-param-reassign
120
121
 
121
122
 
@@ -131,4 +132,3 @@ function initColumnDefinition() {
131
132
  }
132
133
 
133
134
  export { appendCellFormatter, appendHeaderFormatter, initColumnDefinition as default, mergeClassNameToColumnHeader };
134
- //# sourceMappingURL=initColumnDefinition.js.map
@@ -1,6 +1,15 @@
1
1
  import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
2
- import _slicedToArray from '@babel/runtime/helpers/esm/slicedToArray';
3
2
  import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
3
+ import 'core-js/modules/web.dom-collections.iterator.js';
4
+ import 'core-js/modules/esnext.async-iterator.map.js';
5
+ import 'core-js/modules/esnext.iterator.map.js';
6
+ import 'core-js/modules/esnext.async-iterator.for-each.js';
7
+ import 'core-js/modules/esnext.iterator.constructor.js';
8
+ import 'core-js/modules/esnext.iterator.for-each.js';
9
+ import 'core-js/modules/esnext.async-iterator.reduce.js';
10
+ import 'core-js/modules/esnext.iterator.reduce.js';
11
+ import 'core-js/modules/esnext.async-iterator.filter.js';
12
+ import 'core-js/modules/esnext.iterator.filter.js';
4
13
  import { useDerivedStateFromProps, compose, cloneDeep, usePrevious, isObject, isEqual, setRef } from '@elliemae/ds-utilities';
5
14
  import { useRef, useState, useMemo } from 'react';
6
15
  import { v4 } from 'uuid';
@@ -9,87 +18,60 @@ import initColumnDefinition from './initColumnDefinition.js';
9
18
  import { applyDecorators, decorateColumns, reducePropsGetter } from '../createDataInstance/utils.js';
10
19
  import VolatileRowsListener from './VolatileRowsListener.js';
11
20
  import { isInternetExplorer } from '../utils.js';
12
- import '@babel/runtime/helpers/esm/toConsumableArray';
13
- import '@babel/runtime/helpers/esm/classCallCheck';
14
- import '@babel/runtime/helpers/esm/createClass';
15
21
 
16
- var _excluded = ["uuid", "plugins", "rows", "columns", "renderers"];
22
+ const _excluded = ["uuid", "plugins", "rows", "columns", "renderers"];
17
23
 
18
24
  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; }
19
25
 
20
26
  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; }
21
- var IS_INTERNET_EXPLORER = isInternetExplorer(); // TODO: Reuse createDataInstance for the grid the same
27
+ const IS_INTERNET_EXPLORER = isInternetExplorer(); // TODO: Reuse createDataInstance for the grid the same
22
28
  // way as the list does ex: packages/ds-shared/src/useDataList/useDataList.js
23
29
  // eslint-disable-next-line max-statements
24
30
 
25
31
  function useDataGrid(_ref) {
26
- var uuidProp = _ref.uuid,
27
- pluginsFromProps = _ref.plugins,
28
- rows = _ref.rows,
29
- columns = _ref.columns,
30
- _ref$renderers = _ref.renderers,
31
- renderers = _ref$renderers === void 0 ? {} : _ref$renderers,
32
+ let {
33
+ uuid: uuidProp,
34
+ plugins: pluginsFromProps,
35
+ rows,
36
+ columns,
37
+ renderers = {}
38
+ } = _ref,
32
39
  props = _objectWithoutProperties(_ref, _excluded);
33
40
 
34
- var plugins = pluginsFromProps;
35
- var instance = useRef();
36
- var tableRef = useRef();
37
- var headerRef = useRef();
38
- var bodyRef = useRef();
39
- var bodyInnerRef = useRef();
40
-
41
- var _useState = useState(uuidProp || function () {
42
- return v4();
43
- }),
44
- _useState2 = _slicedToArray(_useState, 1),
45
- uuid = _useState2[0];
46
-
47
- var _useState3 = useState(false),
48
- _useState4 = _slicedToArray(_useState3, 2),
49
- hasScroll = _useState4[0],
50
- setHasScroll = _useState4[1];
51
-
52
- var _useState5 = useState(false),
53
- _useState6 = _slicedToArray(_useState5, 2),
54
- isRowDragging = _useState6[0],
55
- setIsRowDragging = _useState6[1];
56
-
57
- var isScrolling = useRef();
58
- var shouldRefocus = useRef(); // todo: we probably need a plugin for focus related stuff
59
-
60
- var _useState7 = useState(function () {
61
- return new VolatileRowsListener();
62
- }),
63
- _useState8 = _slicedToArray(_useState7, 1),
64
- RowsObserver = _useState8[0]; // todo move this with rows composition
65
-
66
-
67
- var _useDerivedStateFromP = useDerivedStateFromProps(rows, {
41
+ const plugins = pluginsFromProps;
42
+ const instance = useRef();
43
+ const tableRef = useRef();
44
+ const headerRef = useRef();
45
+ const bodyRef = useRef();
46
+ const bodyInnerRef = useRef();
47
+ const [uuid] = useState(uuidProp || (() => v4()));
48
+ const [hasScroll, setHasScroll] = useState(false);
49
+ const [isRowDragging, setIsRowDragging] = useState(false);
50
+ const isScrolling = useRef();
51
+ const shouldRefocus = useRef(); // todo: we probably need a plugin for focus related stuff
52
+
53
+ const [RowsObserver] = useState(() => new VolatileRowsListener()); // todo move this with rows composition
54
+
55
+ const [originalRows, updateRows] = useDerivedStateFromProps(rows, {
68
56
  onUpdate: resolve.resolve({
69
- columns: columns,
70
- method: function method(extra) {
71
- return compose(resolve.byFunction('valueTransformation')(extra), resolve.nested(extra));
72
- }
57
+ columns,
58
+ method: extra => compose(resolve.byFunction('valueTransformation')(extra), resolve.nested(extra))
73
59
  }),
74
60
  updateOnStateChange: true
75
- }),
76
- _useDerivedStateFromP2 = _slicedToArray(_useDerivedStateFromP, 2),
77
- originalRows = _useDerivedStateFromP2[0],
78
- updateRows = _useDerivedStateFromP2[1];
79
-
61
+ });
80
62
  instance.current = {
81
63
  decoratedRenderers: cloneDeep(renderers),
82
64
  decoratedColumns: columns,
83
- columns: columns,
84
- rows: rows,
65
+ columns,
66
+ rows,
85
67
  composedRows: originalRows,
86
68
  getRowProps: [],
87
69
  getHeaderRowProps: [],
88
70
  getBodyProps: [],
89
71
  getTableProps: [],
90
72
  effects: [],
91
- uuid: uuid,
92
- props: props,
73
+ uuid,
74
+ props,
93
75
  refs: {
94
76
  table: tableRef,
95
77
  body: bodyRef,
@@ -97,54 +79,40 @@ function useDataGrid(_ref) {
97
79
  innerBody: bodyInnerRef
98
80
  },
99
81
  state: {
100
- hasScroll: hasScroll
82
+ hasScroll
101
83
  },
102
84
  actions: {
103
- updateRows: updateRows
85
+ updateRows
104
86
  },
105
- updateRows: updateRows,
87
+ updateRows,
106
88
  // eslint-disable-next-line no-return-assign
107
- enableEvents: function enableEvents() {
108
- return document.body.style.pointerEvents = IS_INTERNET_EXPLORER ? '' : null;
109
- },
89
+ enableEvents: () => document.body.style.pointerEvents = IS_INTERNET_EXPLORER ? '' : null,
110
90
  // eslint-disable-next-line no-return-assign
111
- disableEvents: function disableEvents() {
112
- return document.body.style.pointerEvents = 'none';
113
- },
114
- observeRows: function observeRows(observer) {
115
- return RowsObserver.observe(observer);
116
- },
91
+ disableEvents: () => document.body.style.pointerEvents = 'none',
92
+ observeRows: observer => RowsObserver.observe(observer),
117
93
  hotKeys: {},
118
- shouldRefocus: shouldRefocus,
119
- isScrolling: isScrolling,
120
- setHasScroll: setHasScroll,
121
- setIsRowDragging: setIsRowDragging,
122
- isRowDragging: isRowDragging,
123
- plugins: plugins
94
+ shouldRefocus,
95
+ isScrolling,
96
+ setHasScroll,
97
+ setIsRowDragging,
98
+ isRowDragging,
99
+ plugins
124
100
  };
125
101
 
126
- instance.current.getState = function () {
127
- return instance.current.state;
128
- };
102
+ instance.current.getState = () => instance.current.state;
129
103
 
130
- instance.current.getInstance = function () {
131
- return instance.current;
132
- };
104
+ instance.current.getInstance = () => instance.current;
133
105
 
134
- var defaultDecorators = {
106
+ const defaultDecorators = {
135
107
  decorateGrid: [],
136
108
  registerStateHook: [],
137
109
  registerHotKeys: [],
138
110
  decorateColumn: [],
139
- decorateColumns: [function (cols) {
140
- return cols.map(function (col) {
141
- return initColumnDefinition({
142
- useTextTruncation: col.useTextTruncation,
143
- wrapText: props.wrapText,
144
- normalize: props.normalizeDataKeys
145
- })(col);
146
- });
147
- }],
111
+ decorateColumns: [cols => cols.map(col => initColumnDefinition({
112
+ useTextTruncation: col.useTextTruncation,
113
+ wrapText: props.wrapText,
114
+ normalize: props.normalizeDataKeys
115
+ })(col))],
148
116
  decorateRenderers: [],
149
117
  getRowProps: [],
150
118
  getHeaderRowProps: [],
@@ -153,42 +121,42 @@ function useDataGrid(_ref) {
153
121
  getHeaderProps: [],
154
122
  composeRows: []
155
123
  };
156
- var decorators = useMemo(function () {
157
- var nextDecorators = defaultDecorators; // eslint-disable-next-line no-return-assign
124
+ const decorators = useMemo(() => {
125
+ let nextDecorators = defaultDecorators; // eslint-disable-next-line no-return-assign
158
126
 
159
- plugins.forEach(function (plugin) {
160
- return nextDecorators = plugin(nextDecorators);
161
- });
127
+ plugins.forEach(plugin => nextDecorators = plugin(nextDecorators));
162
128
  return nextDecorators;
163
129
  }, [plugins]);
164
- instance.current = decorators.decorateGrid.reduce(function (nextInstance, decorator) {
165
- return _objectSpread(_objectSpread({}, nextInstance), decorator(instance.current));
166
- }, instance.current);
167
- instance.current = decorators.registerStateHook.reduce(function (nextInstance, decorator) {
168
- var _decorator = decorator(instance.current),
169
- state = _decorator.state,
170
- actions = _decorator.actions;
171
-
130
+ instance.current = decorators.decorateGrid.reduce((nextInstance, decorator) => _objectSpread(_objectSpread({}, nextInstance), decorator(instance.current)), instance.current);
131
+ instance.current = decorators.registerStateHook.reduce((nextInstance, decorator) => {
132
+ const {
133
+ state,
134
+ actions
135
+ } = decorator(instance.current);
172
136
  return _objectSpread(_objectSpread({}, nextInstance), {}, {
173
137
  state: _objectSpread(_objectSpread({}, nextInstance.state), state),
174
138
  actions: _objectSpread(_objectSpread({}, nextInstance.actions), actions)
175
139
  });
176
140
  }, instance.current);
177
141
 
178
- var reduceHotKey = function reduceHotKey(nextInstance, _ref2) {
179
- var key = _ref2.key,
180
- handler = _ref2.handler,
181
- options = _ref2.options;
142
+ const reduceHotKey = (nextInstance, _ref2) => {
143
+ let {
144
+ key,
145
+ handler,
146
+ options
147
+ } = _ref2;
182
148
  return _objectSpread(_objectSpread({}, nextInstance), {}, {
183
- hotKeys: _objectSpread(_objectSpread({}, nextInstance.hotKeys), {}, _defineProperty({}, key, {
184
- handler: handler,
185
- options: options
186
- }))
149
+ hotKeys: _objectSpread(_objectSpread({}, nextInstance.hotKeys), {}, {
150
+ [key]: {
151
+ handler,
152
+ options
153
+ }
154
+ })
187
155
  });
188
156
  };
189
157
 
190
- instance.current = decorators.registerHotKeys.reduce(function (nextInstance, decorator) {
191
- var hotKeys = decorator(nextInstance);
158
+ instance.current = decorators.registerHotKeys.reduce((nextInstance, decorator) => {
159
+ const hotKeys = decorator(nextInstance);
192
160
 
193
161
  if (Array.isArray(hotKeys)) {
194
162
  return hotKeys.reduce(reduceHotKey, nextInstance);
@@ -197,10 +165,8 @@ function useDataGrid(_ref) {
197
165
  return reduceHotKey(nextInstance, hotKeys);
198
166
  }, instance.current);
199
167
  instance.current.decoratedRenderers = applyDecorators(instance.current.decoratedRenderers, decorators.decorateRenderers, instance.current);
200
- instance.current.decoratedColumns = useMemo(function () {
201
- var visibleColumns = cloneDeep(columns).filter(function (column) {
202
- return typeof column.visible === 'undefined' || column.visible;
203
- });
168
+ instance.current.decoratedColumns = useMemo(() => {
169
+ const visibleColumns = cloneDeep(columns).filter(column => typeof column.visible === 'undefined' || column.visible);
204
170
  return visibleColumns.length ? decorateColumns(visibleColumns, decorators, instance.current) : [];
205
171
  }, [columns]);
206
172
  instance.current.getBodyProps = reducePropsGetter(decorators.getBodyProps, instance.current);
@@ -208,12 +174,10 @@ function useDataGrid(_ref) {
208
174
  instance.current.getRowProps = reducePropsGetter(decorators.getRowProps, instance.current);
209
175
  instance.current.getHeaderRowProps = reducePropsGetter(decorators.getHeaderRowProps, instance.current);
210
176
  instance.current.getTableProps = reducePropsGetter(decorators.getTableProps, instance.current);
211
- instance.current.composedRows = decorators.composeRows.reduce(function (nextRows, getter) {
212
- return getter(nextRows, instance.current);
213
- }, instance.current.composedRows);
177
+ instance.current.composedRows = decorators.composeRows.reduce((nextRows, getter) => getter(nextRows, instance.current), instance.current.composedRows);
214
178
  RowsObserver.notify(instance.current.composedRows);
215
- var currentShouldRefocus = instance.current.shouldRefocus.current;
216
- var prevState = usePrevious(instance.current.state);
179
+ const currentShouldRefocus = instance.current.shouldRefocus.current;
180
+ const prevState = usePrevious(instance.current.state);
217
181
 
218
182
  if (isObject(currentShouldRefocus) && currentShouldRefocus.forced) {
219
183
  instance.current.shouldRefocus.current = currentShouldRefocus.value;
@@ -223,9 +187,8 @@ function useDataGrid(_ref) {
223
187
 
224
188
  if (props.instanceRef) setRef(props.instanceRef, instance.current);
225
189
  return _objectSpread(_objectSpread({}, instance.current), {}, {
226
- decorators: decorators
190
+ decorators
227
191
  });
228
192
  }
229
193
 
230
194
  export { useDataGrid as default };
231
- //# sourceMappingURL=useDataGrid.js.map
@@ -1,14 +1 @@
1
1
  export { default } from './useDataList.js';
2
- import '@babel/runtime/helpers/esm/toConsumableArray';
3
- import '@babel/runtime/helpers/esm/defineProperty';
4
- import '@babel/runtime/helpers/esm/objectWithoutProperties';
5
- import 'react';
6
- import '@elliemae/ds-utilities';
7
- import 'lodash/get';
8
- import '../createDataInstance/utils.js';
9
- import './recordIterator.js';
10
- import '../createDataInstance/createInstanceRef.js';
11
- import '@babel/runtime/helpers/esm/slicedToArray';
12
- import 'uuid';
13
- import 'lodash';
14
- //# sourceMappingURL=index.js.map
@@ -1,28 +1,27 @@
1
- var defaultStrategy = function defaultStrategy() {
1
+ const defaultStrategy = () => {
2
2
  throw Error('Implement an iterator strategy for record iterator');
3
3
  };
4
4
 
5
5
  function recordIterator(records) {
6
- var strategy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultStrategy;
7
- var decorators = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
8
- var instance = arguments.length > 3 ? arguments[3] : undefined;
9
- var nextRows = [];
6
+ let strategy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultStrategy;
7
+ let decorators = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
8
+ let instance = arguments.length > 3 ? arguments[3] : undefined;
9
+ const nextRows = [];
10
10
  strategy({
11
11
  data: records,
12
- cb: function cb(row) {
13
- var nextRow = row; // eslint-disable-next-line no-loops/no-loops,no-plusplus
12
+ cb: row => {
13
+ let nextRow = row; // eslint-disable-next-line no-loops/no-loops,no-plusplus
14
14
 
15
- for (var i = 0; i < decorators.length; i++) {
15
+ for (let i = 0; i < decorators.length; i++) {
16
16
  nextRow = decorators[i](nextRow, instance);
17
17
  if (!nextRow) break;
18
18
  }
19
19
 
20
20
  if (nextRow) nextRows.push(nextRow);
21
21
  },
22
- instance: instance
22
+ instance
23
23
  });
24
24
  return nextRows;
25
25
  }
26
26
 
27
27
  export { recordIterator };
28
- //# sourceMappingURL=recordIterator.js.map