@elliemae/ds-data-table 2.0.0-rc.9 → 2.0.0

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 (70) hide show
  1. package/cjs/addons/Editables/TextEditableCell/TextEditableCell.js +16 -0
  2. package/cjs/addons/Filters/Components/CurrencyRangeFilter/index.js +4 -1
  3. package/cjs/addons/Filters/Components/DateSwitcherFilter/index.js +4 -1
  4. package/cjs/addons/Filters/Components/NumberRangeFilter/index.js +4 -1
  5. package/cjs/addons/Filters/Components/SelectFilter/BaseSelectFilter.js +3 -3
  6. package/cjs/exported-related/EditableCell.js +11 -5
  7. package/cjs/exported-related/FilterPopover.js +1 -1
  8. package/cjs/parts/HoC/withConditionalDnDColumnContext.js +20 -3
  9. package/cjs/parts/HoC/withConditionalDnDRowContext.js +2 -2
  10. package/cjs/styled.js +16 -11
  11. package/esm/addons/Editables/TextEditableCell/TextEditableCell.js +16 -0
  12. package/esm/addons/Filters/Components/CurrencyRangeFilter/index.js +4 -1
  13. package/esm/addons/Filters/Components/DateSwitcherFilter/index.js +4 -1
  14. package/esm/addons/Filters/Components/NumberRangeFilter/index.js +4 -1
  15. package/esm/addons/Filters/Components/SelectFilter/BaseSelectFilter.js +3 -3
  16. package/esm/exported-related/EditableCell.js +11 -5
  17. package/esm/exported-related/FilterPopover.js +1 -1
  18. package/esm/parts/HoC/withConditionalDnDColumnContext.js +19 -2
  19. package/esm/parts/HoC/withConditionalDnDRowContext.js +1 -1
  20. package/esm/styled.js +16 -11
  21. package/package.json +18 -81
  22. package/types/styled.d.ts +3 -1
  23. package/cjs/helpers/dndkit/hierarchy/customCollisionDetection.js +0 -89
  24. package/cjs/helpers/dndkit/hierarchy/getHierarchyKeyboardCoordinates.js +0 -143
  25. package/cjs/helpers/dndkit/hierarchy/types.js +0 -2
  26. package/cjs/helpers/dndkit/hierarchy/useHierarchyActionHandlers.js +0 -55
  27. package/cjs/helpers/dndkit/hierarchy/useHierarchyAnnouncements.js +0 -36
  28. package/cjs/helpers/dndkit/hierarchy/useHierarchyDndkitConfig.js +0 -111
  29. package/cjs/helpers/dndkit/hierarchy/useHierarchyPreviewHandlers.js +0 -87
  30. package/cjs/helpers/dndkit/tree/customCollisionDetection.js +0 -118
  31. package/cjs/helpers/dndkit/tree/getTreeKeyboardCoordinates.js +0 -134
  32. package/cjs/helpers/dndkit/tree/types.js +0 -2
  33. package/cjs/helpers/dndkit/tree/useTreeActionHandlers.js +0 -75
  34. package/cjs/helpers/dndkit/tree/useTreeAnnouncements.js +0 -55
  35. package/cjs/helpers/dndkit/tree/useTreeDndkitConfig.js +0 -141
  36. package/cjs/helpers/dndkit/tree/useTreePreviewHandlers.js +0 -54
  37. package/cjs/helpers/dndkit/types.js +0 -2
  38. package/cjs/helpers/dndkit/utilities.js +0 -52
  39. package/esm/helpers/dndkit/hierarchy/customCollisionDetection.js +0 -85
  40. package/esm/helpers/dndkit/hierarchy/getHierarchyKeyboardCoordinates.js +0 -135
  41. package/esm/helpers/dndkit/hierarchy/types.js +0 -1
  42. package/esm/helpers/dndkit/hierarchy/useHierarchyActionHandlers.js +0 -51
  43. package/esm/helpers/dndkit/hierarchy/useHierarchyAnnouncements.js +0 -32
  44. package/esm/helpers/dndkit/hierarchy/useHierarchyDndkitConfig.js +0 -105
  45. package/esm/helpers/dndkit/hierarchy/useHierarchyPreviewHandlers.js +0 -83
  46. package/esm/helpers/dndkit/tree/customCollisionDetection.js +0 -114
  47. package/esm/helpers/dndkit/tree/getTreeKeyboardCoordinates.js +0 -126
  48. package/esm/helpers/dndkit/tree/types.js +0 -1
  49. package/esm/helpers/dndkit/tree/useTreeActionHandlers.js +0 -71
  50. package/esm/helpers/dndkit/tree/useTreeAnnouncements.js +0 -51
  51. package/esm/helpers/dndkit/tree/useTreeDndkitConfig.js +0 -135
  52. package/esm/helpers/dndkit/tree/useTreePreviewHandlers.js +0 -50
  53. package/esm/helpers/dndkit/types.js +0 -1
  54. package/esm/helpers/dndkit/utilities.js +0 -47
  55. package/types/helpers/dndkit/hierarchy/customCollisionDetection.d.ts +0 -3
  56. package/types/helpers/dndkit/hierarchy/getHierarchyKeyboardCoordinates.d.ts +0 -3
  57. package/types/helpers/dndkit/hierarchy/types.d.ts +0 -66
  58. package/types/helpers/dndkit/hierarchy/useHierarchyActionHandlers.d.ts +0 -2
  59. package/types/helpers/dndkit/hierarchy/useHierarchyAnnouncements.d.ts +0 -3
  60. package/types/helpers/dndkit/hierarchy/useHierarchyDndkitConfig.d.ts +0 -3
  61. package/types/helpers/dndkit/hierarchy/useHierarchyPreviewHandlers.d.ts +0 -2
  62. package/types/helpers/dndkit/tree/customCollisionDetection.d.ts +0 -4
  63. package/types/helpers/dndkit/tree/getTreeKeyboardCoordinates.d.ts +0 -3
  64. package/types/helpers/dndkit/tree/types.d.ts +0 -82
  65. package/types/helpers/dndkit/tree/useTreeActionHandlers.d.ts +0 -2
  66. package/types/helpers/dndkit/tree/useTreeAnnouncements.d.ts +0 -4
  67. package/types/helpers/dndkit/tree/useTreeDndkitConfig.d.ts +0 -3
  68. package/types/helpers/dndkit/tree/useTreePreviewHandlers.d.ts +0 -2
  69. package/types/helpers/dndkit/types.d.ts +0 -20
  70. package/types/helpers/dndkit/utilities.d.ts +0 -7
@@ -79,15 +79,31 @@ const TextEditableCell = props => {
79
79
  rowIndex
80
80
  });
81
81
  }, [value, onCellValueChange, cell.column.id, cell.row.index]);
82
+ const handleOnKeyDown = React.useCallback(e => {
83
+ if (e.code === 'Enter') {
84
+ cell.ref.current.focus(); // will exec on blur callback from input and save new value
85
+ }
86
+
87
+ if (e.code === 'Escape') {
88
+ setValue(cell.value);
89
+ const auxRef = cell.ref.current; // this prevent the on blur
90
+
91
+ setTimeout(() => {
92
+ auxRef.focus();
93
+ });
94
+ }
95
+ }, [cell]);
82
96
  return /*#__PURE__*/_jsx__default["default"](EditableCell.EditableCell, {
83
97
  StandardRender: DefaultCellRender,
84
98
  EditableRenderer: /*#__PURE__*/_jsx__default["default"](StyledInput, {
85
99
  value: value,
100
+ onKeyDown: handleOnKeyDown,
86
101
  onChange: handleOnChange,
87
102
  onBlur: handleOnBlur,
88
103
  autoFocus: true
89
104
  }),
90
105
  cell: cell,
106
+ setValue: setValue,
91
107
  isRowSelected: isRowSelected
92
108
  });
93
109
  };
@@ -117,7 +117,10 @@ const CurrencyRangeFilter = props => {
117
117
  "data-testid": constants.DATA_TESTID.DATA_TABLE_CURRENCY_RANGE_CONTROLLER,
118
118
  gutter: "xxxs",
119
119
  padding: "xxs",
120
- cols: ['auto', 'auto']
120
+ cols: ['auto', 'auto'],
121
+ style: {
122
+ background: 'white'
123
+ }
121
124
  }, void 0, /*#__PURE__*/_jsx__default["default"](dsFormLayoutBlocks.DSFormLayoutBlockItem, {
122
125
  label: "Min",
123
126
  inputID: "".concat(idPreffix, "-min-").concat(column.id)
@@ -92,7 +92,10 @@ const DateSwitcherFilter = props => {
92
92
  "data-testid": constants.DATA_TESTID.DATA_TABLE_DATE_RANGE_CONTROLLER
93
93
  }, void 0, /*#__PURE__*/_jsx__default["default"](Grid__default["default"], {
94
94
  p: "xxs",
95
- gutter: "xxs"
95
+ gutter: "xxs",
96
+ style: {
97
+ background: 'white'
98
+ }
96
99
  }, void 0, /*#__PURE__*/_jsx__default["default"](dsControlledForm.DSControlledCheckbox, {
97
100
  checked: isDateRange,
98
101
  name: "Date range",
@@ -120,7 +120,10 @@ const NumberRangeFilter = props => {
120
120
  "data-testid": constants.DATA_TESTID.DATA_TABLE_NUMBER_RANGE_CONTROLLER,
121
121
  gutter: "xxxs",
122
122
  padding: "xxs",
123
- cols: ['auto', 'auto']
123
+ cols: ['auto', 'auto'],
124
+ style: {
125
+ background: 'white'
126
+ }
124
127
  }, void 0, /*#__PURE__*/_jsx__default["default"](dsFormLayoutBlocks.DSFormLayoutBlockItem, {
125
128
  label: "Low",
126
129
  inputID: "".concat(idPreffix, "-low-").concat(column.id)
@@ -140,7 +140,8 @@ const BaseSelectFilter = props => {
140
140
  options: filters,
141
141
  onChange: handleOnChange,
142
142
  selectedValues: selectedItems,
143
- onFilter: handleOnFilter
143
+ onFilter: handleOnFilter,
144
+ menuMaxHeight: 300
144
145
  }));
145
146
 
146
147
  const handleOnClickOutside = () => {
@@ -157,8 +158,7 @@ const BaseSelectFilter = props => {
157
158
  ariaLabel: "Open Selection Filter",
158
159
  onClickOutsideMenu: handleOnClickOutside,
159
160
  customStyles: {
160
- width: (_column$ref$current$o = (_column$ref = column.ref) === null || _column$ref === void 0 ? void 0 : (_column$ref$current = _column$ref.current) === null || _column$ref$current === void 0 ? void 0 : _column$ref$current.offsetWidth) !== null && _column$ref$current$o !== void 0 ? _column$ref$current$o : '0px',
161
- maxHeight: '300px'
161
+ width: (_column$ref$current$o = (_column$ref = column.ref) === null || _column$ref === void 0 ? void 0 : (_column$ref$current = _column$ref.current) === null || _column$ref$current === void 0 ? void 0 : _column$ref$current.offsetWidth) !== null && _column$ref$current$o !== void 0 ? _column$ref$current$o : '0px'
162
162
  }
163
163
  });
164
164
  };
@@ -19,7 +19,8 @@ const EditableCell = props => {
19
19
  StandardRender,
20
20
  EditableRenderer,
21
21
  cell,
22
- isRowSelected
22
+ isRowSelected,
23
+ setValue
23
24
  } = props;
24
25
  const {
25
26
  virtualListHelpers
@@ -41,20 +42,25 @@ const EditableCell = props => {
41
42
  }
42
43
  }, [isEditing]);
43
44
  const handleOnKeyDown = React.useCallback(e => {
44
- if (isEditing) e.stopPropagation();
45
+ if (isEditing) {
46
+ e.stopPropagation();
45
47
 
46
- if (['Enter', 'Space'].includes(e.code)) {
48
+ if (['Enter', 'Escape'].includes(e.code)) {
49
+ setIsEditing(false);
50
+ }
51
+ } else if (['Enter', 'Space'].includes(e.code)) {
47
52
  handleCellClick(e);
48
53
  }
49
- }, [isEditing, handleCellClick]);
54
+ }, [isEditing, handleCellClick, setIsEditing]);
50
55
  const handleOnBlur = React.useCallback(event => {
51
56
  if (isEditing && !event.currentTarget.contains(event.relatedTarget)) {
52
57
  // Not triggered when swapping focus between children
53
58
  setIsEditing(false);
54
59
  }
55
60
  }, [isEditing]);
61
+ const cols = !isEditing ? ['auto', 'min-content'] : ['auto'];
56
62
  return /*#__PURE__*/jsxRuntime.jsxs(styled.StyledEditableContainer, {
57
- cols: !isEditing ? ['auto', 'min-content'] : ['auto'],
63
+ cols: cols,
58
64
  tabIndex: isRowSelected && !isEditing ? 0 : -1,
59
65
  ref: cell.ref,
60
66
  onClick: handleCellClick,
@@ -54,7 +54,7 @@ const Button = /*#__PURE__*/styled__default["default"](DSButton__default["defaul
54
54
  })(["position:relative;justify-self:flex-end;"]);
55
55
  const PopperContent = /*#__PURE__*/styled__default["default"].div.withConfig({
56
56
  componentId: "sc-16i88ut-2"
57
- })(["background-color:'#fff';"]);
57
+ })(["background-color:#fff;"]);
58
58
  const FilterPopover = _ref2 => {
59
59
  var _column$ref$current$o, _column$ref, _column$ref$current;
60
60
 
@@ -14,10 +14,11 @@ require('core-js/modules/esnext.async-iterator.filter.js');
14
14
  require('core-js/modules/esnext.iterator.filter.js');
15
15
  var React = require('react');
16
16
  var core = require('@dnd-kit/core');
17
+ var dsDragAndDrop = require('@elliemae/ds-drag-and-drop');
17
18
  var sortable = require('@dnd-kit/sortable');
18
- var useHierarchyDndkitConfig = require('../../helpers/dndkit/hierarchy/useHierarchyDndkitConfig.js');
19
19
  var DataTableContext = require('../../DataTableContext.js');
20
20
  var HeaderCellGroup = require('../Headers/HeaderCellGroup.js');
21
+ var constants = require('../../configs/constants.js');
21
22
  var jsxRuntime = require('react/jsx-runtime');
22
23
 
23
24
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -86,14 +87,30 @@ const withConditionalDnDColumnContext = Component => props => {
86
87
  });
87
88
  onColumnsReorder(newData, indexes);
88
89
  }, [flattenedItems, onColumnsReorder]);
90
+ const onPreviewResetState = React.useCallback(() => {
91
+ const el = document.body.querySelector("[data-testid=\"".concat(constants.DATA_TESTID.DATA_TABLE_SCROLLABLE_CONTAINER, "\"]"));
92
+ if (el) el.onscroll = () => null;
93
+ }, []);
94
+ const onPreviewDragStart = React.useCallback(() => {
95
+ const el = document.body.querySelector("[data-testid=\"".concat(constants.DATA_TESTID.DATA_TABLE_SCROLLABLE_CONTAINER, "\"]"));
96
+
97
+ if (el) {
98
+ const y = el.scrollTop;
99
+
100
+ el.onscroll = () => el.scrollTo(0, y);
101
+ }
102
+ }, []);
89
103
  const {
90
104
  dndContextProps,
91
105
  activeId,
92
106
  activeIndex
93
- } = useHierarchyDndkitConfig({
107
+ } = dsDragAndDrop.useHierarchyDndkitConfig({
94
108
  flattenedItems,
109
+ dragOverlayDataTestid: constants.DATA_TESTID.DATA_TABLE_COLUMN_DRAG_OVERLAY,
95
110
  isHorizontalDnD: true,
96
- onReorder
111
+ onReorder,
112
+ onPreviewResetState,
113
+ onPreviewDragStart
97
114
  });
98
115
  if (dragAndDropColumns) return /*#__PURE__*/jsxRuntime.jsxs(core.DndContext, _objectSpread(_objectSpread({}, dndContextProps), {}, {
99
116
  children: [/*#__PURE__*/_jsx__default["default"](DnDGroupContext.Provider, {
@@ -16,7 +16,7 @@ var React = require('react');
16
16
  var core = require('@dnd-kit/core');
17
17
  var sortable = require('@dnd-kit/sortable');
18
18
  var DataTableContext = require('../../DataTableContext.js');
19
- var useTreeDndkitConfig = require('../../helpers/dndkit/tree/useTreeDndkitConfig.js');
19
+ var dsDragAndDrop = require('@elliemae/ds-drag-and-drop');
20
20
  var SortableItemContext = require('./SortableItemContext.js');
21
21
  var Row = require('../Row.js');
22
22
  var jsxRuntime = require('react/jsx-runtime');
@@ -78,7 +78,7 @@ const withConditionalDnDRowContext = Component => props => {
78
78
  depth,
79
79
  dropIndicatorPosition,
80
80
  visibleItems
81
- } = useTreeDndkitConfig({
81
+ } = dsDragAndDrop.useTreeDndkitConfig({
82
82
  flattenedItems: allDataFlattened,
83
83
  visibleItems: flattenedData,
84
84
  isHorizontalDnD: false,
package/cjs/styled.js CHANGED
@@ -158,22 +158,27 @@ const StyledPencilIcon = /*#__PURE__*/styled__default["default"](dsIcons.EditPen
158
158
  })([""]);
159
159
  const StyledEditableContainer = /*#__PURE__*/styled__default["default"](Grid__default["default"]).withConfig({
160
160
  componentId: "sc-38sgfo-14"
161
- })(["width:100%;height:100%;align-items:center;& ", "{display:", ";}&:hover{", "{display:block;}}&:focus{", " ", "{display:block;}}outline:none;"], StyledPencilIcon, props => props.shouldDisplayEditIcon ? 'block' : 'none', StyledPencilIcon, styledFocusCss, StyledPencilIcon); // ROW ************************************************************************/
161
+ })(["width:100%;height:100%;align-items:center;& ", "{display:", ";}&:hover{", "{display:block;}}&:focus{", " ", "{display:block;}}outline:none;"], StyledPencilIcon, _ref8 => {
162
+ let {
163
+ shouldDisplayEditIcon
164
+ } = _ref8;
165
+ return shouldDisplayEditIcon ? 'block' : 'none';
166
+ }, StyledPencilIcon, styledFocusCss, StyledPencilIcon); // ROW ************************************************************************/
162
167
 
163
168
  const StyledFullsizeGrid = /*#__PURE__*/styled__default["default"](Grid__default["default"]).withConfig({
164
169
  componentId: "sc-38sgfo-15"
165
170
  })(["position:relative;z-index:", ";min-height:", ";height:", ";"], zIndexInternalConfig.ZIndexDataTable.ROW, props => props.minHeight || '36px', props => props.height || 'auto');
166
171
  const GroupHeaderContainer = /*#__PURE__*/styled__default["default"](Grid__default["default"]).withConfig({
167
172
  componentId: "sc-38sgfo-16"
168
- })(["position:relative;background-color:", ";align-items:center;padding:0 ", ";border-top:1px solid ", ";grid-template-columns:min-content 1fr;"], _ref8 => {
173
+ })(["position:relative;background-color:", ";align-items:center;padding:0 ", ";border-top:1px solid ", ";grid-template-columns:min-content 1fr;"], _ref9 => {
169
174
  let {
170
175
  theme
171
- } = _ref8;
176
+ } = _ref9;
172
177
  return theme.colors.brand[200];
173
- }, props => props.padding, _ref9 => {
178
+ }, props => props.padding, _ref10 => {
174
179
  let {
175
180
  theme
176
- } = _ref9;
181
+ } = _ref10;
177
182
  return theme.colors.brand[300];
178
183
  });
179
184
  const GroupHeaderTitle = /*#__PURE__*/styled__default["default"].span.withConfig({
@@ -185,27 +190,27 @@ const StyledCellContainer = /*#__PURE__*/styled__default["default"](Grid__defaul
185
190
  cols: props.cols,
186
191
  colsLayoutStyle: props.colLayoutStyle,
187
192
  isExpandable: props.isExpandable
188
- }), _ref10 => {
193
+ }), _ref11 => {
189
194
  let {
190
195
  backgroundColor,
191
196
  isDragging,
192
197
  theme
193
- } = _ref10;
198
+ } = _ref11;
194
199
  return isDragging ? theme.colors.neutral[100] : backgroundColor || 'white';
195
- }, props => props.isDragOverlay ? '' : styledFocusCss(props), _ref11 => {
200
+ }, props => props.isDragOverlay ? '' : styledFocusCss(props), _ref12 => {
196
201
  let {
197
202
  isDropIndicatorPositionInside,
198
203
  theme
199
- } = _ref11;
204
+ } = _ref12;
200
205
  if (!isDropIndicatorPositionInside) return '';
201
206
  return styledFocusCss({
202
207
  theme
203
208
  });
204
- }, _ref12 => {
209
+ }, _ref13 => {
205
210
  let {
206
211
  shouldDisplayHover,
207
212
  theme
208
- } = _ref12;
213
+ } = _ref13;
209
214
  return shouldDisplayHover ? ":hover {\n background-color: ".concat(theme.colors.brand[200], ";\n }") : '';
210
215
  }, props => props.isDragOverlay ? 'rgba(0,0,0,0.5)' : 'transparent', props => props.isDragging ? 0.8 : 1, props => !props.selected ? '' : "\n background-color: ".concat(props.theme.colors.brand[200], ";\n border: 1px solid ").concat(props.theme.colors.brand[500], ";\n "), props => props.disabled ? props.theme.colors.neutral['500'] : '#333333');
211
216
 
@@ -70,15 +70,31 @@ const TextEditableCell = props => {
70
70
  rowIndex
71
71
  });
72
72
  }, [value, onCellValueChange, cell.column.id, cell.row.index]);
73
+ const handleOnKeyDown = useCallback(e => {
74
+ if (e.code === 'Enter') {
75
+ cell.ref.current.focus(); // will exec on blur callback from input and save new value
76
+ }
77
+
78
+ if (e.code === 'Escape') {
79
+ setValue(cell.value);
80
+ const auxRef = cell.ref.current; // this prevent the on blur
81
+
82
+ setTimeout(() => {
83
+ auxRef.focus();
84
+ });
85
+ }
86
+ }, [cell]);
73
87
  return /*#__PURE__*/_jsx(EditableCell, {
74
88
  StandardRender: DefaultCellRender,
75
89
  EditableRenderer: /*#__PURE__*/_jsx(StyledInput, {
76
90
  value: value,
91
+ onKeyDown: handleOnKeyDown,
77
92
  onChange: handleOnChange,
78
93
  onBlur: handleOnBlur,
79
94
  autoFocus: true
80
95
  }),
81
96
  cell: cell,
97
+ setValue: setValue,
82
98
  isRowSelected: isRowSelected
83
99
  });
84
100
  };
@@ -107,7 +107,10 @@ const CurrencyRangeFilter = props => {
107
107
  "data-testid": DATA_TESTID.DATA_TABLE_CURRENCY_RANGE_CONTROLLER,
108
108
  gutter: "xxxs",
109
109
  padding: "xxs",
110
- cols: ['auto', 'auto']
110
+ cols: ['auto', 'auto'],
111
+ style: {
112
+ background: 'white'
113
+ }
111
114
  }, void 0, /*#__PURE__*/_jsx(DSFormLayoutBlockItem, {
112
115
  label: "Min",
113
116
  inputID: "".concat(idPreffix, "-min-").concat(column.id)
@@ -83,7 +83,10 @@ const DateSwitcherFilter = props => {
83
83
  "data-testid": DATA_TESTID.DATA_TABLE_DATE_RANGE_CONTROLLER
84
84
  }, void 0, /*#__PURE__*/_jsx(Grid, {
85
85
  p: "xxs",
86
- gutter: "xxs"
86
+ gutter: "xxs",
87
+ style: {
88
+ background: 'white'
89
+ }
87
90
  }, void 0, /*#__PURE__*/_jsx(DSControlledCheckbox, {
88
91
  checked: isDateRange,
89
92
  name: "Date range",
@@ -110,7 +110,10 @@ const NumberRangeFilter = props => {
110
110
  "data-testid": DATA_TESTID.DATA_TABLE_NUMBER_RANGE_CONTROLLER,
111
111
  gutter: "xxxs",
112
112
  padding: "xxs",
113
- cols: ['auto', 'auto']
113
+ cols: ['auto', 'auto'],
114
+ style: {
115
+ background: 'white'
116
+ }
114
117
  }, void 0, /*#__PURE__*/_jsx(DSFormLayoutBlockItem, {
115
118
  label: "Low",
116
119
  inputID: "".concat(idPreffix, "-low-").concat(column.id)
@@ -132,7 +132,8 @@ const BaseSelectFilter = props => {
132
132
  options: filters,
133
133
  onChange: handleOnChange,
134
134
  selectedValues: selectedItems,
135
- onFilter: handleOnFilter
135
+ onFilter: handleOnFilter,
136
+ menuMaxHeight: 300
136
137
  }));
137
138
 
138
139
  const handleOnClickOutside = () => {
@@ -149,8 +150,7 @@ const BaseSelectFilter = props => {
149
150
  ariaLabel: "Open Selection Filter",
150
151
  onClickOutsideMenu: handleOnClickOutside,
151
152
  customStyles: {
152
- width: (_column$ref$current$o = (_column$ref = column.ref) === null || _column$ref === void 0 ? void 0 : (_column$ref$current = _column$ref.current) === null || _column$ref$current === void 0 ? void 0 : _column$ref$current.offsetWidth) !== null && _column$ref$current$o !== void 0 ? _column$ref$current$o : '0px',
153
- maxHeight: '300px'
153
+ width: (_column$ref$current$o = (_column$ref = column.ref) === null || _column$ref === void 0 ? void 0 : (_column$ref$current = _column$ref.current) === null || _column$ref$current === void 0 ? void 0 : _column$ref$current.offsetWidth) !== null && _column$ref$current$o !== void 0 ? _column$ref$current$o : '0px'
154
154
  }
155
155
  });
156
156
  };
@@ -11,7 +11,8 @@ const EditableCell = props => {
11
11
  StandardRender,
12
12
  EditableRenderer,
13
13
  cell,
14
- isRowSelected
14
+ isRowSelected,
15
+ setValue
15
16
  } = props;
16
17
  const {
17
18
  virtualListHelpers
@@ -33,20 +34,25 @@ const EditableCell = props => {
33
34
  }
34
35
  }, [isEditing]);
35
36
  const handleOnKeyDown = useCallback(e => {
36
- if (isEditing) e.stopPropagation();
37
+ if (isEditing) {
38
+ e.stopPropagation();
37
39
 
38
- if (['Enter', 'Space'].includes(e.code)) {
40
+ if (['Enter', 'Escape'].includes(e.code)) {
41
+ setIsEditing(false);
42
+ }
43
+ } else if (['Enter', 'Space'].includes(e.code)) {
39
44
  handleCellClick(e);
40
45
  }
41
- }, [isEditing, handleCellClick]);
46
+ }, [isEditing, handleCellClick, setIsEditing]);
42
47
  const handleOnBlur = useCallback(event => {
43
48
  if (isEditing && !event.currentTarget.contains(event.relatedTarget)) {
44
49
  // Not triggered when swapping focus between children
45
50
  setIsEditing(false);
46
51
  }
47
52
  }, [isEditing]);
53
+ const cols = !isEditing ? ['auto', 'min-content'] : ['auto'];
48
54
  return /*#__PURE__*/jsxs(StyledEditableContainer, {
49
- cols: !isEditing ? ['auto', 'min-content'] : ['auto'],
55
+ cols: cols,
50
56
  tabIndex: isRowSelected && !isEditing ? 0 : -1,
51
57
  ref: cell.ref,
52
58
  onClick: handleCellClick,
@@ -43,7 +43,7 @@ const Button = /*#__PURE__*/styled(DSButton).withConfig({
43
43
  })(["position:relative;justify-self:flex-end;"]);
44
44
  const PopperContent = /*#__PURE__*/styled.div.withConfig({
45
45
  componentId: "sc-16i88ut-2"
46
- })(["background-color:'#fff';"]);
46
+ })(["background-color:#fff;"]);
47
47
  const FilterPopover = _ref2 => {
48
48
  var _column$ref$current$o, _column$ref, _column$ref$current;
49
49
 
@@ -10,10 +10,11 @@ import 'core-js/modules/esnext.async-iterator.find.js';
10
10
  import 'core-js/modules/esnext.iterator.find.js';
11
11
  import React, { useMemo, useCallback, createContext } from 'react';
12
12
  import { DndContext, DragOverlay } from '@dnd-kit/core';
13
+ import { useHierarchyDndkitConfig } from '@elliemae/ds-drag-and-drop';
13
14
  import { arrayMove } from '@dnd-kit/sortable';
14
- import useHierarchyDndkitConfig from '../../helpers/dndkit/hierarchy/useHierarchyDndkitConfig.js';
15
15
  import DataTableContext from '../../DataTableContext.js';
16
16
  import { HeaderCellGroup } from '../Headers/HeaderCellGroup.js';
17
+ import { DATA_TESTID } from '../../configs/constants.js';
17
18
  import { jsxs, jsx } from 'react/jsx-runtime';
18
19
 
19
20
  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; }
@@ -76,14 +77,30 @@ const withConditionalDnDColumnContext = Component => props => {
76
77
  });
77
78
  onColumnsReorder(newData, indexes);
78
79
  }, [flattenedItems, onColumnsReorder]);
80
+ const onPreviewResetState = useCallback(() => {
81
+ const el = document.body.querySelector("[data-testid=\"".concat(DATA_TESTID.DATA_TABLE_SCROLLABLE_CONTAINER, "\"]"));
82
+ if (el) el.onscroll = () => null;
83
+ }, []);
84
+ const onPreviewDragStart = useCallback(() => {
85
+ const el = document.body.querySelector("[data-testid=\"".concat(DATA_TESTID.DATA_TABLE_SCROLLABLE_CONTAINER, "\"]"));
86
+
87
+ if (el) {
88
+ const y = el.scrollTop;
89
+
90
+ el.onscroll = () => el.scrollTo(0, y);
91
+ }
92
+ }, []);
79
93
  const {
80
94
  dndContextProps,
81
95
  activeId,
82
96
  activeIndex
83
97
  } = useHierarchyDndkitConfig({
84
98
  flattenedItems,
99
+ dragOverlayDataTestid: DATA_TESTID.DATA_TABLE_COLUMN_DRAG_OVERLAY,
85
100
  isHorizontalDnD: true,
86
- onReorder
101
+ onReorder,
102
+ onPreviewResetState,
103
+ onPreviewDragStart
87
104
  });
88
105
  if (dragAndDropColumns) return /*#__PURE__*/jsxs(DndContext, _objectSpread(_objectSpread({}, dndContextProps), {}, {
89
106
  children: [/*#__PURE__*/_jsx(DnDGroupContext.Provider, {
@@ -12,7 +12,7 @@ import React, { createContext, useCallback } from 'react';
12
12
  import { DndContext, DragOverlay } from '@dnd-kit/core';
13
13
  import { SortableContext } from '@dnd-kit/sortable';
14
14
  import DataTableContext from '../../DataTableContext.js';
15
- import useTreeDndkitConfig from '../../helpers/dndkit/tree/useTreeDndkitConfig.js';
15
+ import { useTreeDndkitConfig } from '@elliemae/ds-drag-and-drop';
16
16
  import { DropIndicatorPosition } from './SortableItemContext.js';
17
17
  import { Row } from '../Row.js';
18
18
  import { jsxs, jsx } from 'react/jsx-runtime';
package/esm/styled.js CHANGED
@@ -149,22 +149,27 @@ const StyledPencilIcon = /*#__PURE__*/styled(EditPencil).withConfig({
149
149
  })([""]);
150
150
  const StyledEditableContainer = /*#__PURE__*/styled(Grid).withConfig({
151
151
  componentId: "sc-38sgfo-14"
152
- })(["width:100%;height:100%;align-items:center;& ", "{display:", ";}&:hover{", "{display:block;}}&:focus{", " ", "{display:block;}}outline:none;"], StyledPencilIcon, props => props.shouldDisplayEditIcon ? 'block' : 'none', StyledPencilIcon, styledFocusCss, StyledPencilIcon); // ROW ************************************************************************/
152
+ })(["width:100%;height:100%;align-items:center;& ", "{display:", ";}&:hover{", "{display:block;}}&:focus{", " ", "{display:block;}}outline:none;"], StyledPencilIcon, _ref8 => {
153
+ let {
154
+ shouldDisplayEditIcon
155
+ } = _ref8;
156
+ return shouldDisplayEditIcon ? 'block' : 'none';
157
+ }, StyledPencilIcon, styledFocusCss, StyledPencilIcon); // ROW ************************************************************************/
153
158
 
154
159
  const StyledFullsizeGrid = /*#__PURE__*/styled(Grid).withConfig({
155
160
  componentId: "sc-38sgfo-15"
156
161
  })(["position:relative;z-index:", ";min-height:", ";height:", ";"], ZIndexDataTable.ROW, props => props.minHeight || '36px', props => props.height || 'auto');
157
162
  const GroupHeaderContainer = /*#__PURE__*/styled(Grid).withConfig({
158
163
  componentId: "sc-38sgfo-16"
159
- })(["position:relative;background-color:", ";align-items:center;padding:0 ", ";border-top:1px solid ", ";grid-template-columns:min-content 1fr;"], _ref8 => {
164
+ })(["position:relative;background-color:", ";align-items:center;padding:0 ", ";border-top:1px solid ", ";grid-template-columns:min-content 1fr;"], _ref9 => {
160
165
  let {
161
166
  theme
162
- } = _ref8;
167
+ } = _ref9;
163
168
  return theme.colors.brand[200];
164
- }, props => props.padding, _ref9 => {
169
+ }, props => props.padding, _ref10 => {
165
170
  let {
166
171
  theme
167
- } = _ref9;
172
+ } = _ref10;
168
173
  return theme.colors.brand[300];
169
174
  });
170
175
  const GroupHeaderTitle = /*#__PURE__*/styled.span.withConfig({
@@ -176,27 +181,27 @@ const StyledCellContainer = /*#__PURE__*/styled(Grid).withConfig({
176
181
  cols: props.cols,
177
182
  colsLayoutStyle: props.colLayoutStyle,
178
183
  isExpandable: props.isExpandable
179
- }), _ref10 => {
184
+ }), _ref11 => {
180
185
  let {
181
186
  backgroundColor,
182
187
  isDragging,
183
188
  theme
184
- } = _ref10;
189
+ } = _ref11;
185
190
  return isDragging ? theme.colors.neutral[100] : backgroundColor || 'white';
186
- }, props => props.isDragOverlay ? '' : styledFocusCss(props), _ref11 => {
191
+ }, props => props.isDragOverlay ? '' : styledFocusCss(props), _ref12 => {
187
192
  let {
188
193
  isDropIndicatorPositionInside,
189
194
  theme
190
- } = _ref11;
195
+ } = _ref12;
191
196
  if (!isDropIndicatorPositionInside) return '';
192
197
  return styledFocusCss({
193
198
  theme
194
199
  });
195
- }, _ref12 => {
200
+ }, _ref13 => {
196
201
  let {
197
202
  shouldDisplayHover,
198
203
  theme
199
- } = _ref12;
204
+ } = _ref13;
200
205
  return shouldDisplayHover ? ":hover {\n background-color: ".concat(theme.colors.brand[200], ";\n }") : '';
201
206
  }, props => props.isDragOverlay ? 'rgba(0,0,0,0.5)' : 'transparent', props => props.isDragging ? 0.8 : 1, props => !props.selected ? '' : "\n background-color: ".concat(props.theme.colors.brand[200], ";\n border: 1px solid ").concat(props.theme.colors.brand[500], ";\n "), props => props.disabled ? props.theme.colors.neutral['500'] : '#333333');
202
207