@elliemae/ds-data-table 2.4.3-rc.11 → 2.4.3-rc.12

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.
@@ -41,32 +41,44 @@ var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled$1);
41
41
  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; }
42
42
 
43
43
  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__default["default"](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; }
44
+ const disabledCaret = /*#__PURE__*/styled$1.css(["cursor:not-allowed;svg{fill:", ";}"], _ref => {
45
+ let {
46
+ theme
47
+ } = _ref;
48
+ return theme.colors.neutral['400'];
49
+ });
44
50
  const StyledSpan = /*#__PURE__*/styled__default["default"].span.withConfig({
45
51
  componentId: "sc-1xp824d-0"
46
- })(["cursor:pointer;box-sizing:border-box;outline:none;display:flex;justify-content:center;align-items:center;"]);
52
+ })(["cursor:pointer;box-sizing:border-box;outline:none;display:flex;justify-content:center;align-items:center;", ""], _ref2 => {
53
+ let {
54
+ disabled
55
+ } = _ref2;
56
+ return disabled && disabledCaret;
57
+ });
47
58
  const expandRowColumn = {
48
59
  // Build our expander column
49
60
  id: 'expander',
50
61
  // Make sure it has an ID
51
62
  accessor: 'expandRowColumn',
52
- Header: _ref => {
63
+ Header: _ref3 => {
53
64
  let {
54
65
  ctx
55
- } = _ref;
66
+ } = _ref3;
56
67
  const {
57
68
  tableProps: {
58
69
  expandedRows,
59
- onRowExpand
70
+ onRowExpand,
71
+ disabledRows
60
72
  },
61
73
  allDataFlattened
62
74
  } = ctx;
63
75
  const allExpandable = React.useMemo(() => {
64
76
  const expandable = {};
65
77
  allDataFlattened.forEach(row => {
66
- if (row.original.subRows || row.original.tableRowDetails || row.original.dimsumHeaderValue) expandable[row.uid] = true;
78
+ if (!disabledRows[row.uid] && (row.original.subRows || row.original.tableRowDetails || row.original.dimsumHeaderValue)) expandable[row.uid] = true;
67
79
  });
68
80
  return expandable;
69
- }, [allDataFlattened]);
81
+ }, [allDataFlattened, disabledRows]);
70
82
  const isAllRowsExpanded = React.useMemo(() => Object.keys(allExpandable).length === Object.keys(expandedRows).length, [allExpandable, expandedRows]);
71
83
  const onExpandedAllHandler = React.useCallback(() => {
72
84
  if (isAllRowsExpanded) onRowExpand({}, 'All');else onRowExpand(_objectSpread({}, allExpandable), 'All');
@@ -114,19 +126,20 @@ const expandRowColumn = {
114
126
  }
115
127
  }, void 0, GlobalExpandIcon));
116
128
  },
117
- Cell: _ref2 => {
129
+ Cell: _ref4 => {
118
130
  let {
119
131
  cell,
120
132
  row,
121
133
  isRowSelected,
122
134
  ctx,
123
135
  draggableProps
124
- } = _ref2;
136
+ } = _ref4;
125
137
  const {
126
138
  tableProps: {
127
139
  dragAndDropRows,
128
140
  expandedRows,
129
- onRowExpand
141
+ onRowExpand,
142
+ disabledRows
130
143
  }
131
144
  } = ctx;
132
145
  const uniqueId = row.uid;
@@ -160,7 +173,7 @@ const expandRowColumn = {
160
173
  role: 'button',
161
174
  key: `${row.uid}-expand-button`,
162
175
  title: 'Toggle Row Expanded',
163
- onClick: onRowExpandHandler,
176
+ onClick: !disabledRows[row.uid] ? onRowExpandHandler : undefined,
164
177
  onKeyDown: e => {
165
178
  if (['Enter', 'Space'].includes(e.code)) {
166
179
  e.preventDefault();
@@ -168,11 +181,12 @@ const expandRowColumn = {
168
181
  }
169
182
  },
170
183
  ref: cell.ref,
171
- tabIndex: isRowSelected ? 0 : -1,
184
+ tabIndex: isRowSelected || disabledRows[row.uid] ? 0 : -1,
172
185
  'data-testid': 'data-table-row-expand-cell',
173
186
  'aria-expanded': isExpanded,
174
- isRightArrow: !isExpanded || isDragging || isDragOverlay
175
- }), [row.uid, onRowExpandHandler, cell.ref, isRowSelected, isExpanded, isDragging, isDragOverlay]);
187
+ isRightArrow: !isExpanded || isDragging || isDragOverlay,
188
+ disabled: disabledRows[row.uid]
189
+ }), [row.uid, disabledRows, onRowExpandHandler, cell.ref, isRowSelected, isExpanded, isDragging, isDragOverlay]);
176
190
  const PureCaretIcon = React.useMemo(() => isExpanded && !isDragging && !isDragOverlay ? /*#__PURE__*/_jsx__default["default"](dsIcons.ArrowheadDown, {
177
191
  "data-is-col-expanded": isExpanded,
178
192
  "data-role": "row-expander-col",
@@ -141,7 +141,7 @@ const DefaultRowContentRenderer = props => {
141
141
  detailsIndent: detailsIndent
142
142
  }))]
143
143
  });
144
- }, [row, selection, isExpandable, expandedRows, disabledRows, gridTemplateColProps, backgroundColor, compact, dropIndicatorPosition, isDndActive, isDragging, isDragOverlay, noSelectionColumn, selectedRowId, detailsIndent]);
144
+ }, [row, disabledRows, selection, isExpandable, expandedRows, gridTemplateColProps, backgroundColor, compact, dropIndicatorPosition, isDndActive, isDragging, isDragOverlay, noSelectionColumn, handleSelectDisableRow, selectedRowId, detailsIndent]);
145
145
  return PureRowContent;
146
146
  };
147
147
 
@@ -56,7 +56,7 @@ const useRowRendererHandlers = _ref => {
56
56
  }
57
57
  } = React.useContext(DataTableContext["default"]);
58
58
 
59
- const isOptionFocuseable = opt => !disabledRows[opt.id];
59
+ const isOptionFocuseable = opt => !disabledRows[opt.uid];
60
60
 
61
61
  const findInCircularList = function (list, from, criteria) {
62
62
  let step = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
@@ -121,7 +121,7 @@ const Cell = _ref2 => {
121
121
  return null;
122
122
  }, [DefaultCellContentJSX, cellProps, column]);
123
123
  return /*#__PURE__*/jsxRuntime.jsx(PureStandardCell, _objectSpread(_objectSpread({}, cellProps), {}, {
124
- children: column.editable && !disabledRows[row.id] ? EditableContentJSX : DefaultCellContentJSX
124
+ children: column.editable && !disabledRows[row.uid] ? EditableContentJSX : DefaultCellContentJSX
125
125
  }));
126
126
  };
127
127
 
package/cjs/parts/Row.js CHANGED
@@ -59,7 +59,7 @@ const RowComp = props => {
59
59
  } = React.useContext(SortableItemContext.SortableItemContext);
60
60
  const draggableRef = draggableProps && draggableProps.setNodeRef;
61
61
  return /*#__PURE__*/jsxRuntime.jsx(StyledRow, {
62
- disabled: disabledRows[row.id],
62
+ disabled: disabledRows[row.uid],
63
63
  style: !isDragOverlay ? itemWrapperStyle : {},
64
64
  ref: ref => setItemRefs(measureRef, draggableRef, ref),
65
65
  children: /*#__PURE__*/_jsx__default["default"](index.RowVariantMapItem, {
package/cjs/styled.js CHANGED
@@ -224,9 +224,10 @@ const StyledCellContainer = /*#__PURE__*/styled__default["default"](Grid__defaul
224
224
  }, _ref12 => {
225
225
  let {
226
226
  shouldDisplayHover,
227
- theme
227
+ theme,
228
+ disabled
228
229
  } = _ref12;
229
- return shouldDisplayHover ? `:hover {
230
+ return shouldDisplayHover && !disabled ? `:hover {
230
231
  background-color: ${theme.colors.brand[200]};
231
232
  }` : '';
232
233
  }, props => props.isDragOverlay ? 'rgba(0,0,0,0.5)' : 'transparent', props => props.isDragging ? 0.8 : 1, props => !props.selected ? '' : `
@@ -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",
@@ -132,7 +132,7 @@ const DefaultRowContentRenderer = props => {
132
132
  detailsIndent: detailsIndent
133
133
  }))]
134
134
  });
135
- }, [row, selection, isExpandable, expandedRows, disabledRows, gridTemplateColProps, backgroundColor, compact, dropIndicatorPosition, isDndActive, isDragging, isDragOverlay, noSelectionColumn, selectedRowId, detailsIndent]);
135
+ }, [row, disabledRows, selection, isExpandable, expandedRows, gridTemplateColProps, backgroundColor, compact, dropIndicatorPosition, isDndActive, isDragging, isDragOverlay, noSelectionColumn, handleSelectDisableRow, selectedRowId, detailsIndent]);
136
136
  return PureRowContent;
137
137
  };
138
138
 
@@ -52,7 +52,7 @@ const useRowRendererHandlers = _ref => {
52
52
  }
53
53
  } = useContext(DataTableContext);
54
54
 
55
- const isOptionFocuseable = opt => !disabledRows[opt.id];
55
+ const isOptionFocuseable = opt => !disabledRows[opt.uid];
56
56
 
57
57
  const findInCircularList = function (list, from, criteria) {
58
58
  let step = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
@@ -113,7 +113,7 @@ const Cell = _ref2 => {
113
113
  return null;
114
114
  }, [DefaultCellContentJSX, cellProps, column]);
115
115
  return /*#__PURE__*/jsx(PureStandardCell, _objectSpread(_objectSpread({}, cellProps), {}, {
116
- children: column.editable && !disabledRows[row.id] ? EditableContentJSX : DefaultCellContentJSX
116
+ children: column.editable && !disabledRows[row.uid] ? EditableContentJSX : DefaultCellContentJSX
117
117
  }));
118
118
  };
119
119
 
package/esm/parts/Row.js CHANGED
@@ -51,7 +51,7 @@ const RowComp = props => {
51
51
  } = useContext(SortableItemContext);
52
52
  const draggableRef = draggableProps && draggableProps.setNodeRef;
53
53
  return /*#__PURE__*/jsx(StyledRow, {
54
- disabled: disabledRows[row.id],
54
+ disabled: disabledRows[row.uid],
55
55
  style: !isDragOverlay ? itemWrapperStyle : {},
56
56
  ref: ref => setItemRefs(measureRef, draggableRef, ref),
57
57
  children: /*#__PURE__*/_jsx(RowVariantMapItem, {
package/esm/styled.js CHANGED
@@ -215,9 +215,10 @@ const StyledCellContainer = /*#__PURE__*/styled(Grid).withConfig({
215
215
  }, _ref12 => {
216
216
  let {
217
217
  shouldDisplayHover,
218
- theme
218
+ theme,
219
+ disabled
219
220
  } = _ref12;
220
- return shouldDisplayHover ? `:hover {
221
+ return shouldDisplayHover && !disabled ? `:hover {
221
222
  background-color: ${theme.colors.brand[200]};
222
223
  }` : '';
223
224
  }, props => props.isDragOverlay ? 'rgba(0,0,0,0.5)' : 'transparent', props => props.isDragging ? 0.8 : 1, props => !props.selected ? '' : `
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-data-table",
3
- "version": "2.4.3-rc.11",
3
+ "version": "2.4.3-rc.12",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Data Table",
6
6
  "module": "./esm/index.js",
@@ -570,24 +570,24 @@
570
570
  "dependencies": {
571
571
  "@dnd-kit/core": "~4.0.1",
572
572
  "@dnd-kit/sortable": "~5.0.0",
573
- "@elliemae/ds-button": "2.4.3-rc.11",
574
- "@elliemae/ds-circular-progress-indicator": "2.4.3-rc.11",
575
- "@elliemae/ds-controlled-form": "2.4.3-rc.11",
576
- "@elliemae/ds-drag-and-drop": "2.4.3-rc.11",
577
- "@elliemae/ds-dropdownmenu": "2.4.3-rc.11",
578
- "@elliemae/ds-form": "2.4.3-rc.11",
579
- "@elliemae/ds-form-layout-blocks": "2.4.3-rc.11",
580
- "@elliemae/ds-grid": "2.4.3-rc.11",
581
- "@elliemae/ds-icons": "2.4.3-rc.11",
582
- "@elliemae/ds-indeterminate-progress-indicator": "2.4.3-rc.11",
583
- "@elliemae/ds-pagination": "2.4.3-rc.11",
584
- "@elliemae/ds-pills": "2.4.3-rc.11",
585
- "@elliemae/ds-popperjs": "2.4.3-rc.11",
586
- "@elliemae/ds-props-helpers": "2.4.3-rc.11",
587
- "@elliemae/ds-system": "2.4.3-rc.11",
588
- "@elliemae/ds-toolbar": "2.4.3-rc.11",
589
- "@elliemae/ds-truncated-tooltip-text": "2.4.3-rc.11",
590
- "@elliemae/ds-utilities": "2.4.3-rc.11",
573
+ "@elliemae/ds-button": "2.4.3-rc.12",
574
+ "@elliemae/ds-circular-progress-indicator": "2.4.3-rc.12",
575
+ "@elliemae/ds-controlled-form": "2.4.3-rc.12",
576
+ "@elliemae/ds-drag-and-drop": "2.4.3-rc.12",
577
+ "@elliemae/ds-dropdownmenu": "2.4.3-rc.12",
578
+ "@elliemae/ds-form": "2.4.3-rc.12",
579
+ "@elliemae/ds-form-layout-blocks": "2.4.3-rc.12",
580
+ "@elliemae/ds-grid": "2.4.3-rc.12",
581
+ "@elliemae/ds-icons": "2.4.3-rc.12",
582
+ "@elliemae/ds-indeterminate-progress-indicator": "2.4.3-rc.12",
583
+ "@elliemae/ds-pagination": "2.4.3-rc.12",
584
+ "@elliemae/ds-pills": "2.4.3-rc.12",
585
+ "@elliemae/ds-popperjs": "2.4.3-rc.12",
586
+ "@elliemae/ds-props-helpers": "2.4.3-rc.12",
587
+ "@elliemae/ds-system": "2.4.3-rc.12",
588
+ "@elliemae/ds-toolbar": "2.4.3-rc.12",
589
+ "@elliemae/ds-truncated-tooltip-text": "2.4.3-rc.12",
590
+ "@elliemae/ds-utilities": "2.4.3-rc.12",
591
591
  "@reduxjs/toolkit": "~1.6.2",
592
592
  "csstype": "~3.0.9",
593
593
  "moment": "~2.29.1",