@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
@@ -3,8 +3,19 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var _defineProperty = require('@babel/runtime/helpers/defineProperty');
6
+ require('core-js/modules/esnext.async-iterator.filter.js');
7
+ require('core-js/modules/esnext.iterator.constructor.js');
8
+ require('core-js/modules/esnext.iterator.filter.js');
9
+ require('core-js/modules/esnext.async-iterator.some.js');
10
+ require('core-js/modules/esnext.iterator.some.js');
6
11
  require('core-js/modules/web.dom-collections.iterator.js');
7
- var utils = require('@elliemae/ds-utilities/utils');
12
+ require('core-js/modules/esnext.async-iterator.for-each.js');
13
+ require('core-js/modules/esnext.iterator.for-each.js');
14
+ require('core-js/modules/esnext.async-iterator.find.js');
15
+ require('core-js/modules/esnext.iterator.find.js');
16
+ require('core-js/modules/esnext.async-iterator.map.js');
17
+ require('core-js/modules/esnext.iterator.map.js');
18
+ var dsUtilities = require('@elliemae/ds-utilities');
8
19
  var moment = require('moment');
9
20
 
10
21
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -15,144 +26,150 @@ var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment);
15
26
  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; }
16
27
 
17
28
  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__default["default"](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; }
18
- const sorter = ({
19
- columns,
20
- sortingColumns,
21
- sort,
22
- emptyLast
23
- } = {}) => data => {
24
- if (!columns) {
25
- throw new Error('sort.sorter - Missing "columns" argument!');
26
- }
27
-
28
- if (!sort) {
29
- throw new Error('sort.sorter - Missing "sort" argument!');
30
- }
31
-
32
- if (!sortingColumns) {
33
- return data;
34
- }
35
-
36
- const columnIndexList = new Array(sortingColumns.length);
37
- const orderList = new Array(sortingColumns.length);
38
- let actualSortFunction = sort;
39
-
40
- if (emptyLast) {
41
- actualSortFunction = (innerData, innerColumnIndexList, innerOrderList) => {
42
- const sortedData = sort(innerData, innerColumnIndexList, innerOrderList);
43
- const keys = Object.keys(sortingColumns);
44
- const withData = sortedData.filter(r => keys.some(key => !!r[key]));
45
- const withoutData = sortedData.filter(r => keys.some(key => !r[key]));
46
- return [...withData, ...withoutData];
47
- };
48
- }
49
-
50
- Object.keys(sortingColumns).forEach(sortingColumnKey => {
51
- const realColumn = columns.find(column => column.property === sortingColumnKey);
52
- if (!realColumn) return;
53
-
54
- const columnSorter = realColumn.sort || function resolveValue(row) {
55
- const {
56
- property,
57
- sortBy
58
- } = realColumn;
59
- const value = row[sortBy || property]; // Pick resolved value by convention
60
-
61
- const resolvedValue = utils.get(row, "_".concat(property), value);
62
-
63
- if (realColumn.type === 'DateTime') {
64
- return moment__default["default"](resolvedValue);
65
- }
29
+ const sorter = function () {
30
+ let {
31
+ columns,
32
+ sortingColumns,
33
+ sort,
34
+ emptyLast
35
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
36
+ return data => {
37
+ if (!columns) {
38
+ throw new Error('sort.sorter - Missing "columns" argument!');
39
+ }
40
+
41
+ if (!sort) {
42
+ throw new Error('sort.sorter - Missing "sort" argument!');
43
+ }
44
+
45
+ if (!sortingColumns) {
46
+ return data;
47
+ }
48
+
49
+ const columnIndexList = new Array(sortingColumns.length);
50
+ const orderList = new Array(sortingColumns.length);
51
+ let actualSortFunction = sort;
52
+
53
+ if (emptyLast) {
54
+ actualSortFunction = (innerData, innerColumnIndexList, innerOrderList) => {
55
+ const sortedData = sort(innerData, innerColumnIndexList, innerOrderList);
56
+ const keys = Object.keys(sortingColumns);
57
+ const withData = sortedData.filter(r => keys.some(key => !!r[key]));
58
+ const withoutData = sortedData.filter(r => keys.some(key => !r[key]));
59
+ return [...withData, ...withoutData];
60
+ };
61
+ }
62
+
63
+ Object.keys(sortingColumns).forEach(sortingColumnKey => {
64
+ const realColumn = columns.find(column => column.property === sortingColumnKey);
65
+ if (!realColumn) return;
66
+
67
+ const columnSorter = realColumn.sort || function resolveValue(row) {
68
+ const {
69
+ property,
70
+ sortBy
71
+ } = realColumn;
72
+ const value = row[sortBy || property]; // Pick resolved value by convention
66
73
 
67
- return typeof resolvedValue === 'string' ? resolvedValue.toLowerCase() : resolvedValue;
68
- };
74
+ const resolvedValue = dsUtilities.get(row, "_".concat(property), value);
69
75
 
70
- const sortingColumn = sortingColumns[sortingColumnKey];
71
- columnIndexList[sortingColumn.position] = columnSorter;
72
- orderList[sortingColumn.position] = sortingColumn.direction;
73
- });
74
- return actualSortFunction(data, columnIndexList, orderList);
76
+ if (realColumn.type === 'DateTime') {
77
+ return moment__default["default"](resolvedValue);
78
+ }
79
+
80
+ return typeof resolvedValue === 'string' ? resolvedValue.toLowerCase() : resolvedValue;
81
+ };
82
+
83
+ const sortingColumn = sortingColumns[sortingColumnKey];
84
+ columnIndexList[sortingColumn.position] = columnSorter;
85
+ orderList[sortingColumn.position] = sortingColumn.direction;
86
+ });
87
+ return actualSortFunction(data, columnIndexList, orderList);
88
+ };
75
89
  };
76
- const sorterGroups = ({
77
- columns,
78
- sortingColumns,
79
- sort,
80
- emptyLast
81
- } = {}) => (data, rowsData) => {
82
- if (!columns) {
83
- throw new Error('sort.sorter - Missing "columns" argument!');
84
- }
85
-
86
- if (!sort) {
87
- throw new Error('sort.sorter - Missing "sort" argument!');
88
- }
89
-
90
- if (!sortingColumns) {
91
- return data;
92
- }
93
-
94
- const columnIndexList = new Array(sortingColumns.length);
95
- const orderList = new Array(sortingColumns.length);
96
- let actualSortFunction = sort;
97
-
98
- if (emptyLast) {
99
- actualSortFunction = (innerData, innerColumnIndexList, innerOrderList) => {
100
- const sortedData = sort(innerData, innerColumnIndexList, innerOrderList);
101
- const keys = Object.keys(sortingColumns);
102
- const withData = sortedData.filter(r => keys.some(key => !!r[key]));
103
- const withoutData = sortedData.filter(r => keys.some(key => !r[key]));
104
- return [...withData, ...withoutData];
105
- };
106
- }
107
-
108
- Object.keys(sortingColumns).forEach(sortingColumnKey => {
109
- const realColumn = columns.find(column => column.property === sortingColumnKey);
110
- if (!realColumn) return;
111
-
112
- const columnSorter = realColumn.sort || function resolveValue(row) {
113
- const {
114
- property,
115
- sortBy
116
- } = realColumn;
117
- const value = row[sortBy || property]; // Pick resolved value by convention
118
-
119
- const resolvedValue = utils.get(row, "_".concat(property), value);
120
-
121
- if (realColumn.type === 'DateTime') {
122
- return moment__default["default"](resolvedValue);
123
- }
90
+ const sorterGroups = function () {
91
+ let {
92
+ columns,
93
+ sortingColumns,
94
+ sort,
95
+ emptyLast
96
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
97
+ return (data, rowsData) => {
98
+ if (!columns) {
99
+ throw new Error('sort.sorter - Missing "columns" argument!');
100
+ }
101
+
102
+ if (!sort) {
103
+ throw new Error('sort.sorter - Missing "sort" argument!');
104
+ }
105
+
106
+ if (!sortingColumns) {
107
+ return data;
108
+ }
124
109
 
125
- return typeof resolvedValue === 'string' ? resolvedValue.toLowerCase() : resolvedValue;
126
- };
127
-
128
- const sortingColumn = sortingColumns[sortingColumnKey];
129
- columnIndexList[sortingColumn.position] = columnSorter;
130
- orderList[sortingColumn.position] = sortingColumn.direction;
131
- });
132
- const groups = {};
133
- const preserveData = {};
134
- data.forEach(c => {
135
- preserveData[c.id] = _objectSpread({}, c);
136
- });
137
- rowsData.forEach(group => {
138
- groups[group.id] = {
139
- children: actualSortFunction(group.children.map(c => _objectSpread({
140
- parentNode: preserveData[c.id].parentNode,
141
- data: c
142
- }, c)), columnIndexList, orderList) // sort internally
143
-
144
- };
145
- });
146
- const sorted = actualSortFunction(data.map(r => _objectSpread(_objectSpread({}, r.data), r)), columnIndexList, orderList); // sort global
147
-
148
- let ssortGlobal = [];
149
- sorted.filter(s => !s.isGroup).forEach(sr => {
150
- if (groups[sr.parentNode.id]) {
151
- ssortGlobal = [...ssortGlobal, preserveData[sr.parentNode.id], ...groups[sr.parentNode.id].children];
152
- delete groups[sr.parentNode.id];
110
+ const columnIndexList = new Array(sortingColumns.length);
111
+ const orderList = new Array(sortingColumns.length);
112
+ let actualSortFunction = sort;
113
+
114
+ if (emptyLast) {
115
+ actualSortFunction = (innerData, innerColumnIndexList, innerOrderList) => {
116
+ const sortedData = sort(innerData, innerColumnIndexList, innerOrderList);
117
+ const keys = Object.keys(sortingColumns);
118
+ const withData = sortedData.filter(r => keys.some(key => !!r[key]));
119
+ const withoutData = sortedData.filter(r => keys.some(key => !r[key]));
120
+ return [...withData, ...withoutData];
121
+ };
153
122
  }
154
- });
155
- return ssortGlobal;
123
+
124
+ Object.keys(sortingColumns).forEach(sortingColumnKey => {
125
+ const realColumn = columns.find(column => column.property === sortingColumnKey);
126
+ if (!realColumn) return;
127
+
128
+ const columnSorter = realColumn.sort || function resolveValue(row) {
129
+ const {
130
+ property,
131
+ sortBy
132
+ } = realColumn;
133
+ const value = row[sortBy || property]; // Pick resolved value by convention
134
+
135
+ const resolvedValue = dsUtilities.get(row, "_".concat(property), value);
136
+
137
+ if (realColumn.type === 'DateTime') {
138
+ return moment__default["default"](resolvedValue);
139
+ }
140
+
141
+ return typeof resolvedValue === 'string' ? resolvedValue.toLowerCase() : resolvedValue;
142
+ };
143
+
144
+ const sortingColumn = sortingColumns[sortingColumnKey];
145
+ columnIndexList[sortingColumn.position] = columnSorter;
146
+ orderList[sortingColumn.position] = sortingColumn.direction;
147
+ });
148
+ const groups = {};
149
+ const preserveData = {};
150
+ data.forEach(c => {
151
+ preserveData[c.id] = _objectSpread({}, c);
152
+ });
153
+ rowsData.forEach(group => {
154
+ groups[group.id] = {
155
+ children: actualSortFunction(group.children.map(c => _objectSpread({
156
+ parentNode: preserveData[c.id].parentNode,
157
+ data: c
158
+ }, c)), columnIndexList, orderList) // sort internally
159
+
160
+ };
161
+ });
162
+ const sorted = actualSortFunction(data.map(r => _objectSpread(_objectSpread({}, r.data), r)), columnIndexList, orderList); // sort global
163
+
164
+ let ssortGlobal = [];
165
+ sorted.filter(s => !s.isGroup).forEach(sr => {
166
+ if (groups[sr.parentNode.id]) {
167
+ ssortGlobal = [...ssortGlobal, preserveData[sr.parentNode.id], ...groups[sr.parentNode.id].children];
168
+ delete groups[sr.parentNode.id];
169
+ }
170
+ });
171
+ return ssortGlobal;
172
+ };
156
173
  };
157
174
 
158
175
  exports.sorter = sorter;
@@ -4,6 +4,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var _defineProperty = require('@babel/runtime/helpers/defineProperty');
6
6
  require('core-js/modules/web.dom-collections.iterator.js');
7
+ require('core-js/modules/esnext.async-iterator.find.js');
8
+ require('core-js/modules/esnext.iterator.constructor.js');
9
+ require('core-js/modules/esnext.iterator.find.js');
10
+ require('core-js/modules/esnext.async-iterator.filter.js');
11
+ require('core-js/modules/esnext.iterator.filter.js');
12
+ require('core-js/modules/esnext.async-iterator.for-each.js');
13
+ require('core-js/modules/esnext.iterator.for-each.js');
7
14
  var sortabular = require('sortabular/dist/index.js');
8
15
  var useDerivedStateFromProps = require('@elliemae/ds-utilities/hooks/useDerivedStateFromProps');
9
16
  var checkIfSortable = require('./checkIfSortable.js');
@@ -5,9 +5,14 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var _jsx = require('@babel/runtime/helpers/jsx');
6
6
  var _defineProperty = require('@babel/runtime/helpers/defineProperty');
7
7
  require('core-js/modules/web.dom-collections.iterator.js');
8
+ require('core-js/modules/esnext.async-iterator.filter.js');
9
+ require('core-js/modules/esnext.iterator.constructor.js');
10
+ require('core-js/modules/esnext.iterator.filter.js');
11
+ require('core-js/modules/esnext.async-iterator.for-each.js');
12
+ require('core-js/modules/esnext.iterator.for-each.js');
8
13
  var React = require('react');
9
14
  var lodash = require('lodash');
10
- var utils = require('@elliemae/ds-utilities/utils');
15
+ var dsUtilities = require('@elliemae/ds-utilities');
11
16
  var ToolbarTrigger = require('./ToolbarTrigger.js');
12
17
  var rowSizes = require('../../rowSizes.js');
13
18
  var jsxRuntime = require('react/jsx-runtime');
@@ -55,7 +60,7 @@ const RowRenderer = (Row, grid) => {
55
60
  setHasVerticalScrollBar(false);
56
61
  }
57
62
 
58
- setRowStyle(utils.omit(style || {
63
+ setRowStyle(dsUtilities.omit(style || {
59
64
  height: !wrapText ? rowSizes.RowSizes[gridInstance.props.rowSize] : 'auto',
60
65
  position: 'relative'
61
66
  }, [shouldOmit]));
@@ -5,10 +5,15 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var _jsx = require('@babel/runtime/helpers/jsx');
6
6
  var _defineProperty = require('@babel/runtime/helpers/defineProperty');
7
7
  require('core-js/modules/web.dom-collections.iterator.js');
8
+ require('core-js/modules/esnext.async-iterator.filter.js');
9
+ require('core-js/modules/esnext.iterator.constructor.js');
10
+ require('core-js/modules/esnext.iterator.filter.js');
11
+ require('core-js/modules/esnext.async-iterator.for-each.js');
12
+ require('core-js/modules/esnext.iterator.for-each.js');
8
13
  var React = require('react');
9
14
  var styled = require('styled-components');
10
- var DSButton = require('@elliemae/ds-basic/Button');
11
- var MoreOptionsVert = require('@elliemae/ds-icons/MoreOptionsVert');
15
+ var DSButton = require('@elliemae/ds-button');
16
+ var dsIcons = require('@elliemae/ds-icons');
12
17
 
13
18
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
14
19
 
@@ -16,7 +21,6 @@ var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
16
21
  var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
17
22
  var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
18
23
  var DSButton__default = /*#__PURE__*/_interopDefaultLegacy(DSButton);
19
- var MoreOptionsVert__default = /*#__PURE__*/_interopDefaultLegacy(MoreOptionsVert);
20
24
 
21
25
  var _MoreOptionsVert;
22
26
 
@@ -33,12 +37,13 @@ const ToolbarPosition = /*#__PURE__*/styled__default["default"].div.withConfig({
33
37
  componentId: "sc-pm75g5-2"
34
38
  })(["position:absolute;z-index:10;display:flex;justify-content:flex-end;align-items:center;width:0;pointer-events:none;top:0;height:", ";margin-top:", ";"], props => props.rowRef.current ? "".concat(props.rowRef.current.offsetHeight, "px") : '36px', props => props.rowSize === 'normal' ? '0' : '0'); // eslint-disable-next-line react/prop-types
35
39
 
36
- const ToolbarTrigger = ({
37
- grid,
38
- rowData,
39
- hasScrollBar,
40
- rowRef
41
- }) => {
40
+ const ToolbarTrigger = _ref => {
41
+ let {
42
+ grid,
43
+ rowData,
44
+ hasScrollBar,
45
+ rowRef
46
+ } = _ref;
42
47
  const {
43
48
  props: {
44
49
  renderToolbar,
@@ -69,7 +74,7 @@ const ToolbarTrigger = ({
69
74
  buttonType: "text",
70
75
  className: "toolbar-trigger",
71
76
  "data-testid": "toolbar-trigger",
72
- icon: _MoreOptionsVert || (_MoreOptionsVert = /*#__PURE__*/_jsx__default["default"](MoreOptionsVert__default["default"], {})) // eslint-disable-next-line react/prop-types
77
+ icon: _MoreOptionsVert || (_MoreOptionsVert = /*#__PURE__*/_jsx__default["default"](dsIcons.MoreOptionsVert, {})) // eslint-disable-next-line react/prop-types
73
78
  ,
74
79
  index: rowData.index,
75
80
  onClick: () => setShow(true),
@@ -1,19 +1,21 @@
1
1
  'use strict';
2
2
 
3
+ require('core-js/modules/esnext.async-iterator.filter.js');
4
+ require('core-js/modules/esnext.iterator.constructor.js');
5
+ require('core-js/modules/esnext.iterator.filter.js');
6
+ require('core-js/modules/esnext.async-iterator.for-each.js');
7
+ require('core-js/modules/esnext.iterator.for-each.js');
3
8
  var _defineProperty = require('@babel/runtime/helpers/defineProperty');
4
9
  var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
5
10
  var React = require('react');
6
11
  var reactWindow = require('react-window');
7
- var utils = require('@elliemae/ds-utilities/utils');
8
- var system = require('@elliemae/ds-utilities/system');
9
- var useWindowScrollerList = require('@elliemae/ds-utilities/hooks/useWindowScrollerList');
12
+ var dsUtilities = require('@elliemae/ds-utilities');
10
13
  var jsxRuntime = require('react/jsx-runtime');
11
14
 
12
15
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
13
16
 
14
17
  var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
15
18
  var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
16
- var useWindowScrollerList__default = /*#__PURE__*/_interopDefaultLegacy(useWindowScrollerList);
17
19
 
18
20
  const _excluded = ["itemCount", "className", "innerRef", "itemData", "itemKey", "itemSize", "outerRef", "component"];
19
21
 
@@ -35,20 +37,20 @@ const AutoHeightList = /*#__PURE__*/React.forwardRef((_ref, ref) => {
35
37
 
36
38
  const listRef = React.useRef();
37
39
  const outerListRef = React.useRef();
38
- useWindowScrollerList__default["default"]({
40
+ dsUtilities.useWindowScrollerList({
39
41
  listInstance: listRef,
40
42
  outerListRef
41
43
  });
42
44
  return /*#__PURE__*/jsxRuntime.jsx(ListComponent, _objectSpread(_objectSpread({}, otherProps), {}, {
43
- ref: system.mergeRefs(ref, listRef),
44
- className: utils.cx(className, 'window-scroller-override'),
45
+ ref: dsUtilities.mergeRefs(ref, listRef),
46
+ className: dsUtilities.cx(className, 'window-scroller-override'),
45
47
  height: window.innerHeight,
46
48
  innerRef: innerRef,
47
49
  itemCount: itemCount,
48
50
  itemData: itemData,
49
51
  itemKey: itemKey,
50
52
  itemSize: itemSize,
51
- outerRef: system.mergeRefs(outerListRef, outerRef),
53
+ outerRef: dsUtilities.mergeRefs(outerListRef, outerRef),
52
54
  overscanCount: 10,
53
55
  useIsScrolling: true
54
56
  }));
@@ -2,13 +2,17 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ require('core-js/modules/esnext.async-iterator.filter.js');
6
+ require('core-js/modules/esnext.iterator.constructor.js');
7
+ require('core-js/modules/esnext.iterator.filter.js');
8
+ require('core-js/modules/esnext.async-iterator.for-each.js');
9
+ require('core-js/modules/esnext.iterator.for-each.js');
5
10
  var _jsx = require('@babel/runtime/helpers/jsx');
6
11
  var _defineProperty = require('@babel/runtime/helpers/defineProperty');
7
12
  var React = require('react');
8
13
  var lodash = require('lodash');
9
14
  var FocusGridManager = require('@elliemae/ds-shared/FocusGroup/FocusGrid');
10
- var utils = require('@elliemae/ds-utilities/utils');
11
- var system = require('@elliemae/ds-utilities/system');
15
+ var dsUtilities = require('@elliemae/ds-utilities');
12
16
  var createInstancePlugin = require('@elliemae/ds-shared/createDataInstance/createInstancePlugin');
13
17
  var VirtualizedBody = require('./VirtualizedBody.js');
14
18
  var jsxRuntime = require('react/jsx-runtime');
@@ -52,33 +56,36 @@ const VirtualizationPlugin = createInstancePlugin__default["default"]('virtualiz
52
56
  const listRef = React.useRef();
53
57
 
54
58
  const nextListProps = _objectSpread(_objectSpread({}, listProps), {}, {
55
- ref: system.mergeRefs(listRef, listProps.ref)
59
+ ref: dsUtilities.mergeRefs(listRef, listProps.ref)
56
60
  });
57
61
 
58
62
  return /*#__PURE__*/_jsx__default["default"](FocusGridManager__default["default"], {
59
63
  hotKeys: hotKeys,
60
- keyBindings: ({
61
- defaultBindings
62
- }) => _objectSpread(_objectSpread({}, defaultBindings), {}, {
63
- // todo: this is kind of hacky, since it's virtualized and there's
64
- // the possibility that the firsts or lasts rows aren't rendered
65
- Home: utils.runAll(e => {
66
- if (e.ctrlKey) {
67
- listRef.current.scrollToItem(0);
68
- setTimeout(() => defaultBindings.Home(e), 10);
69
- } else {
70
- defaultBindings.Home(e);
71
- }
72
- }),
73
- End: utils.runAll(e => {
74
- if (e.ctrlKey) {
75
- listRef.current.scrollToItem(rows.length - 1);
76
- setTimeout(() => defaultBindings.End(e), 10);
77
- } else {
78
- defaultBindings.End(e);
79
- }
80
- })
81
- }),
64
+ keyBindings: _ref => {
65
+ let {
66
+ defaultBindings
67
+ } = _ref;
68
+ return _objectSpread(_objectSpread({}, defaultBindings), {}, {
69
+ // todo: this is kind of hacky, since it's virtualized and there's
70
+ // the possibility that the firsts or lasts rows aren't rendered
71
+ Home: dsUtilities.runAll(e => {
72
+ if (e.ctrlKey) {
73
+ listRef.current.scrollToItem(0);
74
+ setTimeout(() => defaultBindings.Home(e), 10);
75
+ } else {
76
+ defaultBindings.Home(e);
77
+ }
78
+ }),
79
+ End: dsUtilities.runAll(e => {
80
+ if (e.ctrlKey) {
81
+ listRef.current.scrollToItem(rows.length - 1);
82
+ setTimeout(() => defaultBindings.End(e), 10);
83
+ } else {
84
+ defaultBindings.End(e);
85
+ }
86
+ })
87
+ });
88
+ },
82
89
  shouldRefocus: false
83
90
  }, void 0, /*#__PURE__*/jsxRuntime.jsx(VirtualizedBody, _objectSpread(_objectSpread({}, props), {}, {
84
91
  autoScrollToId: autoScrollToId,
@@ -3,9 +3,17 @@
3
3
  var _defineProperty = require('@babel/runtime/helpers/defineProperty');
4
4
  var _jsx = require('@babel/runtime/helpers/jsx');
5
5
  require('core-js/modules/web.dom-collections.iterator.js');
6
+ require('core-js/modules/esnext.async-iterator.reduce.js');
7
+ require('core-js/modules/esnext.iterator.constructor.js');
8
+ require('core-js/modules/esnext.iterator.reduce.js');
9
+ require('core-js/modules/esnext.async-iterator.map.js');
10
+ require('core-js/modules/esnext.iterator.map.js');
11
+ require('core-js/modules/esnext.async-iterator.filter.js');
12
+ require('core-js/modules/esnext.iterator.filter.js');
13
+ require('core-js/modules/esnext.async-iterator.for-each.js');
14
+ require('core-js/modules/esnext.iterator.for-each.js');
6
15
  var React = require('react');
7
- var system = require('@elliemae/ds-utilities/system');
8
- var utils = require('@elliemae/ds-utilities/utils');
16
+ var dsUtilities = require('@elliemae/ds-utilities');
9
17
  var NoResults = require('../../components/NoResults.js');
10
18
  var VirtualizedBodyRow = require('./VirtualizedBodyRow.js');
11
19
  var rowSizes = require('../../rowSizes.js');
@@ -98,9 +106,10 @@ const VirtualizedBody = props => {
98
106
  React.useEffect(() => {
99
107
  autoScrollTo(visibleHeight);
100
108
  }, [autoScrollToId, visibleHeight]);
101
- const handler = React.useCallback(utils.debounce(({
102
- target
103
- }) => {
109
+ const handler = React.useCallback(dsUtilities.debounce(_ref => {
110
+ let {
111
+ target
112
+ } = _ref;
104
113
  // Update coordinates
105
114
  setScrollTop(target.scrollTop || 0);
106
115
  }, 100), [setScrollTop]);
@@ -145,7 +154,7 @@ const VirtualizedBody = props => {
145
154
  if (virtualizedBodyRef) {
146
155
  const parsedVisibleHeight = parseFloat(window.getComputedStyle(virtualizedBodyRef, null).getPropertyValue('height')); // eslint-disable-next-line no-restricted-globals
147
156
 
148
- if (!utils.isNaN(parsedVisibleHeight)) {
157
+ if (!dsUtilities.isNaN(parsedVisibleHeight)) {
149
158
  setVisibleHeight(parsedVisibleHeight);
150
159
  autoScrollTo(parsedVisibleHeight);
151
160
  }
@@ -235,10 +244,10 @@ const VirtualizedBody = props => {
235
244
  setVirtualizedBodyRef(elem.parentElement); // eslint-disable-next-line no-param-reassign
236
245
 
237
246
  elem.parentElement.scrollTop = scrollTop;
238
- system.mergeRefs(listProps.outerRef)(elem.parentElement);
247
+ dsUtilities.mergeRefs(listProps.outerRef)(elem.parentElement);
239
248
  } else {
240
249
  setVirtualizedBodyRef(elem);
241
- system.mergeRefs(listProps.outerRef)(elem);
250
+ dsUtilities.mergeRefs(listProps.outerRef)(elem);
242
251
  }
243
252
  }
244
253
  },
@@ -247,7 +256,7 @@ const VirtualizedBody = props => {
247
256
  className: "virtualized-body".concat(hasScrollBar ? ' with-scrollbar' : ''),
248
257
  style: bodyStyle,
249
258
  ref: r => {
250
- system.mergeRefs(innerBody)(r);
259
+ dsUtilities.mergeRefs(innerBody)(r);
251
260
  },
252
261
  children: generateRenderedRows()
253
262
  })
@@ -1,12 +1,13 @@
1
1
  'use strict';
2
2
 
3
- function VirtualizedBodyRow({
4
- data,
5
- index,
6
- style,
7
- key,
8
- isScrolling
9
- }) {
3
+ function VirtualizedBodyRow(_ref) {
4
+ let {
5
+ data,
6
+ index,
7
+ style,
8
+ key,
9
+ isScrolling
10
+ } = _ref;
10
11
  const {
11
12
  rows,
12
13
  renderer: {