@elliemae/ds-data-table 2.4.3 → 2.4.5

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 (51) hide show
  1. package/cjs/DataTable.js +10 -1
  2. package/cjs/DataTableSchema.js +5 -0
  3. package/cjs/addons/Columns/ColumnExpand/ColumnExpand.js +27 -13
  4. package/cjs/addons/Editables/ComboboxEditableCell/ComboboxEditableCell.js +1 -1
  5. package/cjs/addons/Editables/DateEditableCell/DateEditableCell.js +1 -1
  6. package/cjs/addons/Editables/TextEditableCell/TextEditableCell.js +1 -1
  7. package/cjs/addons/Filters/Components/SelectFilter/BaseSelectFilter.js +14 -6
  8. package/cjs/addons/Filters/Components/SelectFilter/MultiSelectFilter.js +1 -1
  9. package/cjs/addons/Filters/Components/SelectFilter/SingleSelectFilter.js +1 -1
  10. package/cjs/configs/useDatatableConfig.js +5 -1
  11. package/cjs/exported-related/EditableCell.js +1 -2
  12. package/cjs/exported-related/FilterPopover.js +29 -27
  13. package/cjs/exported-related/RowRenderer/DefaultRowContentRenderer.js +9 -2
  14. package/cjs/exported-related/RowRenderer/useRowRendererHandlers.js +25 -7
  15. package/cjs/exported-related/Toolbar/Toolbar.js +3 -10
  16. package/cjs/parts/Cells/Cell.js +3 -2
  17. package/cjs/parts/FilterBar/FiltersBar.js +29 -2
  18. package/cjs/parts/Filters/index.js +1 -1
  19. package/cjs/parts/Headers/HeaderCellGroup.js +3 -2
  20. package/cjs/parts/Headers/HeaderResizer.js +1 -1
  21. package/cjs/parts/Row.js +17 -1
  22. package/cjs/parts/RowVariants/index.js +1 -1
  23. package/cjs/parts/TableContent.js +1 -1
  24. package/cjs/styled.js +39 -41
  25. package/esm/DataTable.js +10 -1
  26. package/esm/DataTableSchema.js +5 -0
  27. package/esm/addons/Columns/ColumnExpand/ColumnExpand.js +28 -14
  28. package/esm/addons/Editables/ComboboxEditableCell/ComboboxEditableCell.js +1 -1
  29. package/esm/addons/Editables/DateEditableCell/DateEditableCell.js +1 -1
  30. package/esm/addons/Editables/TextEditableCell/TextEditableCell.js +1 -1
  31. package/esm/addons/Filters/Components/SelectFilter/BaseSelectFilter.js +14 -6
  32. package/esm/addons/Filters/Components/SelectFilter/MultiSelectFilter.js +1 -1
  33. package/esm/addons/Filters/Components/SelectFilter/SingleSelectFilter.js +1 -1
  34. package/esm/configs/useDatatableConfig.js +5 -1
  35. package/esm/exported-related/EditableCell.js +1 -2
  36. package/esm/exported-related/FilterPopover.js +30 -28
  37. package/esm/exported-related/RowRenderer/DefaultRowContentRenderer.js +10 -3
  38. package/esm/exported-related/RowRenderer/useRowRendererHandlers.js +25 -7
  39. package/esm/exported-related/Toolbar/Toolbar.js +3 -10
  40. package/esm/parts/Cells/Cell.js +3 -2
  41. package/esm/parts/FilterBar/FiltersBar.js +30 -3
  42. package/esm/parts/Filters/index.js +1 -1
  43. package/esm/parts/Headers/HeaderCellGroup.js +3 -2
  44. package/esm/parts/Headers/HeaderResizer.js +1 -1
  45. package/esm/parts/Row.js +17 -1
  46. package/esm/parts/RowVariants/index.js +1 -1
  47. package/esm/parts/TableContent.js +2 -2
  48. package/esm/styled.js +39 -42
  49. package/package.json +19 -19
  50. package/types/styled.d.ts +2 -1
  51. package/types/types/props.d.ts +1 -0
@@ -49,9 +49,10 @@ const StyledWrapper = /*#__PURE__*/styled__default["default"](Grid.Grid).withCon
49
49
  componentId: "sc-1dqaj8a-0"
50
50
  })(["position:relative;", " width:", ";grid-column:", ";background:", ";opacity:", ";box-shadow:0 2px 4px 0 ", ";border-left:", " solid ", ";"], _ref => {
51
51
  let {
52
- shouldDropOneLevel
52
+ shouldDropOneLevel,
53
+ isDragOverlay
53
54
  } = _ref;
54
- return shouldDropOneLevel ? `top: 50%; height: 50%;` : '';
55
+ return shouldDropOneLevel && !isDragOverlay ? `top: 50%; height: 50%;` : '';
55
56
  }, props => props.isDragOverlay ? 'fit-content' : '100%', props => props.gridColumn, props => props.isDragging ? props.theme.colors.neutral['080'] : 'white', props => props.isDragging ? 0.8 : 1, props => props.isDragOverlay ? 'rgba(0,0,0,0.5)' : 'transparent', _ref2 => {
56
57
  let {
57
58
  isFirst
@@ -79,9 +79,9 @@ const HeaderResizer = _ref => {
79
79
  e.stopPropagation();
80
80
  }, [column.id, nextWidth, visibleColumnsCopy]);
81
81
  const onResizeEnd = React.useCallback(() => {
82
- onColumnResize(column.id, nextWidth);
83
82
  setGridLayout(columnsToGrid.columnsToGrid(visibleColumns, constants.ColsLayoutStyle.Fixed));
84
83
  setIsResizing(false);
84
+ onColumnResize(column.id, nextWidth);
85
85
  }, [onColumnResize, column.id, nextWidth, setGridLayout, visibleColumns]);
86
86
  React.useEffect(() => {
87
87
  const debouncedResizeHandler = onResizeHandler;
package/cjs/parts/Row.js CHANGED
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var _jsx = require('@babel/runtime/helpers/jsx');
6
6
  var React = require('react');
7
7
  var reactRedux = require('react-redux');
8
+ var dsSystem = require('@elliemae/ds-system');
8
9
  var DataTableContext = require('../DataTableContext.js');
9
10
  require('core-js/modules/esnext.async-iterator.for-each.js');
10
11
  require('core-js/modules/esnext.iterator.constructor.js');
@@ -29,6 +30,15 @@ const setItemRefs = (measureRef, draggableRef, ref) => {
29
30
  refsHelpers.setMultipleRefs(...refsToSet)(ref);
30
31
  };
31
32
 
33
+ const StyledRow = dsSystem.styled('div')`
34
+ cursor: ${_ref => {
35
+ let {
36
+ disabled
37
+ } = _ref;
38
+ return disabled ? 'not-allowed' : 'normal';
39
+ }};
40
+ `;
41
+
32
42
  const RowComp = props => {
33
43
  const {
34
44
  row,
@@ -39,11 +49,17 @@ const RowComp = props => {
39
49
  selectedRowId
40
50
  } = props;
41
51
  const ctx = React.useContext(DataTableContext["default"]);
52
+ const {
53
+ tableProps: {
54
+ disabledRows
55
+ }
56
+ } = ctx;
42
57
  const {
43
58
  draggableProps
44
59
  } = React.useContext(SortableItemContext.SortableItemContext);
45
60
  const draggableRef = draggableProps && draggableProps.setNodeRef;
46
- return /*#__PURE__*/jsxRuntime.jsx("div", {
61
+ return /*#__PURE__*/jsxRuntime.jsx(StyledRow, {
62
+ disabled: disabledRows[row.uid],
47
63
  style: !isDragOverlay ? itemWrapperStyle : {},
48
64
  ref: ref => setItemRefs(measureRef, draggableRef, ref),
49
65
  children: /*#__PURE__*/_jsx__default["default"](index.RowVariantMapItem, {
@@ -16,9 +16,9 @@ require('@elliemae/ds-popperjs');
16
16
  require('styled-components');
17
17
  require('../../redux/reducers/index.js');
18
18
  require('../../configs/constants.js');
19
- var jsxRuntime = require('react/jsx-runtime');
20
19
  require('../../styled.js');
21
20
  require('../../DataTableContext.js');
21
+ var jsxRuntime = require('react/jsx-runtime');
22
22
  require('@elliemae/ds-icons');
23
23
  require('@elliemae/ds-utilities');
24
24
  require('core-js/modules/esnext.async-iterator.reduce.js');
@@ -64,7 +64,7 @@ const TableContentComponent = props => {
64
64
  visibleColumns
65
65
  } = React.useContext(DataTableContext["default"]);
66
66
  const [shiftKeyPressed, setShiftKeyPressed] = React.useState(false);
67
- const PureTableContent = React.useMemo(() => /*#__PURE__*/jsxRuntime.jsxs(styled.StyledDataTableWrapper, {
67
+ const PureTableContent = React.useMemo(() => /*#__PURE__*/jsxRuntime.jsxs(styled.StyledDataTableContentWrapper, {
68
68
  "data-testid": constants.DATA_TESTID.DATA_TABLE_CONTENT_WRAPPER,
69
69
  height: height,
70
70
  width: width,
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,86 +153,81 @@ 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
- theme
232
- } = _ref13;
233
- return shouldDisplayHover ? `:hover {
227
+ theme,
228
+ disabled
229
+ } = _ref12;
230
+ return shouldDisplayHover && !disabled ? `:hover {
234
231
  background-color: ${theme.colors.brand[200]};
235
232
  }` : '';
236
233
  }, props => props.isDragOverlay ? 'rgba(0,0,0,0.5)' : 'transparent', props => props.isDragging ? 0.8 : 1, props => !props.selected ? '' : `
@@ -244,6 +241,7 @@ exports.StyledActionCell = StyledActionCell;
244
241
  exports.StyledCell = StyledCell;
245
242
  exports.StyledCellContainer = StyledCellContainer;
246
243
  exports.StyledCellContent = StyledCellContent;
244
+ exports.StyledDataTableContentWrapper = StyledDataTableContentWrapper;
247
245
  exports.StyledDataTableWrapper = StyledDataTableWrapper;
248
246
  exports.StyledEditableContainer = StyledEditableContainer;
249
247
  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,
@@ -7,7 +7,7 @@ import 'core-js/modules/esnext.async-iterator.filter.js';
7
7
  import 'core-js/modules/esnext.iterator.filter.js';
8
8
  import { useMemo, useCallback } from 'react';
9
9
  import { ArrowheadDown, ArrowheadRight, ArrowShortReturn } from '@elliemae/ds-icons';
10
- import styled from 'styled-components';
10
+ import styled, { css } from 'styled-components';
11
11
  import { StyledFocusWithin } from '../../../styled.js';
12
12
  import { DATA_TESTID } from '../../../configs/constants.js';
13
13
  import 'core-js/modules/esnext.async-iterator.reduce.js';
@@ -31,32 +31,44 @@ import { jsx } from 'react/jsx-runtime';
31
31
  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; }
32
32
 
33
33
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
34
+ const disabledCaret = /*#__PURE__*/css(["cursor:not-allowed;svg{fill:", ";}"], _ref => {
35
+ let {
36
+ theme
37
+ } = _ref;
38
+ return theme.colors.neutral['400'];
39
+ });
34
40
  const StyledSpan = /*#__PURE__*/styled.span.withConfig({
35
41
  componentId: "sc-1xp824d-0"
36
- })(["cursor:pointer;box-sizing:border-box;outline:none;display:flex;justify-content:center;align-items:center;"]);
42
+ })(["cursor:pointer;box-sizing:border-box;outline:none;display:flex;justify-content:center;align-items:center;", ""], _ref2 => {
43
+ let {
44
+ disabled
45
+ } = _ref2;
46
+ return disabled && disabledCaret;
47
+ });
37
48
  const expandRowColumn = {
38
49
  // Build our expander column
39
50
  id: 'expander',
40
51
  // Make sure it has an ID
41
52
  accessor: 'expandRowColumn',
42
- Header: _ref => {
53
+ Header: _ref3 => {
43
54
  let {
44
55
  ctx
45
- } = _ref;
56
+ } = _ref3;
46
57
  const {
47
58
  tableProps: {
48
59
  expandedRows,
49
- onRowExpand
60
+ onRowExpand,
61
+ disabledRows
50
62
  },
51
63
  allDataFlattened
52
64
  } = ctx;
53
65
  const allExpandable = useMemo(() => {
54
66
  const expandable = {};
55
67
  allDataFlattened.forEach(row => {
56
- if (row.original.subRows || row.original.tableRowDetails || row.original.dimsumHeaderValue) expandable[row.uid] = true;
68
+ if (!disabledRows[row.uid] && (row.original.subRows || row.original.tableRowDetails || row.original.dimsumHeaderValue)) expandable[row.uid] = true;
57
69
  });
58
70
  return expandable;
59
- }, [allDataFlattened]);
71
+ }, [allDataFlattened, disabledRows]);
60
72
  const isAllRowsExpanded = useMemo(() => Object.keys(allExpandable).length === Object.keys(expandedRows).length, [allExpandable, expandedRows]);
61
73
  const onExpandedAllHandler = useCallback(() => {
62
74
  if (isAllRowsExpanded) onRowExpand({}, 'All');else onRowExpand(_objectSpread({}, allExpandable), 'All');
@@ -104,19 +116,20 @@ const expandRowColumn = {
104
116
  }
105
117
  }, void 0, GlobalExpandIcon));
106
118
  },
107
- Cell: _ref2 => {
119
+ Cell: _ref4 => {
108
120
  let {
109
121
  cell,
110
122
  row,
111
123
  isRowSelected,
112
124
  ctx,
113
125
  draggableProps
114
- } = _ref2;
126
+ } = _ref4;
115
127
  const {
116
128
  tableProps: {
117
129
  dragAndDropRows,
118
130
  expandedRows,
119
- onRowExpand
131
+ onRowExpand,
132
+ disabledRows
120
133
  }
121
134
  } = ctx;
122
135
  const uniqueId = row.uid;
@@ -150,7 +163,7 @@ const expandRowColumn = {
150
163
  role: 'button',
151
164
  key: `${row.uid}-expand-button`,
152
165
  title: 'Toggle Row Expanded',
153
- onClick: onRowExpandHandler,
166
+ onClick: !disabledRows[row.uid] ? onRowExpandHandler : undefined,
154
167
  onKeyDown: e => {
155
168
  if (['Enter', 'Space'].includes(e.code)) {
156
169
  e.preventDefault();
@@ -158,11 +171,12 @@ const expandRowColumn = {
158
171
  }
159
172
  },
160
173
  ref: cell.ref,
161
- tabIndex: isRowSelected ? 0 : -1,
174
+ tabIndex: isRowSelected || disabledRows[row.uid] ? 0 : -1,
162
175
  'data-testid': 'data-table-row-expand-cell',
163
176
  'aria-expanded': isExpanded,
164
- isRightArrow: !isExpanded || isDragging || isDragOverlay
165
- }), [row.uid, onRowExpandHandler, cell.ref, isRowSelected, isExpanded, isDragging, isDragOverlay]);
177
+ isRightArrow: !isExpanded || isDragging || isDragOverlay,
178
+ disabled: disabledRows[row.uid]
179
+ }), [row.uid, disabledRows, onRowExpandHandler, cell.ref, isRowSelected, isExpanded, isDragging, isDragOverlay]);
166
180
  const PureCaretIcon = useMemo(() => isExpanded && !isDragging && !isDragOverlay ? /*#__PURE__*/_jsx(ArrowheadDown, {
167
181
  "data-is-col-expanded": isExpanded,
168
182
  "data-role": "row-expander-col",
@@ -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';
@@ -17,6 +17,9 @@ import 'core-js/modules/esnext.set.reduce.js';
17
17
  import 'core-js/modules/esnext.set.some.js';
18
18
  import 'core-js/modules/esnext.set.symmetric-difference.js';
19
19
  import 'core-js/modules/esnext.set.union.js';
20
+ import 'core-js/modules/esnext.async-iterator.filter.js';
21
+ import 'core-js/modules/esnext.iterator.constructor.js';
22
+ import 'core-js/modules/esnext.iterator.filter.js';
20
23
  import { useMemo, useState, useEffect } from 'react';
21
24
  import { Grid } from '@elliemae/ds-grid';
22
25
  import { DSComboBox } from '@elliemae/ds-controlled-form';
@@ -29,9 +32,6 @@ import 'styled-components';
29
32
  import '@elliemae/ds-button';
30
33
  import '@elliemae/ds-utilities';
31
34
  import { DATA_TESTID } from '../../../../configs/constants.js';
32
- import 'core-js/modules/esnext.async-iterator.filter.js';
33
- import 'core-js/modules/esnext.iterator.constructor.js';
34
- import 'core-js/modules/esnext.iterator.filter.js';
35
35
  import 'core-js/modules/esnext.async-iterator.reduce.js';
36
36
  import 'core-js/modules/esnext.iterator.reduce.js';
37
37
  import 'react-virtual';
@@ -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 => {
@@ -61,7 +63,8 @@ const BaseSelectFilter = props => {
61
63
  type,
62
64
  column: {
63
65
  id,
64
- filterOptions: userFilterOptions
66
+ filterOptions: userFilterOptions,
67
+ filterMinWidth
65
68
  },
66
69
  ctx: {
67
70
  tableProps: {
@@ -72,10 +75,13 @@ const BaseSelectFilter = props => {
72
75
  innerRef,
73
76
  onValueChange
74
77
  } = props;
78
+ const {
79
+ patchHeaderFilterButtonAndMenu
80
+ } = useDispatchHeadersActions();
75
81
  const filterOptions = useMemo(() => {
76
82
  // If the user didn't provide options, use the available ones
77
83
  if (!userFilterOptions) {
78
- const automaticFilters = [...new Set(data.map(datum => datum[id].toString()))].map(item => ({
84
+ const automaticFilters = [...new Set(data.filter(datum => !!datum[id]).map(datum => datum[id].toString()))].map(item => ({
79
85
  type: 'option',
80
86
  dsId: item,
81
87
  value: item,
@@ -92,6 +98,7 @@ const BaseSelectFilter = props => {
92
98
 
93
99
  const handleOnChange = value => {
94
100
  onValueChange(type, value);
101
+ if (!isMulti) patchHeaderFilterButtonAndMenu(column.id, true);
95
102
  };
96
103
 
97
104
  const [filters, setFilteredOptions] = useState(filterOptions);
@@ -103,7 +110,8 @@ const BaseSelectFilter = props => {
103
110
  "data-testid": isMulti ? DATA_TESTID.DATA_TABLE_MULTISELECT_CONTROLLER : DATA_TESTID.DATA_TABLE_SINGLESELECT_CONTROLLER,
104
111
  style: {
105
112
  background: '#fff',
106
- position: 'relative'
113
+ position: 'relative',
114
+ width: filterMinWidth
107
115
  }
108
116
  }, void 0, /*#__PURE__*/_jsx(DSComboBox, {
109
117
  inline: true,
@@ -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