@elliemae/ds-datagrids 2.0.0-next.7 → 2.0.0-rc.2

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 (198) hide show
  1. package/cjs/DSDataGrid.js +246 -243
  2. package/cjs/DataGridImpl.js +16 -8
  3. package/cjs/PaginatedDataGrid.js +5 -0
  4. package/cjs/columns/IconColumn.js +19 -17
  5. package/cjs/columns/NumberColumn.js +2 -4
  6. package/cjs/components/BodyCell.js +17 -10
  7. package/cjs/components/BodyList.js +7 -0
  8. package/cjs/components/ColumnVisibilityMenuOption.js +10 -6
  9. package/cjs/components/ColumnsOptionsMenuSection.js +34 -28
  10. package/cjs/components/EmptyState.js +19 -17
  11. package/cjs/components/HeaderCell.js +14 -8
  12. package/cjs/components/List.js +5 -0
  13. package/cjs/components/ListItem.js +7 -0
  14. package/cjs/components/NoResults.js +5 -0
  15. package/cjs/components/RowsLoader.js +5 -4
  16. package/cjs/components/Table.js +5 -0
  17. package/cjs/components/TableBody.js +5 -0
  18. package/cjs/components/TableHeader.js +5 -0
  19. package/cjs/components/footer/addOptionalFooterComponents.js +5 -4
  20. package/cjs/components/header/PrimaryControls.js +20 -15
  21. package/cjs/components/header/addOptionalHeaderComponents.js +4 -3
  22. package/cjs/components/renderers/defaultClassedRenderers.js +33 -21
  23. package/cjs/plugins/body-header-scroll-sync/BodyHeaderScrollSyncPlugin.js +46 -35
  24. package/cjs/plugins/column-dnd/DndColumnsPlugin.js +9 -5
  25. package/cjs/plugins/column-dnd/decorateGridWithDndColumns.js +2 -3
  26. package/cjs/plugins/column-sizing/ColumnSizingPlugin.js +10 -8
  27. package/cjs/plugins/column-sizing/columnMeasurerTransformer.js +13 -6
  28. package/cjs/plugins/column-sizing/ext-points/decorateColumn.js +3 -3
  29. package/cjs/plugins/column-sizing/ext-points/getTableProps.js +22 -17
  30. package/cjs/plugins/column-sizing/useColumnSizeService.js +9 -0
  31. package/cjs/plugins/column-sizing/useStylesheetHelpers.js +56 -40
  32. package/cjs/plugins/column-sizing/utils.js +10 -6
  33. package/cjs/plugins/custom-cell-renderer/addCustomRendererToCell.js +9 -4
  34. package/cjs/plugins/custom-cell-renderer/getRendererComponent.js +20 -21
  35. package/cjs/plugins/editable/EditableComponents/ComboBox.js +7 -3
  36. package/cjs/plugins/editable/EditableComponents/TextBox.js +20 -14
  37. package/cjs/plugins/editable/EditablePlugin.js +15 -15
  38. package/cjs/plugins/editable/decorateEditable.js +18 -11
  39. package/cjs/plugins/editable/getEditorComponent.js +45 -34
  40. package/cjs/plugins/expandable-grid/ExpandableColumn.js +57 -50
  41. package/cjs/plugins/expandable-grid/ExpandablePlugin.js +37 -26
  42. package/cjs/plugins/expandable-grid/ExpandedRow.js +28 -18
  43. package/cjs/plugins/expandable-grid/ExpandedRowExtra.js +16 -10
  44. package/cjs/plugins/expandable-grid/useExpandGridState.js +3 -8
  45. package/cjs/plugins/export-data/ExportDataPlugin.js +23 -10
  46. package/cjs/plugins/filterable/FilterablePlugin.js +7 -6
  47. package/cjs/plugins/filterable/addFilterToColumn.js +5 -0
  48. package/cjs/plugins/filterable/components/FilterableHeader.js +35 -27
  49. package/cjs/plugins/filterable/components/filterable-menus/DateRangeFilterMenu.js +38 -32
  50. package/cjs/plugins/filterable/components/filterable-menus/SingleDateFilterMenu.js +26 -22
  51. package/cjs/plugins/filterable/components/filterable-menus/SingleRangeSwitcherMenu.js +119 -154
  52. package/cjs/plugins/filterable/components/filterable-menus/TextFilterMenu.js +28 -20
  53. package/cjs/plugins/filterable/filterableFormatter.js +15 -10
  54. package/cjs/plugins/filterable/filtering-helper/filterRowsByQuery.js +16 -4
  55. package/cjs/plugins/filterable/filtering-helper/strategiesOperators.js +7 -4
  56. package/cjs/plugins/filterable/helper.js +16 -7
  57. package/cjs/plugins/filterable/useFilterableState.js +11 -5
  58. package/cjs/plugins/grouping-by/GroupingByPlugin.js +2 -0
  59. package/cjs/plugins/grouping-grid/GroupingPlugin.js +9 -0
  60. package/cjs/plugins/grouping-grid/walkStrategy.js +11 -9
  61. package/cjs/plugins/infinite-scrolling/InfiniteScrollPlugin.js +7 -1
  62. package/cjs/plugins/pagination/PaginationPlugin.js +9 -2
  63. package/cjs/plugins/pagination/components/Pagination.js +10 -9
  64. package/cjs/plugins/pagination/components/Paginator.js +8 -7
  65. package/cjs/plugins/pagination/components/PerPageDropdown.js +20 -13
  66. package/cjs/plugins/pagination/helper.js +10 -7
  67. package/cjs/plugins/pagination/usePaginationState.js +7 -3
  68. package/cjs/plugins/resizable/ResizablePlugin.js +5 -4
  69. package/cjs/plugins/resizable/decorateResizable.js +14 -8
  70. package/cjs/plugins/resizable/useResizeHandle.js +21 -16
  71. package/cjs/plugins/resizable/utils.js +8 -5
  72. package/cjs/plugins/row-dnd/DndRowsPlugin.js +23 -16
  73. package/cjs/plugins/selectable/SelectablePlugin.js +10 -8
  74. package/cjs/plugins/selectable/addSelectableColumn.js +24 -16
  75. package/cjs/plugins/selectable/helper.js +12 -3
  76. package/cjs/plugins/selectable/selectableFormatter.js +80 -71
  77. package/cjs/plugins/selectable/useSelectableState.js +24 -11
  78. package/cjs/plugins/sortable/SortablePlugin.js +8 -7
  79. package/cjs/plugins/sortable/sortHeaderFormatter.js +14 -15
  80. package/cjs/plugins/sortable/sortTree.js +13 -3
  81. package/cjs/plugins/sortable/sorter.js +151 -134
  82. package/cjs/plugins/sortable/useSortableState.js +7 -0
  83. package/cjs/plugins/toolbar/RowRenderer.js +7 -2
  84. package/cjs/plugins/toolbar/ToolbarTrigger.js +15 -10
  85. package/cjs/plugins/virtualization/AutoHeightList.js +10 -8
  86. package/cjs/plugins/virtualization/VirtualizationPlugin.js +32 -25
  87. package/cjs/plugins/virtualization/VirtualizedBody.js +18 -9
  88. package/cjs/plugins/virtualization/VirtualizedBodyRow.js +8 -7
  89. package/cjs/renders/CellWithAddons.js +20 -18
  90. package/cjs/renders/styled.js +3 -2
  91. package/cjs/utilities/getPluginsFromProps.js +5 -1
  92. package/cjs/utilities/getScrollbarSize.js +2 -1
  93. package/cjs/utilities/normalizeData.js +7 -1
  94. package/esm/DSDataGrid.js +246 -243
  95. package/esm/DataGridImpl.js +16 -8
  96. package/esm/PaginatedDataGrid.js +5 -0
  97. package/esm/columns/IconColumn.js +18 -16
  98. package/esm/columns/NumberColumn.js +2 -4
  99. package/esm/components/BodyCell.js +17 -10
  100. package/esm/components/BodyList.js +7 -0
  101. package/esm/components/ColumnVisibilityMenuOption.js +10 -6
  102. package/esm/components/ColumnsOptionsMenuSection.js +34 -28
  103. package/esm/components/EmptyState.js +18 -15
  104. package/esm/components/HeaderCell.js +14 -8
  105. package/esm/components/List.js +5 -0
  106. package/esm/components/ListItem.js +7 -0
  107. package/esm/components/NoResults.js +5 -0
  108. package/esm/components/RowsLoader.js +5 -4
  109. package/esm/components/Table.js +5 -0
  110. package/esm/components/TableBody.js +5 -0
  111. package/esm/components/TableHeader.js +5 -0
  112. package/esm/components/footer/addOptionalFooterComponents.js +5 -4
  113. package/esm/components/header/PrimaryControls.js +20 -14
  114. package/esm/components/header/addOptionalHeaderComponents.js +4 -3
  115. package/esm/components/renderers/defaultClassedRenderers.js +33 -21
  116. package/esm/plugins/body-header-scroll-sync/BodyHeaderScrollSyncPlugin.js +46 -35
  117. package/esm/plugins/column-dnd/DndColumnsPlugin.js +6 -2
  118. package/esm/plugins/column-dnd/decorateGridWithDndColumns.js +1 -1
  119. package/esm/plugins/column-sizing/ColumnSizingPlugin.js +9 -7
  120. package/esm/plugins/column-sizing/columnMeasurerTransformer.js +12 -5
  121. package/esm/plugins/column-sizing/ext-points/decorateColumn.js +1 -1
  122. package/esm/plugins/column-sizing/ext-points/getTableProps.js +21 -15
  123. package/esm/plugins/column-sizing/useColumnSizeService.js +9 -0
  124. package/esm/plugins/column-sizing/useStylesheetHelpers.js +54 -38
  125. package/esm/plugins/column-sizing/utils.js +8 -4
  126. package/esm/plugins/custom-cell-renderer/addCustomRendererToCell.js +6 -1
  127. package/esm/plugins/custom-cell-renderer/getRendererComponent.js +15 -11
  128. package/esm/plugins/editable/EditableComponents/ComboBox.js +6 -1
  129. package/esm/plugins/editable/EditableComponents/TextBox.js +19 -12
  130. package/esm/plugins/editable/EditablePlugin.js +13 -12
  131. package/esm/plugins/editable/decorateEditable.js +16 -8
  132. package/esm/plugins/editable/getEditorComponent.js +49 -38
  133. package/esm/plugins/expandable-grid/ExpandableColumn.js +56 -47
  134. package/esm/plugins/expandable-grid/ExpandablePlugin.js +33 -20
  135. package/esm/plugins/expandable-grid/ExpandedRow.js +27 -17
  136. package/esm/plugins/expandable-grid/ExpandedRowExtra.js +15 -9
  137. package/esm/plugins/expandable-grid/useExpandGridState.js +1 -2
  138. package/esm/plugins/export-data/ExportDataPlugin.js +22 -9
  139. package/esm/plugins/filterable/FilterablePlugin.js +5 -4
  140. package/esm/plugins/filterable/addFilterToColumn.js +5 -0
  141. package/esm/plugins/filterable/components/FilterableHeader.js +31 -22
  142. package/esm/plugins/filterable/components/filterable-menus/DateRangeFilterMenu.js +38 -31
  143. package/esm/plugins/filterable/components/filterable-menus/SingleDateFilterMenu.js +26 -21
  144. package/esm/plugins/filterable/components/filterable-menus/SingleRangeSwitcherMenu.js +118 -152
  145. package/esm/plugins/filterable/components/filterable-menus/TextFilterMenu.js +27 -18
  146. package/esm/plugins/filterable/filterableFormatter.js +15 -10
  147. package/esm/plugins/filterable/filtering-helper/filterRowsByQuery.js +14 -2
  148. package/esm/plugins/filterable/filtering-helper/strategiesOperators.js +7 -4
  149. package/esm/plugins/filterable/helper.js +10 -1
  150. package/esm/plugins/filterable/useFilterableState.js +11 -5
  151. package/esm/plugins/grouping-by/GroupingByPlugin.js +2 -0
  152. package/esm/plugins/grouping-grid/GroupingPlugin.js +9 -0
  153. package/esm/plugins/grouping-grid/walkStrategy.js +11 -9
  154. package/esm/plugins/infinite-scrolling/InfiniteScrollPlugin.js +7 -1
  155. package/esm/plugins/pagination/PaginationPlugin.js +8 -1
  156. package/esm/plugins/pagination/components/Pagination.js +10 -9
  157. package/esm/plugins/pagination/components/Paginator.js +8 -7
  158. package/esm/plugins/pagination/components/PerPageDropdown.js +17 -9
  159. package/esm/plugins/pagination/helper.js +10 -7
  160. package/esm/plugins/pagination/usePaginationState.js +6 -1
  161. package/esm/plugins/resizable/ResizablePlugin.js +4 -3
  162. package/esm/plugins/resizable/decorateResizable.js +14 -8
  163. package/esm/plugins/resizable/useResizeHandle.js +21 -16
  164. package/esm/plugins/resizable/utils.js +6 -3
  165. package/esm/plugins/row-dnd/DndRowsPlugin.js +21 -13
  166. package/esm/plugins/selectable/SelectablePlugin.js +9 -7
  167. package/esm/plugins/selectable/addSelectableColumn.js +24 -16
  168. package/esm/plugins/selectable/helper.js +10 -1
  169. package/esm/plugins/selectable/selectableFormatter.js +79 -68
  170. package/esm/plugins/selectable/useSelectableState.js +19 -5
  171. package/esm/plugins/sortable/SortablePlugin.js +5 -4
  172. package/esm/plugins/sortable/sortHeaderFormatter.js +12 -11
  173. package/esm/plugins/sortable/sortTree.js +13 -3
  174. package/esm/plugins/sortable/sorter.js +151 -134
  175. package/esm/plugins/sortable/useSortableState.js +7 -0
  176. package/esm/plugins/toolbar/RowRenderer.js +6 -1
  177. package/esm/plugins/toolbar/ToolbarTrigger.js +14 -8
  178. package/esm/plugins/virtualization/AutoHeightList.js +6 -3
  179. package/esm/plugins/virtualization/VirtualizationPlugin.js +31 -24
  180. package/esm/plugins/virtualization/VirtualizedBody.js +14 -5
  181. package/esm/plugins/virtualization/VirtualizedBodyRow.js +8 -7
  182. package/esm/renders/CellWithAddons.js +15 -14
  183. package/esm/renders/styled.js +1 -1
  184. package/esm/utilities/getPluginsFromProps.js +5 -1
  185. package/esm/utilities/getScrollbarSize.js +2 -1
  186. package/esm/utilities/normalizeData.js +7 -1
  187. package/package.json +19 -18
  188. package/types/components/BodyCell.d.ts +1 -1
  189. package/types/components/HeaderCell.d.ts +1 -1
  190. package/types/plugins/column-sizing/columnMeasurerTransformer.d.ts +1 -1
  191. package/types/plugins/column-sizing/ext-points/getTableProps.d.ts +1 -1
  192. package/types/plugins/expandable-grid/ExpandedRowExtra.d.ts +1 -1
  193. package/types/plugins/expandable-grid/useExpandGridState.d.ts +4 -4
  194. package/types/plugins/filterable/components/filterable-menus/DateRangeFilterMenu.d.ts +1 -1
  195. package/types/plugins/filterable/components/filterable-menus/SingleDateFilterMenu.d.ts +1 -1
  196. package/types/plugins/filterable/components/filterable-menus/TextFilterMenu.d.ts +1 -1
  197. package/types/plugins/filterable/helper.d.ts +15 -3
  198. package/types/plugins/pagination/components/PerPageDropdown.d.ts +1 -1
@@ -1,31 +1,39 @@
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';
1
6
  import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
2
7
  import _jsx from '@babel/runtime/helpers/esm/jsx';
3
8
  import React, { useRef, useEffect, forwardRef } from 'react';
4
- import { isFunction } from '@elliemae/ds-utilities/utils';
5
- import DSCheckbox from '@elliemae/ds-basic/form/Checkbox';
6
- import DSRadio from '@elliemae/ds-basic/form/Radio';
9
+ import { isFunction } from '@elliemae/ds-utilities';
10
+ import { DSCheckbox, DSRadio } from '@elliemae/ds-form';
7
11
  import { jsx } from 'react/jsx-runtime';
8
12
 
9
13
  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; }
10
14
 
11
15
  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; }
12
16
 
13
- const SelectableWrapper = ({
14
- className,
15
- children
16
- }) => /*#__PURE__*/_jsx("div", {
17
- className: className,
18
- onClick: e => e.stopPropagation()
19
- }, void 0, children);
17
+ const SelectableWrapper = _ref => {
18
+ let {
19
+ className,
20
+ children
21
+ } = _ref;
22
+ return /*#__PURE__*/_jsx("div", {
23
+ className: className,
24
+ onClick: e => e.stopPropagation()
25
+ }, void 0, children);
26
+ };
20
27
 
21
- const SelectableComponent = /*#__PURE__*/React.memo( /*#__PURE__*/forwardRef(({
22
- className,
23
- isMultiSelect,
24
- isHeader,
25
- onSelect,
26
- isSelected,
27
- value
28
- }, ref) => {
28
+ const SelectableComponent = /*#__PURE__*/React.memo( /*#__PURE__*/forwardRef((_ref2, ref) => {
29
+ let {
30
+ className,
31
+ isMultiSelect,
32
+ isHeader,
33
+ onSelect,
34
+ isSelected,
35
+ value
36
+ } = _ref2;
29
37
  const SelectComponent = isMultiSelect || isHeader ? DSCheckbox : DSRadio;
30
38
  return /*#__PURE__*/_jsx(SelectableWrapper, {
31
39
  className: className
@@ -39,58 +47,61 @@ const SelectableComponent = /*#__PURE__*/React.memo( /*#__PURE__*/forwardRef(({
39
47
  }));
40
48
  }, (prev, next) => next.isScrolling));
41
49
 
42
- const selectableFormatter = ({
43
- isMultiSelect = false,
44
- renderer,
45
- className,
46
- isHeader,
47
- onSelect
48
- }, grid) => (valueRender, extraParams) => {
49
- const {
50
- registerFocus
51
- } = extraParams;
52
- const ref = useRef();
53
- const {
54
- props: {
55
- rowKey
56
- },
57
- state: {
58
- selection
59
- },
60
- shiftPressed,
61
- lastSelectedRow
62
- } = grid.getInstance();
63
- const {
64
- rowData,
65
- isScrolling
66
- } = extraParams;
67
- useEffect(() => {
68
- if (registerFocus) registerFocus(ref.current);
69
- }, [ref.current]);
70
- const isSelected = isHeader ? selection.selectAll : !!selection.selectedRows[rowData[rowKey]];
71
- const handleSelect = isHeader ? () => onSelect(!isSelected) : () => onSelect(rowData[rowKey], extraParams.rowIndex, shiftPressed, lastSelectedRow);
50
+ const selectableFormatter = (_ref3, grid) => {
51
+ let {
52
+ isMultiSelect = false,
53
+ renderer,
54
+ className,
55
+ isHeader,
56
+ onSelect
57
+ } = _ref3;
58
+ return (valueRender, extraParams) => {
59
+ const {
60
+ registerFocus
61
+ } = extraParams;
62
+ const ref = useRef();
63
+ const {
64
+ props: {
65
+ rowKey
66
+ },
67
+ state: {
68
+ selection
69
+ },
70
+ shiftPressed,
71
+ lastSelectedRow
72
+ } = grid.getInstance();
73
+ const {
74
+ rowData,
75
+ isScrolling
76
+ } = extraParams;
77
+ useEffect(() => {
78
+ if (registerFocus) registerFocus(ref.current);
79
+ }, [ref.current]);
80
+ const isSelected = isHeader ? selection.selectAll : !!selection.selectedRows[rowData[rowKey]];
81
+ const handleSelect = isHeader ? () => onSelect(!isSelected) : () => onSelect(rowData[rowKey], extraParams.rowIndex, shiftPressed, lastSelectedRow);
72
82
 
73
- if (isFunction(renderer)) {
74
- return /*#__PURE__*/_jsx(SelectableWrapper, {
75
- className: className
76
- }, void 0, renderer(_objectSpread(_objectSpread({
77
- rowData: {}
78
- }, extraParams), {}, {
79
- value: isSelected,
80
- isHeader,
81
- onSelect: handleSelect
82
- })));
83
- }
83
+ if (isFunction(renderer)) {
84
+ return /*#__PURE__*/_jsx(SelectableWrapper, {
85
+ className: className
86
+ }, void 0, renderer(_objectSpread(_objectSpread({
87
+ rowData: {}
88
+ }, extraParams), {}, {
89
+ value: isSelected,
90
+ isHeader,
91
+ onSelect: handleSelect
92
+ })));
93
+ }
84
94
 
85
- return /*#__PURE__*/jsx(SelectableComponent, {
86
- ref: ref,
87
- className: className,
88
- isMultiSelect: isMultiSelect,
89
- isScrolling: isScrolling,
90
- isSelected: isSelected,
91
- onSelect: handleSelect,
92
- value: !isHeader ? rowData[rowKey] : 'header-select-all'
93
- });
95
+ return /*#__PURE__*/jsx(SelectableComponent, {
96
+ ref: ref,
97
+ className: className,
98
+ isMultiSelect: isMultiSelect,
99
+ isScrolling: isScrolling,
100
+ isSelected: isSelected,
101
+ onSelect: handleSelect,
102
+ value: !isHeader ? rowData[rowKey] : 'header-select-all'
103
+ });
104
+ };
94
105
  };
95
106
 
96
107
  export { selectableFormatter as default };
@@ -1,7 +1,17 @@
1
+ import 'core-js/modules/esnext.async-iterator.for-each.js';
2
+ import 'core-js/modules/esnext.iterator.for-each.js';
1
3
  import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
2
4
  import 'core-js/modules/web.dom-collections.iterator.js';
3
- import useDerivedStateFromProps from '@elliemae/ds-utilities/hooks/useDerivedStateFromProps';
4
- import { hashArray, toggleInObject, omit } from '@elliemae/ds-utilities/utils';
5
+ import 'core-js/modules/esnext.async-iterator.some.js';
6
+ import 'core-js/modules/esnext.iterator.constructor.js';
7
+ import 'core-js/modules/esnext.iterator.some.js';
8
+ import 'core-js/modules/esnext.async-iterator.map.js';
9
+ import 'core-js/modules/esnext.iterator.map.js';
10
+ import 'core-js/modules/esnext.async-iterator.reduce.js';
11
+ import 'core-js/modules/esnext.iterator.reduce.js';
12
+ import 'core-js/modules/esnext.async-iterator.filter.js';
13
+ import 'core-js/modules/esnext.iterator.filter.js';
14
+ import { useDerivedStateFromProps, hashArray, toggleInObject, omit } from '@elliemae/ds-utilities';
5
15
  import { toggleSelectAll, checkAllRowsSelected, toggleSingleSelectable } from './helper.js';
6
16
 
7
17
  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; }
@@ -9,7 +19,10 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
9
19
  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
20
 
11
21
  function deriveSelectedStateFromPropsOnUpdate(rows) {
12
- return (nextProp = {}, prevProp = {}) => {
22
+ return function () {
23
+ let nextProp = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
24
+ let prevProp = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
25
+
13
26
  if (nextProp.selectAll !== prevProp.selectAll) {
14
27
  const nextSelectedRows = nextProp.selectAll ? toggleSelectAll(rows, true) : hashArray(nextProp.selectedRows || []);
15
28
  return {
@@ -46,8 +59,9 @@ function useSelectableState(grid) {
46
59
  onUpdate: deriveSelectedStateFromPropsOnUpdate(rows)
47
60
  }); // ACTIONS
48
61
 
49
- const handleSelectRow = (id, index, shift = false, lastSelectedRow = null // eslint-disable-next-line max-params
50
- ) => {
62
+ const handleSelectRow = function (id, index) {
63
+ let shift = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
64
+ let lastSelectedRow = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
51
65
  setSelectedRowsState(prevState => {
52
66
  const {
53
67
  rows: nextRows
@@ -1,5 +1,5 @@
1
1
  import * as sortabular from 'sortabular';
2
- import { compose, isEmpty, orderBy } from '@elliemae/ds-utilities/utils';
2
+ import { compose, isEmpty, orderBy } from '@elliemae/ds-utilities';
3
3
  import { appendHeaderFormatter, mergeClassNameToColumnHeader } from '@elliemae/ds-shared/useDataGrid/initColumnDefinition';
4
4
  import createInstancePlugin from '@elliemae/ds-shared/createDataInstance/createInstancePlugin';
5
5
  import sortHeaderFormatter from './sortHeaderFormatter.js';
@@ -60,9 +60,10 @@ const SortablePlugin = createInstancePlugin('sortable', {
60
60
  registerHotKeys(grid) {
61
61
  return {
62
62
  key: 'ctrl+s',
63
- handler: ({
64
- cellIndex
65
- }) => {
63
+ handler: _ref => {
64
+ let {
65
+ cellIndex
66
+ } = _ref;
66
67
  const {
67
68
  actions: {
68
69
  sort
@@ -1,18 +1,18 @@
1
1
  import _jsx from '@babel/runtime/helpers/esm/jsx';
2
2
  import React from 'react';
3
3
  import { aggregatedClasses } from '@elliemae/ds-classnames';
4
- import ArrowheadDown from '@elliemae/ds-icons/ArrowheadDown';
5
- import ArrowheadUp from '@elliemae/ds-icons/ArrowheadUp';
4
+ import { ArrowheadUp, ArrowheadDown } from '@elliemae/ds-icons';
6
5
 
7
6
  var _ArrowheadUp, _ArrowheadDown;
8
7
  const blockName = 'data-grid-sort-header';
9
8
  const SortHeaderContainer = aggregatedClasses('div')(blockName);
10
9
  const iconColor = ['brand-primary', 800];
11
- const SortHeader = /*#__PURE__*/React.memo(({
12
- value,
13
- onClick,
14
- sortState
15
- }) => {
10
+ const SortHeader = /*#__PURE__*/React.memo(_ref => {
11
+ let {
12
+ value,
13
+ onClick,
14
+ sortState
15
+ } = _ref;
16
16
  const sortIndicator = sortState === 'asc' ? _ArrowheadUp || (_ArrowheadUp = /*#__PURE__*/_jsx(ArrowheadUp, {
17
17
  color: iconColor
18
18
  })) : _ArrowheadDown || (_ArrowheadDown = /*#__PURE__*/_jsx(ArrowheadDown, {
@@ -25,10 +25,11 @@ const SortHeader = /*#__PURE__*/React.memo(({
25
25
  }, void 0, value), sortState && sortIndicator);
26
26
  });
27
27
 
28
- const sortHeaderFormatter = (sortable, grid) => (value, {
29
- columnIndex,
30
- property
31
- }) => {
28
+ const sortHeaderFormatter = (sortable, grid) => (value, _ref2) => {
29
+ let {
30
+ columnIndex,
31
+ property
32
+ } = _ref2;
32
33
  const {
33
34
  state: {
34
35
  sortingColumns
@@ -1,13 +1,23 @@
1
1
  import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
2
+ import 'core-js/modules/esnext.async-iterator.map.js';
3
+ import 'core-js/modules/esnext.iterator.map.js';
4
+ import 'core-js/modules/esnext.async-iterator.filter.js';
5
+ import 'core-js/modules/esnext.iterator.constructor.js';
6
+ import 'core-js/modules/esnext.iterator.filter.js';
7
+ import 'core-js/modules/esnext.async-iterator.for-each.js';
8
+ import 'core-js/modules/esnext.iterator.for-each.js';
2
9
  import * as sortabular from 'sortabular';
3
10
 
4
11
  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
12
 
6
13
  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
14
 
8
- const deepSorting = (sortConfig, rows = []) => sortabular.sorter(sortConfig)(rows.map(row => row.children && row.children.length ? _objectSpread(_objectSpread({}, row), {}, {
9
- children: deepSorting(sortConfig, row.children)
10
- }) : row));
15
+ const deepSorting = function (sortConfig) {
16
+ let rows = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
17
+ return sortabular.sorter(sortConfig)(rows.map(row => row.children && row.children.length ? _objectSpread(_objectSpread({}, row), {}, {
18
+ children: deepSorting(sortConfig, row.children)
19
+ }) : row));
20
+ };
11
21
 
12
22
  function sortTree(sortConfig) {
13
23
  return rows => deepSorting(sortConfig, rows);
@@ -1,149 +1,166 @@
1
1
  import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
2
+ import 'core-js/modules/esnext.async-iterator.filter.js';
3
+ import 'core-js/modules/esnext.iterator.constructor.js';
4
+ import 'core-js/modules/esnext.iterator.filter.js';
5
+ import 'core-js/modules/esnext.async-iterator.some.js';
6
+ import 'core-js/modules/esnext.iterator.some.js';
2
7
  import 'core-js/modules/web.dom-collections.iterator.js';
3
- import { get } from '@elliemae/ds-utilities/utils';
8
+ import 'core-js/modules/esnext.async-iterator.for-each.js';
9
+ import 'core-js/modules/esnext.iterator.for-each.js';
10
+ import 'core-js/modules/esnext.async-iterator.find.js';
11
+ import 'core-js/modules/esnext.iterator.find.js';
12
+ import 'core-js/modules/esnext.async-iterator.map.js';
13
+ import 'core-js/modules/esnext.iterator.map.js';
14
+ import { get } from '@elliemae/ds-utilities';
4
15
  import moment from 'moment';
5
16
 
6
17
  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; }
7
18
 
8
19
  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; }
9
- const sorter = ({
10
- columns,
11
- sortingColumns,
12
- sort,
13
- emptyLast
14
- } = {}) => data => {
15
- if (!columns) {
16
- throw new Error('sort.sorter - Missing "columns" argument!');
17
- }
18
-
19
- if (!sort) {
20
- throw new Error('sort.sorter - Missing "sort" argument!');
21
- }
22
-
23
- if (!sortingColumns) {
24
- return data;
25
- }
26
-
27
- const columnIndexList = new Array(sortingColumns.length);
28
- const orderList = new Array(sortingColumns.length);
29
- let actualSortFunction = sort;
30
-
31
- if (emptyLast) {
32
- actualSortFunction = (innerData, innerColumnIndexList, innerOrderList) => {
33
- const sortedData = sort(innerData, innerColumnIndexList, innerOrderList);
34
- const keys = Object.keys(sortingColumns);
35
- const withData = sortedData.filter(r => keys.some(key => !!r[key]));
36
- const withoutData = sortedData.filter(r => keys.some(key => !r[key]));
37
- return [...withData, ...withoutData];
38
- };
39
- }
40
-
41
- Object.keys(sortingColumns).forEach(sortingColumnKey => {
42
- const realColumn = columns.find(column => column.property === sortingColumnKey);
43
- if (!realColumn) return;
44
-
45
- const columnSorter = realColumn.sort || function resolveValue(row) {
46
- const {
47
- property,
48
- sortBy
49
- } = realColumn;
50
- const value = row[sortBy || property]; // Pick resolved value by convention
51
-
52
- const resolvedValue = get(row, "_".concat(property), value);
53
-
54
- if (realColumn.type === 'DateTime') {
55
- return moment(resolvedValue);
56
- }
20
+ const sorter = function () {
21
+ let {
22
+ columns,
23
+ sortingColumns,
24
+ sort,
25
+ emptyLast
26
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
27
+ return data => {
28
+ if (!columns) {
29
+ throw new Error('sort.sorter - Missing "columns" argument!');
30
+ }
31
+
32
+ if (!sort) {
33
+ throw new Error('sort.sorter - Missing "sort" argument!');
34
+ }
35
+
36
+ if (!sortingColumns) {
37
+ return data;
38
+ }
39
+
40
+ const columnIndexList = new Array(sortingColumns.length);
41
+ const orderList = new Array(sortingColumns.length);
42
+ let actualSortFunction = sort;
43
+
44
+ if (emptyLast) {
45
+ actualSortFunction = (innerData, innerColumnIndexList, innerOrderList) => {
46
+ const sortedData = sort(innerData, innerColumnIndexList, innerOrderList);
47
+ const keys = Object.keys(sortingColumns);
48
+ const withData = sortedData.filter(r => keys.some(key => !!r[key]));
49
+ const withoutData = sortedData.filter(r => keys.some(key => !r[key]));
50
+ return [...withData, ...withoutData];
51
+ };
52
+ }
53
+
54
+ Object.keys(sortingColumns).forEach(sortingColumnKey => {
55
+ const realColumn = columns.find(column => column.property === sortingColumnKey);
56
+ if (!realColumn) return;
57
+
58
+ const columnSorter = realColumn.sort || function resolveValue(row) {
59
+ const {
60
+ property,
61
+ sortBy
62
+ } = realColumn;
63
+ const value = row[sortBy || property]; // Pick resolved value by convention
57
64
 
58
- return typeof resolvedValue === 'string' ? resolvedValue.toLowerCase() : resolvedValue;
59
- };
65
+ const resolvedValue = get(row, "_".concat(property), value);
60
66
 
61
- const sortingColumn = sortingColumns[sortingColumnKey];
62
- columnIndexList[sortingColumn.position] = columnSorter;
63
- orderList[sortingColumn.position] = sortingColumn.direction;
64
- });
65
- return actualSortFunction(data, columnIndexList, orderList);
67
+ if (realColumn.type === 'DateTime') {
68
+ return moment(resolvedValue);
69
+ }
70
+
71
+ return typeof resolvedValue === 'string' ? resolvedValue.toLowerCase() : resolvedValue;
72
+ };
73
+
74
+ const sortingColumn = sortingColumns[sortingColumnKey];
75
+ columnIndexList[sortingColumn.position] = columnSorter;
76
+ orderList[sortingColumn.position] = sortingColumn.direction;
77
+ });
78
+ return actualSortFunction(data, columnIndexList, orderList);
79
+ };
66
80
  };
67
- const sorterGroups = ({
68
- columns,
69
- sortingColumns,
70
- sort,
71
- emptyLast
72
- } = {}) => (data, rowsData) => {
73
- if (!columns) {
74
- throw new Error('sort.sorter - Missing "columns" argument!');
75
- }
76
-
77
- if (!sort) {
78
- throw new Error('sort.sorter - Missing "sort" argument!');
79
- }
80
-
81
- if (!sortingColumns) {
82
- return data;
83
- }
84
-
85
- const columnIndexList = new Array(sortingColumns.length);
86
- const orderList = new Array(sortingColumns.length);
87
- let actualSortFunction = sort;
88
-
89
- if (emptyLast) {
90
- actualSortFunction = (innerData, innerColumnIndexList, innerOrderList) => {
91
- const sortedData = sort(innerData, innerColumnIndexList, innerOrderList);
92
- const keys = Object.keys(sortingColumns);
93
- const withData = sortedData.filter(r => keys.some(key => !!r[key]));
94
- const withoutData = sortedData.filter(r => keys.some(key => !r[key]));
95
- return [...withData, ...withoutData];
96
- };
97
- }
98
-
99
- Object.keys(sortingColumns).forEach(sortingColumnKey => {
100
- const realColumn = columns.find(column => column.property === sortingColumnKey);
101
- if (!realColumn) return;
102
-
103
- const columnSorter = realColumn.sort || function resolveValue(row) {
104
- const {
105
- property,
106
- sortBy
107
- } = realColumn;
108
- const value = row[sortBy || property]; // Pick resolved value by convention
109
-
110
- const resolvedValue = get(row, "_".concat(property), value);
111
-
112
- if (realColumn.type === 'DateTime') {
113
- return moment(resolvedValue);
114
- }
81
+ const sorterGroups = function () {
82
+ let {
83
+ columns,
84
+ sortingColumns,
85
+ sort,
86
+ emptyLast
87
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
88
+ return (data, rowsData) => {
89
+ if (!columns) {
90
+ throw new Error('sort.sorter - Missing "columns" argument!');
91
+ }
92
+
93
+ if (!sort) {
94
+ throw new Error('sort.sorter - Missing "sort" argument!');
95
+ }
96
+
97
+ if (!sortingColumns) {
98
+ return data;
99
+ }
115
100
 
116
- return typeof resolvedValue === 'string' ? resolvedValue.toLowerCase() : resolvedValue;
117
- };
118
-
119
- const sortingColumn = sortingColumns[sortingColumnKey];
120
- columnIndexList[sortingColumn.position] = columnSorter;
121
- orderList[sortingColumn.position] = sortingColumn.direction;
122
- });
123
- const groups = {};
124
- const preserveData = {};
125
- data.forEach(c => {
126
- preserveData[c.id] = _objectSpread({}, c);
127
- });
128
- rowsData.forEach(group => {
129
- groups[group.id] = {
130
- children: actualSortFunction(group.children.map(c => _objectSpread({
131
- parentNode: preserveData[c.id].parentNode,
132
- data: c
133
- }, c)), columnIndexList, orderList) // sort internally
134
-
135
- };
136
- });
137
- const sorted = actualSortFunction(data.map(r => _objectSpread(_objectSpread({}, r.data), r)), columnIndexList, orderList); // sort global
138
-
139
- let ssortGlobal = [];
140
- sorted.filter(s => !s.isGroup).forEach(sr => {
141
- if (groups[sr.parentNode.id]) {
142
- ssortGlobal = [...ssortGlobal, preserveData[sr.parentNode.id], ...groups[sr.parentNode.id].children];
143
- delete groups[sr.parentNode.id];
101
+ const columnIndexList = new Array(sortingColumns.length);
102
+ const orderList = new Array(sortingColumns.length);
103
+ let actualSortFunction = sort;
104
+
105
+ if (emptyLast) {
106
+ actualSortFunction = (innerData, innerColumnIndexList, innerOrderList) => {
107
+ const sortedData = sort(innerData, innerColumnIndexList, innerOrderList);
108
+ const keys = Object.keys(sortingColumns);
109
+ const withData = sortedData.filter(r => keys.some(key => !!r[key]));
110
+ const withoutData = sortedData.filter(r => keys.some(key => !r[key]));
111
+ return [...withData, ...withoutData];
112
+ };
144
113
  }
145
- });
146
- return ssortGlobal;
114
+
115
+ Object.keys(sortingColumns).forEach(sortingColumnKey => {
116
+ const realColumn = columns.find(column => column.property === sortingColumnKey);
117
+ if (!realColumn) return;
118
+
119
+ const columnSorter = realColumn.sort || function resolveValue(row) {
120
+ const {
121
+ property,
122
+ sortBy
123
+ } = realColumn;
124
+ const value = row[sortBy || property]; // Pick resolved value by convention
125
+
126
+ const resolvedValue = get(row, "_".concat(property), value);
127
+
128
+ if (realColumn.type === 'DateTime') {
129
+ return moment(resolvedValue);
130
+ }
131
+
132
+ return typeof resolvedValue === 'string' ? resolvedValue.toLowerCase() : resolvedValue;
133
+ };
134
+
135
+ const sortingColumn = sortingColumns[sortingColumnKey];
136
+ columnIndexList[sortingColumn.position] = columnSorter;
137
+ orderList[sortingColumn.position] = sortingColumn.direction;
138
+ });
139
+ const groups = {};
140
+ const preserveData = {};
141
+ data.forEach(c => {
142
+ preserveData[c.id] = _objectSpread({}, c);
143
+ });
144
+ rowsData.forEach(group => {
145
+ groups[group.id] = {
146
+ children: actualSortFunction(group.children.map(c => _objectSpread({
147
+ parentNode: preserveData[c.id].parentNode,
148
+ data: c
149
+ }, c)), columnIndexList, orderList) // sort internally
150
+
151
+ };
152
+ });
153
+ const sorted = actualSortFunction(data.map(r => _objectSpread(_objectSpread({}, r.data), r)), columnIndexList, orderList); // sort global
154
+
155
+ let ssortGlobal = [];
156
+ sorted.filter(s => !s.isGroup).forEach(sr => {
157
+ if (groups[sr.parentNode.id]) {
158
+ ssortGlobal = [...ssortGlobal, preserveData[sr.parentNode.id], ...groups[sr.parentNode.id].children];
159
+ delete groups[sr.parentNode.id];
160
+ }
161
+ });
162
+ return ssortGlobal;
163
+ };
147
164
  };
148
165
 
149
166
  export { sorter, sorterGroups };
@@ -1,5 +1,12 @@
1
1
  import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
2
2
  import 'core-js/modules/web.dom-collections.iterator.js';
3
+ import 'core-js/modules/esnext.async-iterator.find.js';
4
+ import 'core-js/modules/esnext.iterator.constructor.js';
5
+ import 'core-js/modules/esnext.iterator.find.js';
6
+ import 'core-js/modules/esnext.async-iterator.filter.js';
7
+ import 'core-js/modules/esnext.iterator.filter.js';
8
+ import 'core-js/modules/esnext.async-iterator.for-each.js';
9
+ import 'core-js/modules/esnext.iterator.for-each.js';
3
10
  import * as sortabular from 'sortabular/dist/index.js';
4
11
  import useDerivedStateFromProps from '@elliemae/ds-utilities/hooks/useDerivedStateFromProps';
5
12
  import { checkIfSortable } from './checkIfSortable.js';
@@ -1,9 +1,14 @@
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';
1
6
  import _jsx from '@babel/runtime/helpers/esm/jsx';
2
7
  import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
3
8
  import 'core-js/modules/web.dom-collections.iterator.js';
4
9
  import { useRef, useState, useEffect } from 'react';
5
10
  import { isEmpty } from 'lodash';
6
- import { omit } from '@elliemae/ds-utilities/utils';
11
+ import { omit } from '@elliemae/ds-utilities';
7
12
  import { ToolbarTrigger } from './ToolbarTrigger.js';
8
13
  import { RowSizes } from '../../rowSizes.js';
9
14
  import { jsx } from 'react/jsx-runtime';