@elliemae/ds-data-table 2.4.2 → 2.4.3-rc.10

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 (46) hide show
  1. package/cjs/DataTable.js +10 -1
  2. package/cjs/DataTableSchema.js +5 -0
  3. package/cjs/addons/Editables/ComboboxEditableCell/ComboboxEditableCell.js +1 -1
  4. package/cjs/addons/Editables/DateEditableCell/DateEditableCell.js +1 -1
  5. package/cjs/addons/Editables/TextEditableCell/TextEditableCell.js +1 -1
  6. package/cjs/addons/Filters/Components/SelectFilter/BaseSelectFilter.js +6 -0
  7. package/cjs/addons/Filters/Components/SelectFilter/MultiSelectFilter.js +1 -1
  8. package/cjs/addons/Filters/Components/SelectFilter/SingleSelectFilter.js +1 -1
  9. package/cjs/configs/useDatatableConfig.js +5 -1
  10. package/cjs/exported-related/EditableCell.js +1 -2
  11. package/cjs/exported-related/FilterPopover.js +29 -27
  12. package/cjs/exported-related/RowRenderer/DefaultRowContentRenderer.js +8 -1
  13. package/cjs/exported-related/RowRenderer/useRowRendererHandlers.js +25 -7
  14. package/cjs/exported-related/Toolbar/Toolbar.js +3 -10
  15. package/cjs/parts/Cells/Cell.js +3 -2
  16. package/cjs/parts/FilterBar/FiltersBar.js +29 -2
  17. package/cjs/parts/Filters/index.js +1 -1
  18. package/cjs/parts/Headers/HeaderResizer.js +1 -1
  19. package/cjs/parts/Row.js +17 -1
  20. package/cjs/parts/RowVariants/index.js +1 -1
  21. package/cjs/parts/TableContent.js +1 -1
  22. package/cjs/styled.js +36 -39
  23. package/esm/DataTable.js +10 -1
  24. package/esm/DataTableSchema.js +5 -0
  25. package/esm/addons/Editables/ComboboxEditableCell/ComboboxEditableCell.js +1 -1
  26. package/esm/addons/Editables/DateEditableCell/DateEditableCell.js +1 -1
  27. package/esm/addons/Editables/TextEditableCell/TextEditableCell.js +1 -1
  28. package/esm/addons/Filters/Components/SelectFilter/BaseSelectFilter.js +6 -0
  29. package/esm/addons/Filters/Components/SelectFilter/MultiSelectFilter.js +1 -1
  30. package/esm/addons/Filters/Components/SelectFilter/SingleSelectFilter.js +1 -1
  31. package/esm/configs/useDatatableConfig.js +5 -1
  32. package/esm/exported-related/EditableCell.js +1 -2
  33. package/esm/exported-related/FilterPopover.js +30 -28
  34. package/esm/exported-related/RowRenderer/DefaultRowContentRenderer.js +9 -2
  35. package/esm/exported-related/RowRenderer/useRowRendererHandlers.js +25 -7
  36. package/esm/exported-related/Toolbar/Toolbar.js +3 -10
  37. package/esm/parts/Cells/Cell.js +3 -2
  38. package/esm/parts/FilterBar/FiltersBar.js +30 -3
  39. package/esm/parts/Filters/index.js +1 -1
  40. package/esm/parts/Headers/HeaderResizer.js +1 -1
  41. package/esm/parts/Row.js +17 -1
  42. package/esm/parts/RowVariants/index.js +1 -1
  43. package/esm/parts/TableContent.js +2 -2
  44. package/esm/styled.js +36 -40
  45. package/package.json +19 -19
  46. package/types/styled.d.ts +2 -1
package/cjs/styled.js CHANGED
@@ -63,14 +63,17 @@ const StyledFocusWithin = /*#__PURE__*/styled__default["default"](Grid__default[
63
63
  })([":focus-within{", "}"], props => props.hideFocus ? '' : styledFocusCss(props));
64
64
  const StyledDataTableWrapper = /*#__PURE__*/styled__default["default"].div.withConfig({
65
65
  componentId: "sc-38sgfo-1"
66
- })(["width:", ";height:", ";user-select:", ";"], props => sizeToCss.sizeToCss(props.width ?? ' 100%'), props => sizeToCss.sizeToCss(props.height ?? ' 100%'), _ref2 => {
66
+ })(["width:", ";height:", ";"], props => sizeToCss.sizeToCss(props.width ?? ' 100%'), props => sizeToCss.sizeToCss(props.height ?? ' 100%'));
67
+ const StyledDataTableContentWrapper = /*#__PURE__*/styled__default["default"].div.withConfig({
68
+ componentId: "sc-38sgfo-2"
69
+ })(["user-select:", ";width:100%;height:100%;"], _ref2 => {
67
70
  let {
68
71
  noSelectionAllowed
69
72
  } = _ref2;
70
73
  return noSelectionAllowed ? 'none' : 'auto';
71
74
  });
72
75
  const StyledTableWrapper = /*#__PURE__*/styled__default["default"].div.withConfig({
73
- componentId: "sc-38sgfo-2"
76
+ componentId: "sc-38sgfo-3"
74
77
  })(["display:inline-block;border-spacing:0;z-index:0;position:relative;", ""], _ref3 => {
75
78
  let {
76
79
  width = '100%',
@@ -82,7 +85,7 @@ const StyledTableWrapper = /*#__PURE__*/styled__default["default"].div.withConfi
82
85
  `;
83
86
  });
84
87
  const StyledTableContentWrapper = /*#__PURE__*/styled__default["default"].div.withConfig({
85
- componentId: "sc-38sgfo-3"
88
+ componentId: "sc-38sgfo-4"
86
89
  })(["position:relative;", ""], _ref4 => {
87
90
  let {
88
91
  height = 'auto'
@@ -92,7 +95,7 @@ const StyledTableContentWrapper = /*#__PURE__*/styled__default["default"].div.wi
92
95
  `;
93
96
  });
94
97
  const StyledVirtualListWrapper = /*#__PURE__*/styled__default["default"].div.withConfig({
95
- componentId: "sc-38sgfo-4"
98
+ componentId: "sc-38sgfo-5"
96
99
  })(["overflow:auto;", ""], _ref5 => {
97
100
  let {
98
101
  height = 'auto',
@@ -123,18 +126,17 @@ const getGridTemplateColumnsStyle = _ref6 => {
123
126
  };
124
127
 
125
128
  const StyledHeadWrapper = /*#__PURE__*/styled__default["default"].div.withConfig({
126
- componentId: "sc-38sgfo-5"
129
+ componentId: "sc-38sgfo-6"
127
130
  })(["position:relative;position:sticky;top:0;z-index:4;background:white;width:", ";"], props => props.colsLayoutStyle === constants.ColsLayoutStyle.Fixed ? sizeToCss.sizeToCss(props.totalColumnsWidth) : '100%');
128
131
  const StyledHeadTr = /*#__PURE__*/styled__default["default"](Grid__default["default"]).withConfig({
129
- componentId: "sc-38sgfo-6"
130
- })(["", ";", ";border-right:1px solid ", ";border-bottom:1px solid ", ";"], props => props.colsLayoutStyle === constants.ColsLayoutStyle.Auto ? 'width:100%' : '', props => getGridTemplateColumnsStyle({
132
+ componentId: "sc-38sgfo-7"
133
+ })(["", ";", ";border-right:1px solid ", ";border-bottom:1px solid ", ";grid-auto-flow:column;"], props => props.colsLayoutStyle === constants.ColsLayoutStyle.Auto ? 'width:100%' : '', props => getGridTemplateColumnsStyle({
131
134
  cols: props.cols,
132
135
  isExpandable: props.isExpandable,
133
136
  colsLayoutStyle: props.colsLayoutStyle
134
137
  }), props => props.theme.colors.neutral['080'], props => props.theme.colors.neutral['080']);
135
-
136
138
  const StyledHeadTh = /*#__PURE__*/styled__default["default"].div.withConfig({
137
- componentId: "sc-38sgfo-7"
139
+ componentId: "sc-38sgfo-8"
138
140
  })(["min-height:24px;line-height:normal;font-weight:600;text-transform:uppercase;font-size:0.923rem;text-align:left;", " color:#353c46;min-height:1.84615rem;position:sticky;z-index:", ";display:flex;justify-content:space-between;box-sizing:border-box;outline:none;", ":focus{&:after{display:block;content:' ';position:absolute;top:0;left:0;right:0;bottom:0;border:2px solid ", ";pointer-events:none;z-index:", ";}}"], cellPadding.columnPadding, zIndexInternalConfig.ZIndexDataTable.HEADER_ROW, props => props.isDraggingActive ? '' : `:hover {
139
141
  &:after {
140
142
  display: block;
@@ -151,85 +153,79 @@ const StyledHeadTh = /*#__PURE__*/styled__default["default"].div.withConfig({
151
153
  cursor: pointer;
152
154
  }`, props => props.theme.colors.brand[700], zIndexInternalConfig.ZIndexDataTable.FOCUS_BORDER);
153
155
  const StyledHeaderRightIconsWrapper = /*#__PURE__*/styled__default["default"].div.withConfig({
154
- componentId: "sc-38sgfo-8"
156
+ componentId: "sc-38sgfo-9"
155
157
  })(["height:100%;display:flex;align-items:center;max-height:24px;"]);
156
158
  const StyledResizer = /*#__PURE__*/styled__default["default"].div.withConfig({
157
- componentId: "sc-38sgfo-9"
158
- })(["display:inline-block;background:", ";width:4px;height:100%;position:absolute;right:0;top:0;z-index:1;touch-action:none;cursor:col-resize;"], _ref7 => {
159
- let {
160
- isResizing,
161
- theme
162
- } = _ref7;
163
- return isResizing ? theme.colors.brand[600] : theme.colors.brand[400];
164
- }); // CELL ***********************************************************************/
159
+ componentId: "sc-38sgfo-10"
160
+ })(["display:inline-block;background:transparent;width:4px;height:100%;position:absolute;right:0;top:0;z-index:1;touch-action:none;cursor:col-resize;"]); // CELL ***********************************************************************/
165
161
 
166
162
  const StyledActionCell = /*#__PURE__*/styled__default["default"].div.withConfig({
167
- componentId: "sc-38sgfo-10"
163
+ componentId: "sc-38sgfo-11"
168
164
  })(["position:relative;position:sticky;display:inline-block;right:0;background:white;"]);
169
165
  const StyledCell = /*#__PURE__*/styled__default["default"].div.withConfig({
170
- componentId: "sc-38sgfo-11"
166
+ componentId: "sc-38sgfo-12"
171
167
  })(["", " display:flex;align-items:center;width:100%;position:relative;"], cellPadding.cellPadding);
172
168
  const StyledCellContent = /*#__PURE__*/styled__default["default"].div.withConfig({
173
- componentId: "sc-38sgfo-12"
169
+ componentId: "sc-38sgfo-13"
174
170
  })(["display:grid;justify-self:flex-end;flex:1 1 auto;width:100%;height:100%;align-items:center;"]);
175
171
  const StyledPencilIcon = /*#__PURE__*/styled__default["default"](dsIcons.EditPencil).withConfig({
176
- componentId: "sc-38sgfo-13"
172
+ componentId: "sc-38sgfo-14"
177
173
  })([""]);
178
174
  const StyledEditableContainer = /*#__PURE__*/styled__default["default"](Grid__default["default"]).withConfig({
179
- componentId: "sc-38sgfo-14"
180
- })(["width:100%;height:100%;align-items:center;& ", "{display:", ";}&:hover{", "{display:block;}}&:focus{", " ", "{display:block;}}outline:none;"], StyledPencilIcon, _ref8 => {
175
+ componentId: "sc-38sgfo-15"
176
+ })(["width:100%;height:100%;align-items:center;& ", "{display:", ";}&:hover{", "{display:block;}}&:focus{", " ", "{display:block;}}outline:none;"], StyledPencilIcon, _ref7 => {
181
177
  let {
182
178
  shouldDisplayEditIcon
183
- } = _ref8;
179
+ } = _ref7;
184
180
  return shouldDisplayEditIcon ? 'block' : 'none';
185
181
  }, StyledPencilIcon, styledFocusCss, StyledPencilIcon); // ROW ************************************************************************/
186
182
 
187
183
  const StyledFullsizeGrid = /*#__PURE__*/styled__default["default"](Grid__default["default"]).withConfig({
188
- componentId: "sc-38sgfo-15"
184
+ componentId: "sc-38sgfo-16"
189
185
  })(["position:relative;z-index:", ";min-height:", ";height:", ";"], zIndexInternalConfig.ZIndexDataTable.ROW, props => props.minHeight || '36px', props => props.height || 'auto');
190
186
  const GroupHeaderContainer = /*#__PURE__*/styled__default["default"](Grid__default["default"]).withConfig({
191
- componentId: "sc-38sgfo-16"
192
- })(["position:relative;background-color:", ";align-items:center;padding:0 ", ";border-top:1px solid ", ";grid-template-columns:min-content 1fr;"], _ref9 => {
187
+ componentId: "sc-38sgfo-17"
188
+ })(["position:relative;background-color:", ";align-items:center;padding:0 ", ";border-top:1px solid ", ";grid-template-columns:min-content 1fr;"], _ref8 => {
193
189
  let {
194
190
  theme
195
- } = _ref9;
191
+ } = _ref8;
196
192
  return theme.colors.brand[200];
197
- }, props => props.padding, _ref10 => {
193
+ }, props => props.padding, _ref9 => {
198
194
  let {
199
195
  theme
200
- } = _ref10;
196
+ } = _ref9;
201
197
  return theme.colors.brand[300];
202
198
  });
203
199
  const GroupHeaderTitle = /*#__PURE__*/styled__default["default"].span.withConfig({
204
- componentId: "sc-38sgfo-17"
200
+ componentId: "sc-38sgfo-18"
205
201
  })(["font-weight:", ";font-size:12px;color:", ";"], props => props.theme.fontWeights.semibold, props => props.theme.colors.neutral[700]);
206
202
  const StyledCellContainer = /*#__PURE__*/styled__default["default"](Grid__default["default"]).withConfig({
207
- componentId: "sc-38sgfo-18"
203
+ componentId: "sc-38sgfo-19"
208
204
  })(["position:relative;z-index:2;min-height:", ";height:", ";width:", ";", ";", ";background-color:", ";outline:none;:focus{", "}", " ", " box-shadow:0 2px 4px 0 ", ";opacity:", ";", " color:", ";"], props => props.minHeight || '36px', props => props.height || 'auto', props => props.colLayoutStyle === constants.ColsLayoutStyle.Fixed ? sizeToCss.sizeToCss(props.totalColumnsWidth) : '100%', props => props.isDragOverlay ? 'width: fit-content;' : '', props => getGridTemplateColumnsStyle({
209
205
  cols: props.cols,
210
206
  colsLayoutStyle: props.colLayoutStyle,
211
207
  isExpandable: props.isExpandable
212
- }), _ref11 => {
208
+ }), _ref10 => {
213
209
  let {
214
210
  backgroundColor,
215
211
  isDragging,
216
212
  theme
217
- } = _ref11;
213
+ } = _ref10;
218
214
  return isDragging ? theme.colors.neutral[100] : backgroundColor || 'white';
219
- }, props => props.isDragOverlay ? '' : styledFocusCss(props), _ref12 => {
215
+ }, props => props.isDragOverlay ? '' : styledFocusCss(props), _ref11 => {
220
216
  let {
221
217
  isDropIndicatorPositionInside,
222
218
  theme
223
- } = _ref12;
219
+ } = _ref11;
224
220
  if (!isDropIndicatorPositionInside) return '';
225
221
  return styledFocusCss({
226
222
  theme
227
223
  });
228
- }, _ref13 => {
224
+ }, _ref12 => {
229
225
  let {
230
226
  shouldDisplayHover,
231
227
  theme
232
- } = _ref13;
228
+ } = _ref12;
233
229
  return shouldDisplayHover ? `:hover {
234
230
  background-color: ${theme.colors.brand[200]};
235
231
  }` : '';
@@ -244,6 +240,7 @@ exports.StyledActionCell = StyledActionCell;
244
240
  exports.StyledCell = StyledCell;
245
241
  exports.StyledCellContainer = StyledCellContainer;
246
242
  exports.StyledCellContent = StyledCellContent;
243
+ exports.StyledDataTableContentWrapper = StyledDataTableContentWrapper;
247
244
  exports.StyledDataTableWrapper = StyledDataTableWrapper;
248
245
  exports.StyledEditableContainer = StyledEditableContainer;
249
246
  exports.StyledFocusWithin = StyledFocusWithin;
package/esm/DataTable.js CHANGED
@@ -17,6 +17,7 @@ import { useDatatableConfig } from './configs/useDatatableConfig.js';
17
17
  import './configs/useRowFlattenization.js';
18
18
  import { FiltersBar } from './parts/FilterBar/FiltersBar.js';
19
19
  import { DataTableSchema } from './DataTableSchema.js';
20
+ import { StyledDataTableWrapper } from './styled.js';
20
21
  import { jsxs, jsx } from 'react/jsx-runtime';
21
22
 
22
23
  var _FiltersBar;
@@ -32,13 +33,21 @@ const DataTable = props => {
32
33
  const tableWrapperRef = useRef();
33
34
  const tableContentWrapperRef = useRef();
34
35
  const ctx = useDatatableConfig(props);
36
+ const {
37
+ tableProps: {
38
+ height,
39
+ width
40
+ }
41
+ } = ctx;
35
42
  return /*#__PURE__*/_jsx(Provider, {
36
43
  store: reduxStore
37
44
  }, void 0, /*#__PURE__*/_jsx(DataTableContext.Provider, {
38
45
  value: ctx
39
- }, void 0, /*#__PURE__*/jsxs("div", {
46
+ }, void 0, /*#__PURE__*/jsxs(StyledDataTableWrapper, {
40
47
  ref: tableWrapperRef,
41
48
  "data-testid": DATA_TESTID.DATA_TABLE_WRAPPER,
49
+ height: height,
50
+ width: width,
42
51
  children: [withFilterBar ? _FiltersBar || (_FiltersBar = /*#__PURE__*/_jsx(FiltersBar, {})) : null, /*#__PURE__*/jsx(TableContent, {
43
52
  ref: tableContentWrapperRef
44
53
  })]
@@ -53,6 +53,11 @@ const DataTableSchema = {
53
53
  withFilterBar: PropTypes.bool.description('Whether to display the filter bar'),
54
54
  filterBarProps: PropTypes.shape({
55
55
  customPillRenderer: PropTypes.oneOfType([PropTypes.func, PropTypes.element]).description('If you specify custom filters, you will need to render their pills here'),
56
+ isDropdownMenuOpen: PropTypes.bool.description('Wether the DropdownMenu is Open or not.'),
57
+ onDropdownMenuToggle: PropTypes.func.description('Callback to toggle the DropdownMenu.'),
58
+ onClearAllFiltersClick: PropTypes.func.description('Callback for Clear Al Filters option.'),
59
+ onDropdownMenuClickOutside: PropTypes.func.description('Callback triggered when clicking outside DropdownMenu.'),
60
+ onDropdownMenuTriggerClick: PropTypes.func.description('Callback triggered when clicking DropdownMenu ellipsis.'),
56
61
  extraOptions: PropTypes.arrayOf(PropTypes.shape({
57
62
  type: PropTypes.string,
58
63
  id: PropTypes.string,
@@ -14,7 +14,6 @@ import '@elliemae/ds-popperjs';
14
14
  import 'styled-components';
15
15
  import '../../../redux/reducers/index.js';
16
16
  import '../../../configs/constants.js';
17
- import 'react/jsx-runtime';
18
17
  import { EditableCell } from '../../../exported-related/EditableCell.js';
19
18
  import '@elliemae/ds-icons';
20
19
  import '@elliemae/ds-utilities';
@@ -23,6 +22,7 @@ import '../../../configs/useRowFlattenization.js';
23
22
  import 'core-js/modules/esnext.async-iterator.map.js';
24
23
  import 'core-js/modules/esnext.iterator.map.js';
25
24
  import '../../../styled.js';
25
+ import 'react/jsx-runtime';
26
26
  import '@elliemae/ds-form';
27
27
  import '../../../parts/TableContent.js';
28
28
  import '@elliemae/ds-grid';
@@ -11,7 +11,6 @@ import '@elliemae/ds-popperjs';
11
11
  import 'styled-components';
12
12
  import '../../../redux/reducers/index.js';
13
13
  import '../../../configs/constants.js';
14
- import 'react/jsx-runtime';
15
14
  import { EditableCell } from '../../../exported-related/EditableCell.js';
16
15
  import '@elliemae/ds-icons';
17
16
  import '@elliemae/ds-utilities';
@@ -22,6 +21,7 @@ import '../../../configs/useRowFlattenization.js';
22
21
  import 'core-js/modules/esnext.async-iterator.map.js';
23
22
  import 'core-js/modules/esnext.iterator.map.js';
24
23
  import '../../../styled.js';
24
+ import 'react/jsx-runtime';
25
25
  import '@elliemae/ds-form';
26
26
  import '../../../parts/TableContent.js';
27
27
  import '@elliemae/ds-grid';
@@ -11,7 +11,6 @@ import '@elliemae/ds-button';
11
11
  import '@elliemae/ds-popperjs';
12
12
  import '../../../redux/reducers/index.js';
13
13
  import '../../../configs/constants.js';
14
- import 'react/jsx-runtime';
15
14
  import { EditableCell } from '../../../exported-related/EditableCell.js';
16
15
  import '@elliemae/ds-icons';
17
16
  import '@elliemae/ds-utilities';
@@ -22,6 +21,7 @@ import '../../../configs/useRowFlattenization.js';
22
21
  import 'core-js/modules/esnext.async-iterator.map.js';
23
22
  import 'core-js/modules/esnext.iterator.map.js';
24
23
  import '../../../styled.js';
24
+ import 'react/jsx-runtime';
25
25
  import '@elliemae/ds-form';
26
26
  import '../../../parts/TableContent.js';
27
27
  import '@elliemae/ds-grid';
@@ -51,6 +51,8 @@ import '../../../../exported-related/Filters/applyOutOfTheBoxFilters.js';
51
51
  import 'moment';
52
52
  import 'core-js/modules/esnext.async-iterator.some.js';
53
53
  import 'core-js/modules/esnext.iterator.some.js';
54
+ import '../../../../redux/reducers/index.js';
55
+ import { useDispatchHeadersActions } from '../../../../redux/reducers/headersReducers/useDispatchHeadersActions.js';
54
56
 
55
57
  var _SearchXsmall;
56
58
  const BaseSelectFilter = props => {
@@ -72,6 +74,9 @@ const BaseSelectFilter = props => {
72
74
  innerRef,
73
75
  onValueChange
74
76
  } = props;
77
+ const {
78
+ patchHeaderFilterButtonAndMenu
79
+ } = useDispatchHeadersActions();
75
80
  const filterOptions = useMemo(() => {
76
81
  // If the user didn't provide options, use the available ones
77
82
  if (!userFilterOptions) {
@@ -92,6 +97,7 @@ const BaseSelectFilter = props => {
92
97
 
93
98
  const handleOnChange = value => {
94
99
  onValueChange(type, value);
100
+ if (!isMulti) patchHeaderFilterButtonAndMenu(column.id, true);
95
101
  };
96
102
 
97
103
  const [filters, setFilteredOptions] = useState(filterOptions);
@@ -12,9 +12,9 @@ import '@elliemae/ds-popperjs';
12
12
  import 'styled-components';
13
13
  import '../../../../redux/reducers/index.js';
14
14
  import { DATA_TESTID } from '../../../../configs/constants.js';
15
- import 'react/jsx-runtime';
16
15
  import '../../../../styled.js';
17
16
  import '../../../../DataTableContext.js';
17
+ import 'react/jsx-runtime';
18
18
  import '@elliemae/ds-icons';
19
19
  import '@elliemae/ds-utilities';
20
20
  import 'core-js/modules/esnext.async-iterator.reduce.js';
@@ -12,9 +12,9 @@ import '@elliemae/ds-popperjs';
12
12
  import 'styled-components';
13
13
  import '../../../../redux/reducers/index.js';
14
14
  import { DATA_TESTID } from '../../../../configs/constants.js';
15
- import 'react/jsx-runtime';
16
15
  import '../../../../styled.js';
17
16
  import '../../../../DataTableContext.js';
17
+ import 'react/jsx-runtime';
18
18
  import '@elliemae/ds-icons';
19
19
  import '@elliemae/ds-utilities';
20
20
  import 'core-js/modules/esnext.async-iterator.reduce.js';
@@ -50,7 +50,11 @@ const useDatatableConfig = props => {
50
50
  // Layout config
51
51
  // ===========================================================================
52
52
 
53
- const [gridLayout, setGridLayout] = useState(columnsToGrid(visibleColumns, props.colsLayoutStyle));
53
+ const [gridLayout, setGridLayout] = useState(columnsToGrid(visibleColumns, props.colsLayoutStyle)); // We need to listen and update the state based on this props
54
+
55
+ useEffect(() => {
56
+ setGridLayout(columnsToGrid(visibleColumns, props.colsLayoutStyle));
57
+ }, [visibleColumns, props.colsLayoutStyle]);
54
58
  const totalColumnsWidth = useMemo(() => props.colsLayoutStyle === ColsLayoutStyle.Fixed ? gridLayout.reduce((acc, cur) => acc + Number.parseInt(cur, 10), 0) : '100%', [props.colsLayoutStyle, gridLayout]);
55
59
  const layoutHelpers = useMemo(() => ({
56
60
  gridLayout,
@@ -10,8 +10,7 @@ const EditableCell = props => {
10
10
  StandardRender,
11
11
  EditableRenderer,
12
12
  cell,
13
- isRowSelected,
14
- setValue
13
+ isRowSelected
15
14
  } = props;
16
15
  const {
17
16
  virtualListHelpers
@@ -5,13 +5,12 @@ import 'core-js/modules/esnext.async-iterator.for-each.js';
5
5
  import 'core-js/modules/esnext.iterator.for-each.js';
6
6
  import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
7
7
  import _jsx from '@babel/runtime/helpers/esm/jsx';
8
- import { useRef, useEffect, useState } from 'react';
8
+ import { useEffect, useState, useCallback } from 'react';
9
9
  import { DSButton } from '@elliemae/ds-button';
10
10
  import { DSPopperJS } from '@elliemae/ds-popperjs';
11
11
  import styled from 'styled-components';
12
12
  import '../redux/reducers/index.js';
13
13
  import { DATA_TESTID } from '../configs/constants.js';
14
- import { jsx } from 'react/jsx-runtime';
15
14
  import { useDispatchHeadersActions } from '../redux/reducers/headersReducers/useDispatchHeadersActions.js';
16
15
 
17
16
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
@@ -26,7 +25,22 @@ const Button = /*#__PURE__*/styled(DSButton).withConfig({
26
25
  const PopperContent = /*#__PURE__*/styled.div.withConfig({
27
26
  componentId: "sc-16i88ut-2"
28
27
  })(["background-color:#fff;"]);
29
- const FilterPopover = _ref2 => {
28
+
29
+ const ButtonTrap = _ref2 => {
30
+ let {
31
+ cb
32
+ } = _ref2;
33
+ return /*#__PURE__*/_jsx("span", {
34
+ "aria-hidden": "true",
35
+ tabIndex: 0,
36
+ onFocus: e => {
37
+ e.stopPropagation();
38
+ cb();
39
+ }
40
+ });
41
+ };
42
+
43
+ const FilterPopover = _ref3 => {
30
44
  let {
31
45
  column,
32
46
  columnId,
@@ -38,7 +52,7 @@ const FilterPopover = _ref2 => {
38
52
  innerRef,
39
53
  ariaLabel,
40
54
  customStyles
41
- } = _ref2;
55
+ } = _ref3;
42
56
  const {
43
57
  hideFilterButton,
44
58
  hideFilterMenu
@@ -46,7 +60,6 @@ const FilterPopover = _ref2 => {
46
60
  hideFilterButton: true,
47
61
  hideFilterMenu: true
48
62
  };
49
- const popperRef = useRef(null);
50
63
  const {
51
64
  patchHeaderFilterButtonAndMenu,
52
65
  patchHeader
@@ -77,6 +90,13 @@ const FilterPopover = _ref2 => {
77
90
  };
78
91
 
79
92
  const [referenceElement, setReferenceElement] = useState(null);
93
+ const buttonTrapCallback = useCallback(() => {
94
+ patchHeader(columnId, {
95
+ hideFilterMenu: true,
96
+ hideFilterButton: false
97
+ });
98
+ referenceElement?.focus();
99
+ }, [columnId, patchHeader, referenceElement]);
80
100
  return /*#__PURE__*/_jsx("div", {
81
101
  // This is here to prevent propagation, and not trigger the sort functionality
82
102
  onClick: e => e.stopPropagation(),
@@ -99,11 +119,6 @@ const FilterPopover = _ref2 => {
99
119
  },
100
120
  style: {
101
121
  display: 'flex'
102
- },
103
- onBlur: e => {
104
- if (e.target !== referenceElement && !popperRef.current?.contains(e.relatedTarget)) {
105
- referenceElement?.focus();
106
- }
107
122
  }
108
123
  }, void 0, /*#__PURE__*/_jsx(FilterButton, {
109
124
  hide: !isIconVisible,
@@ -135,24 +150,11 @@ const FilterPopover = _ref2 => {
135
150
  minWidth: column.ref?.current?.offsetWidth ?? '0px'
136
151
  }),
137
152
  placementOrderPreference: ['bottom-end']
138
- }, void 0, /*#__PURE__*/jsx(PopperContent, {
139
- onKeyDown: e => {
140
- if (e.code === 'Tab') {
141
- setTimeout(() => {
142
- if (!popperRef?.current?.contains(document.activeElement)) {
143
- patchHeader(columnId, {
144
- hideFilterMenu: true,
145
- hideFilterButton: false
146
- });
147
- e.preventDefault();
148
- referenceElement.focus();
149
- }
150
- });
151
- }
152
- },
153
- ref: popperRef,
154
- children: menuContent
155
- })));
153
+ }, void 0, /*#__PURE__*/_jsx(PopperContent, {}, void 0, /*#__PURE__*/_jsx(ButtonTrap, {
154
+ cb: buttonTrapCallback
155
+ }), menuContent, /*#__PURE__*/_jsx(ButtonTrap, {
156
+ cb: buttonTrapCallback
157
+ }))));
156
158
  };
157
159
 
158
160
  export { FilterPopover };
@@ -5,7 +5,7 @@ import 'core-js/modules/esnext.async-iterator.for-each.js';
5
5
  import 'core-js/modules/esnext.iterator.for-each.js';
6
6
  import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
7
7
  import _jsx from '@babel/runtime/helpers/esm/jsx';
8
- import { useRef, useLayoutEffect, useMemo } from 'react';
8
+ import { useRef, useLayoutEffect, useMemo, useCallback } from 'react';
9
9
  import { INTERNAL_COLUMNS } from '../../addons/Columns/index.js';
10
10
  import { DATA_TESTID } from '../../configs/constants.js';
11
11
  import 'core-js/modules/esnext.async-iterator.reduce.js';
@@ -91,12 +91,18 @@ const DefaultRowContentRenderer = props => {
91
91
 
92
92
  return padding;
93
93
  }, [row.depth, visibleColumns]);
94
+ const handleSelectDisableRow = useCallback(e => {
95
+ if (disabledRows[row.uid]) {
96
+ e.preventDefault();
97
+ e.stopPropagation();
98
+ }
99
+ }, [disabledRows, row.uid]);
94
100
  const PureRowContent = useMemo(() => {
95
101
  const DetailsView = row.original.tableRowDetails;
96
102
  return /*#__PURE__*/jsxs(Fragment, {
97
103
  children: [/*#__PURE__*/jsx(StyledCellContainer, _objectSpread(_objectSpread({
98
104
  ref: rowRef,
99
- tabIndex: 0,
105
+ tabIndex: disabledRows[row.uid] ? -1 : 0,
100
106
  role: "row",
101
107
  "aria-rowindex": row.realIndex + 1,
102
108
  "aria-label": ariaLabelMessage(row, selection?.[row.uid] === true),
@@ -115,6 +121,7 @@ const DefaultRowContentRenderer = props => {
115
121
  selected: noSelectionColumn && selection?.[row.uid] === true,
116
122
  disabled: disabledRows[row.uid],
117
123
  "data-testid": DATA_TESTID.DATA_TABLE_ROW_CONTENT,
124
+ onMouseDown: handleSelectDisableRow,
118
125
  children: /*#__PURE__*/_jsx(Cells, {
119
126
  row: row,
120
127
  isRowSelected: selectedRowId === row.uid,
@@ -44,12 +44,26 @@ const useRowRendererHandlers = _ref => {
44
44
  const {
45
45
  tableProps: {
46
46
  onRowClick,
47
- onRowFocus
47
+ onRowFocus,
48
+ disabledRows
48
49
  },
49
50
  virtualListHelpers: {
50
51
  scrollToIndex
51
52
  }
52
53
  } = useContext(DataTableContext);
54
+
55
+ const isOptionFocuseable = opt => !disabledRows[opt.id];
56
+
57
+ const findInCircularList = function (list, from, criteria) {
58
+ let step = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
59
+
60
+ for (let i = (from + step + list.length) % list.length; i !== from && from > -1; i = (i + step + list.length) % list.length) {
61
+ if (criteria(list[i])) return i;
62
+ }
63
+
64
+ return from; // return same item
65
+ };
66
+
53
67
  const {
54
68
  setSelectedRowId,
55
69
  setFocusedRowId
@@ -60,6 +74,7 @@ const useRowRendererHandlers = _ref => {
60
74
  uid
61
75
  } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : row;
62
76
  // setSelectedRowId(null);
77
+ if (disabledRows[uid]) return;
63
78
  onRowClick(original, e, uid);
64
79
  onRowFocus({
65
80
  itemIndex,
@@ -71,7 +86,7 @@ const useRowRendererHandlers = _ref => {
71
86
  },
72
87
  original
73
88
  }, e);
74
- }, [row, onRowClick, onRowFocus, itemIndex, scrollToIndex]);
89
+ }, [row, disabledRows, onRowClick, onRowFocus, itemIndex, scrollToIndex]);
75
90
  const isActive = draggableProps && draggableProps.active;
76
91
  const handleKeyDown = useCallback(e => {
77
92
  if (isDragOverlay || isActive) {
@@ -98,24 +113,27 @@ const useRowRendererHandlers = _ref => {
98
113
 
99
114
  if (e.code === 'ArrowDown') {
100
115
  e.preventDefault();
101
- if (itemIndex + 1 < items.length) setFocusedRowId(items[itemIndex + 1].uid);
116
+ e.stopPropagation();
117
+ const next = findInCircularList(items, itemIndex, isOptionFocuseable);
118
+ setFocusedRowId(items[next].uid);
102
119
  }
103
120
 
104
121
  if (e.code === 'ArrowUp') {
105
122
  e.preventDefault();
106
- if (itemIndex - 1 >= 0) setFocusedRowId(items[itemIndex - 1].uid);
123
+ const prev = findInCircularList(items, itemIndex, isOptionFocuseable, -1);
124
+ setFocusedRowId(items[prev].uid);
107
125
  }
108
- }, [isDragOverlay, isActive, selectedRowId, row, setSelectedRowId, handleItemClick, itemIndex, items, setFocusedRowId]);
126
+ }, [isDragOverlay, isActive, selectedRowId, row, setSelectedRowId, handleItemClick, items, itemIndex, isOptionFocuseable, setFocusedRowId]);
109
127
  const handleOnBlur = useCallback(e => {
110
128
  if (e.relatedTarget?.getAttribute('data-testid') === 'data-table-row-content') {
111
129
  setSelectedRowId(null);
112
130
  }
113
131
  }, [setSelectedRowId]);
114
132
  const handleOnFocus = useCallback(e => {
115
- if (e.target && e.target.getAttribute('data-testid') === DATA_TESTID.DATA_TABLE_ROW_CONTENT) {
133
+ if (!disabledRows[row.uid] && e.target && e.target.getAttribute('data-testid') === DATA_TESTID.DATA_TABLE_ROW_CONTENT) {
116
134
  setFocusedRowId(row.uid);
117
135
  }
118
- }, [row.uid, setFocusedRowId]);
136
+ }, [row.uid, setFocusedRowId, disabledRows]);
119
137
  return {
120
138
  handleItemClick,
121
139
  handleKeyDown,
@@ -45,22 +45,15 @@ const Toolbar = _ref => {
45
45
  children
46
46
  } = _ref;
47
47
  const [show, setShow] = useState(false);
48
- const [clicked, setClicked] = useState(false);
49
48
  const toolbarRef = useRef(null);
50
- const handleOnClickOutside = useCallback(() => {
51
- setShow(false);
52
- setClicked(false);
53
- }, []);
54
- const handleOnClick = useCallback(() => {
55
- setShow(true);
56
- setClicked(true);
57
- }, []);
49
+ const handleOnClickOutside = useCallback(() => setShow(false), []);
50
+ const handleOnClick = useCallback(() => setShow(true), []);
58
51
  useOnClickOutside(toolbarRef, handleOnClickOutside);
59
52
  return /*#__PURE__*/jsx(ToolbarPosition, {
60
53
  ref: toolbarRef,
61
54
  children: /*#__PURE__*/_jsx(ToolbarWrapper, {
62
55
  onMouseEnter: () => setShow(true),
63
- onMouseLeave: () => setShow(clicked)
56
+ onMouseLeave: () => setShow(false)
64
57
  }, void 0, show && /*#__PURE__*/_jsx(ToolbarBtns, {}, void 0, children), /*#__PURE__*/_jsx(DSButton, {
65
58
  buttonType: "text",
66
59
  className: "toolbar-trigger",
@@ -63,7 +63,8 @@ const Cell = _ref2 => {
63
63
  const ctx = useContext(DataTableContext);
64
64
  const {
65
65
  tableProps: {
66
- cellRendererProps
66
+ cellRendererProps,
67
+ disabledRows
67
68
  }
68
69
  } = ctx;
69
70
  const {
@@ -112,7 +113,7 @@ const Cell = _ref2 => {
112
113
  return null;
113
114
  }, [DefaultCellContentJSX, cellProps, column]);
114
115
  return /*#__PURE__*/jsx(PureStandardCell, _objectSpread(_objectSpread({}, cellProps), {}, {
115
- children: column.editable ? EditableContentJSX : DefaultCellContentJSX
116
+ children: column.editable && !disabledRows[row.id] ? EditableContentJSX : DefaultCellContentJSX
116
117
  }));
117
118
  };
118
119