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