@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.
- package/cjs/DataTable.js +10 -1
- package/cjs/DataTableSchema.js +5 -0
- package/cjs/addons/Columns/ColumnExpand/ColumnExpand.js +27 -13
- package/cjs/addons/Editables/ComboboxEditableCell/ComboboxEditableCell.js +1 -1
- package/cjs/addons/Editables/DateEditableCell/DateEditableCell.js +1 -1
- package/cjs/addons/Editables/TextEditableCell/TextEditableCell.js +1 -1
- package/cjs/addons/Filters/Components/SelectFilter/BaseSelectFilter.js +14 -6
- package/cjs/addons/Filters/Components/SelectFilter/MultiSelectFilter.js +1 -1
- package/cjs/addons/Filters/Components/SelectFilter/SingleSelectFilter.js +1 -1
- package/cjs/configs/useDatatableConfig.js +5 -1
- package/cjs/exported-related/EditableCell.js +1 -2
- package/cjs/exported-related/FilterPopover.js +29 -27
- package/cjs/exported-related/RowRenderer/DefaultRowContentRenderer.js +9 -2
- package/cjs/exported-related/RowRenderer/useRowRendererHandlers.js +25 -7
- package/cjs/exported-related/Toolbar/Toolbar.js +3 -10
- package/cjs/parts/Cells/Cell.js +3 -2
- package/cjs/parts/FilterBar/FiltersBar.js +29 -2
- package/cjs/parts/Filters/index.js +1 -1
- package/cjs/parts/Headers/HeaderCellGroup.js +3 -2
- package/cjs/parts/Headers/HeaderResizer.js +1 -1
- package/cjs/parts/Row.js +17 -1
- package/cjs/parts/RowVariants/index.js +1 -1
- package/cjs/parts/TableContent.js +1 -1
- package/cjs/styled.js +39 -41
- package/esm/DataTable.js +10 -1
- package/esm/DataTableSchema.js +5 -0
- package/esm/addons/Columns/ColumnExpand/ColumnExpand.js +28 -14
- package/esm/addons/Editables/ComboboxEditableCell/ComboboxEditableCell.js +1 -1
- package/esm/addons/Editables/DateEditableCell/DateEditableCell.js +1 -1
- package/esm/addons/Editables/TextEditableCell/TextEditableCell.js +1 -1
- package/esm/addons/Filters/Components/SelectFilter/BaseSelectFilter.js +14 -6
- package/esm/addons/Filters/Components/SelectFilter/MultiSelectFilter.js +1 -1
- package/esm/addons/Filters/Components/SelectFilter/SingleSelectFilter.js +1 -1
- package/esm/configs/useDatatableConfig.js +5 -1
- package/esm/exported-related/EditableCell.js +1 -2
- package/esm/exported-related/FilterPopover.js +30 -28
- package/esm/exported-related/RowRenderer/DefaultRowContentRenderer.js +10 -3
- package/esm/exported-related/RowRenderer/useRowRendererHandlers.js +25 -7
- package/esm/exported-related/Toolbar/Toolbar.js +3 -10
- package/esm/parts/Cells/Cell.js +3 -2
- package/esm/parts/FilterBar/FiltersBar.js +30 -3
- package/esm/parts/Filters/index.js +1 -1
- package/esm/parts/Headers/HeaderCellGroup.js +3 -2
- package/esm/parts/Headers/HeaderResizer.js +1 -1
- package/esm/parts/Row.js +17 -1
- package/esm/parts/RowVariants/index.js +1 -1
- package/esm/parts/TableContent.js +2 -2
- package/esm/styled.js +39 -42
- package/package.json +19 -19
- package/types/styled.d.ts +2 -1
- package/types/types/props.d.ts +1 -0
|
@@ -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 {
|
|
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
|
-
|
|
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
|
-
} =
|
|
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__*/
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
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,
|
|
@@ -125,7 +132,7 @@ const DefaultRowContentRenderer = props => {
|
|
|
125
132
|
detailsIndent: detailsIndent
|
|
126
133
|
}))]
|
|
127
134
|
});
|
|
128
|
-
}, [row, selection, isExpandable, expandedRows,
|
|
135
|
+
}, [row, disabledRows, selection, isExpandable, expandedRows, gridTemplateColProps, backgroundColor, compact, dropIndicatorPosition, isDndActive, isDragging, isDragOverlay, noSelectionColumn, handleSelectDisableRow, selectedRowId, detailsIndent]);
|
|
129
136
|
return PureRowContent;
|
|
130
137
|
};
|
|
131
138
|
|
|
@@ -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.uid];
|
|
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
|
-
|
|
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
|
-
|
|
123
|
+
const prev = findInCircularList(items, itemIndex, isOptionFocuseable, -1);
|
|
124
|
+
setFocusedRowId(items[prev].uid);
|
|
107
125
|
}
|
|
108
|
-
}, [isDragOverlay, isActive, selectedRowId, row, setSelectedRowId, handleItemClick, itemIndex,
|
|
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
|
-
|
|
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(
|
|
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",
|
package/esm/parts/Cells/Cell.js
CHANGED
|
@@ -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.uid] ? EditableContentJSX : DefaultCellContentJSX
|
|
116
117
|
}));
|
|
117
118
|
};
|
|
118
119
|
|
|
@@ -4,7 +4,7 @@ import 'core-js/modules/esnext.iterator.map.js';
|
|
|
4
4
|
import 'core-js/modules/esnext.async-iterator.find.js';
|
|
5
5
|
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
6
6
|
import 'core-js/modules/esnext.iterator.find.js';
|
|
7
|
-
import React, { useContext, useMemo, useRef, useCallback } from 'react';
|
|
7
|
+
import React, { useContext, useState, useMemo, useRef, useCallback } from 'react';
|
|
8
8
|
import DSButton from '@elliemae/ds-button';
|
|
9
9
|
import { MoreOptionsVert } from '@elliemae/ds-icons';
|
|
10
10
|
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
@@ -16,9 +16,9 @@ import '@elliemae/ds-popperjs';
|
|
|
16
16
|
import 'styled-components';
|
|
17
17
|
import '../../redux/reducers/index.js';
|
|
18
18
|
import { DATA_TESTID } from '../../configs/constants.js';
|
|
19
|
-
import 'react/jsx-runtime';
|
|
20
19
|
import '../../styled.js';
|
|
21
20
|
import DataTableContext from '../../DataTableContext.js';
|
|
21
|
+
import 'react/jsx-runtime';
|
|
22
22
|
import '@elliemae/ds-utilities';
|
|
23
23
|
import 'core-js/modules/esnext.async-iterator.reduce.js';
|
|
24
24
|
import 'core-js/modules/esnext.iterator.reduce.js';
|
|
@@ -66,6 +66,7 @@ const FiltersBar = () => {
|
|
|
66
66
|
},
|
|
67
67
|
visibleColumns
|
|
68
68
|
} = useContext(DataTableContext);
|
|
69
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
69
70
|
const pillGroupRefs = useMemo(() => {
|
|
70
71
|
const refs = [];
|
|
71
72
|
|
|
@@ -76,7 +77,29 @@ const FiltersBar = () => {
|
|
|
76
77
|
const dropdownMenuRef = useRef(null);
|
|
77
78
|
const removeAllFilters = useCallback(() => {
|
|
78
79
|
onFiltersChange([]);
|
|
79
|
-
|
|
80
|
+
filterBarProps?.onClearAllFiltersClick?.();
|
|
81
|
+
}, [onFiltersChange, filterBarProps?.onClearAllFiltersClick]);
|
|
82
|
+
const onFilterBarClose = useCallback(() => {
|
|
83
|
+
filterBarProps?.onDropdownMenuToggle?.(false, 'onClose');
|
|
84
|
+
setIsOpen(false);
|
|
85
|
+
}, [filterBarProps?.onDropdownMenuToggle]);
|
|
86
|
+
const onFilterBarOpen = useCallback(() => {
|
|
87
|
+
filterBarProps?.onDropdownMenuToggle?.(true, 'onOpen');
|
|
88
|
+
setIsOpen(true);
|
|
89
|
+
}, [filterBarProps?.onDropdownMenuToggle]);
|
|
90
|
+
const onFilterBarOnClickOutside = useCallback(() => {
|
|
91
|
+
filterBarProps?.onDropdownMenuToggle?.(false, 'onClickOutside');
|
|
92
|
+
filterBarProps?.onDropdownMenuClickOutside?.();
|
|
93
|
+
setIsOpen(false);
|
|
94
|
+
}, [filterBarProps?.onDropdownMenuToggle, filterBarProps?.onDropdownMenuClickOutside]);
|
|
95
|
+
const onTriggerClick = useCallback(() => {
|
|
96
|
+
filterBarProps?.onDropdownMenuTriggerClick?.();
|
|
97
|
+
onFilterBarOpen();
|
|
98
|
+
}, [filterBarProps?.onDropdownMenuTriggerClick]);
|
|
99
|
+
const finalIsOpen = useMemo(() => {
|
|
100
|
+
if (typeof filterBarProps?.isDropdownMenuOpen === 'boolean') return filterBarProps.isDropdownMenuOpen;
|
|
101
|
+
return isOpen;
|
|
102
|
+
}, [filterBarProps?.isDropdownMenuOpen, isOpen]);
|
|
80
103
|
return /*#__PURE__*/_jsx(StyledWrapper, {
|
|
81
104
|
width: width,
|
|
82
105
|
"aria-live": "polite",
|
|
@@ -112,6 +135,9 @@ const FiltersBar = () => {
|
|
|
112
135
|
}, column);
|
|
113
136
|
}), /*#__PURE__*/_jsx(StyledDropdownMenu, {
|
|
114
137
|
preventOverflow: "scrollParent",
|
|
138
|
+
isOpen: finalIsOpen,
|
|
139
|
+
onClose: onFilterBarClose,
|
|
140
|
+
onClickOutsideMenu: onFilterBarOnClickOutside,
|
|
115
141
|
options: [{
|
|
116
142
|
id: '__internal__option__clear__filters',
|
|
117
143
|
label: 'Clear Filters',
|
|
@@ -123,6 +149,7 @@ const FiltersBar = () => {
|
|
|
123
149
|
},
|
|
124
150
|
buttonType: "text",
|
|
125
151
|
innerRef: dropdownMenuRef,
|
|
152
|
+
onClick: onTriggerClick,
|
|
126
153
|
icon: _MoreOptionsVert || (_MoreOptionsVert = /*#__PURE__*/_jsx(MoreOptionsVert, {}))
|
|
127
154
|
})
|
|
128
155
|
}));
|
|
@@ -21,9 +21,9 @@ import '@elliemae/ds-popperjs';
|
|
|
21
21
|
import 'styled-components';
|
|
22
22
|
import '../../redux/reducers/index.js';
|
|
23
23
|
import '../../configs/constants.js';
|
|
24
|
-
import { jsx } from 'react/jsx-runtime';
|
|
25
24
|
import '../../styled.js';
|
|
26
25
|
import '../../DataTableContext.js';
|
|
26
|
+
import { jsx } from 'react/jsx-runtime';
|
|
27
27
|
import '@elliemae/ds-icons';
|
|
28
28
|
import '@elliemae/ds-utilities';
|
|
29
29
|
import 'core-js/modules/esnext.async-iterator.reduce.js';
|
|
@@ -40,9 +40,10 @@ const StyledWrapper = /*#__PURE__*/styled(Grid).withConfig({
|
|
|
40
40
|
componentId: "sc-1dqaj8a-0"
|
|
41
41
|
})(["position:relative;", " width:", ";grid-column:", ";background:", ";opacity:", ";box-shadow:0 2px 4px 0 ", ";border-left:", " solid ", ";"], _ref => {
|
|
42
42
|
let {
|
|
43
|
-
shouldDropOneLevel
|
|
43
|
+
shouldDropOneLevel,
|
|
44
|
+
isDragOverlay
|
|
44
45
|
} = _ref;
|
|
45
|
-
return shouldDropOneLevel ? `top: 50%; height: 50%;` : '';
|
|
46
|
+
return shouldDropOneLevel && !isDragOverlay ? `top: 50%; height: 50%;` : '';
|
|
46
47
|
}, 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 => {
|
|
47
48
|
let {
|
|
48
49
|
isFirst
|
|
@@ -71,9 +71,9 @@ const HeaderResizer = _ref => {
|
|
|
71
71
|
e.stopPropagation();
|
|
72
72
|
}, [column.id, nextWidth, visibleColumnsCopy]);
|
|
73
73
|
const onResizeEnd = useCallback(() => {
|
|
74
|
-
onColumnResize(column.id, nextWidth);
|
|
75
74
|
setGridLayout(columnsToGrid(visibleColumns, ColsLayoutStyle.Fixed));
|
|
76
75
|
setIsResizing(false);
|
|
76
|
+
onColumnResize(column.id, nextWidth);
|
|
77
77
|
}, [onColumnResize, column.id, nextWidth, setGridLayout, visibleColumns]);
|
|
78
78
|
useEffect(() => {
|
|
79
79
|
const debouncedResizeHandler = onResizeHandler;
|
package/esm/parts/Row.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
2
|
import { useContext } from 'react';
|
|
3
3
|
import { connect } from 'react-redux';
|
|
4
|
+
import { styled } from '@elliemae/ds-system';
|
|
4
5
|
import DataTableContext from '../DataTableContext.js';
|
|
5
6
|
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
6
7
|
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
@@ -21,6 +22,15 @@ const setItemRefs = (measureRef, draggableRef, ref) => {
|
|
|
21
22
|
setMultipleRefs(...refsToSet)(ref);
|
|
22
23
|
};
|
|
23
24
|
|
|
25
|
+
const StyledRow = styled('div')`
|
|
26
|
+
cursor: ${_ref => {
|
|
27
|
+
let {
|
|
28
|
+
disabled
|
|
29
|
+
} = _ref;
|
|
30
|
+
return disabled ? 'not-allowed' : 'normal';
|
|
31
|
+
}};
|
|
32
|
+
`;
|
|
33
|
+
|
|
24
34
|
const RowComp = props => {
|
|
25
35
|
const {
|
|
26
36
|
row,
|
|
@@ -31,11 +41,17 @@ const RowComp = props => {
|
|
|
31
41
|
selectedRowId
|
|
32
42
|
} = props;
|
|
33
43
|
const ctx = useContext(DataTableContext);
|
|
44
|
+
const {
|
|
45
|
+
tableProps: {
|
|
46
|
+
disabledRows
|
|
47
|
+
}
|
|
48
|
+
} = ctx;
|
|
34
49
|
const {
|
|
35
50
|
draggableProps
|
|
36
51
|
} = useContext(SortableItemContext);
|
|
37
52
|
const draggableRef = draggableProps && draggableProps.setNodeRef;
|
|
38
|
-
return /*#__PURE__*/jsx(
|
|
53
|
+
return /*#__PURE__*/jsx(StyledRow, {
|
|
54
|
+
disabled: disabledRows[row.uid],
|
|
39
55
|
style: !isDragOverlay ? itemWrapperStyle : {},
|
|
40
56
|
ref: ref => setItemRefs(measureRef, draggableRef, ref),
|
|
41
57
|
children: /*#__PURE__*/_jsx(RowVariantMapItem, {
|
|
@@ -12,9 +12,9 @@ import '@elliemae/ds-popperjs';
|
|
|
12
12
|
import 'styled-components';
|
|
13
13
|
import '../../redux/reducers/index.js';
|
|
14
14
|
import '../../configs/constants.js';
|
|
15
|
-
import { jsx } from 'react/jsx-runtime';
|
|
16
15
|
import '../../styled.js';
|
|
17
16
|
import '../../DataTableContext.js';
|
|
17
|
+
import { jsx } from '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';
|
|
@@ -7,7 +7,7 @@ import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
|
7
7
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
8
8
|
import React, { useContext, useState, useMemo } from 'react';
|
|
9
9
|
import { connect } from 'react-redux';
|
|
10
|
-
import {
|
|
10
|
+
import { StyledDataTableContentWrapper, StyledTableWrapper } from '../styled.js';
|
|
11
11
|
import DataTableContext from '../DataTableContext.js';
|
|
12
12
|
import { Pagination } from '../addons/Pagination/Pagination.js';
|
|
13
13
|
import VirtualRowsList from './VirtualRowsList.js';
|
|
@@ -56,7 +56,7 @@ const TableContentComponent = props => {
|
|
|
56
56
|
visibleColumns
|
|
57
57
|
} = useContext(DataTableContext);
|
|
58
58
|
const [shiftKeyPressed, setShiftKeyPressed] = useState(false);
|
|
59
|
-
const PureTableContent = useMemo(() => /*#__PURE__*/jsxs(
|
|
59
|
+
const PureTableContent = useMemo(() => /*#__PURE__*/jsxs(StyledDataTableContentWrapper, {
|
|
60
60
|
"data-testid": DATA_TESTID.DATA_TABLE_CONTENT_WRAPPER,
|
|
61
61
|
height: height,
|
|
62
62
|
width: width,
|
package/esm/styled.js
CHANGED
|
@@ -54,14 +54,17 @@ const StyledFocusWithin = /*#__PURE__*/styled(Grid).withConfig({
|
|
|
54
54
|
})([":focus-within{", "}"], props => props.hideFocus ? '' : styledFocusCss(props));
|
|
55
55
|
const StyledDataTableWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
56
56
|
componentId: "sc-38sgfo-1"
|
|
57
|
-
})(["width:", ";height:", ";
|
|
57
|
+
})(["width:", ";height:", ";"], props => sizeToCss(props.width ?? ' 100%'), props => sizeToCss(props.height ?? ' 100%'));
|
|
58
|
+
const StyledDataTableContentWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
59
|
+
componentId: "sc-38sgfo-2"
|
|
60
|
+
})(["user-select:", ";width:100%;height:100%;"], _ref2 => {
|
|
58
61
|
let {
|
|
59
62
|
noSelectionAllowed
|
|
60
63
|
} = _ref2;
|
|
61
64
|
return noSelectionAllowed ? 'none' : 'auto';
|
|
62
65
|
});
|
|
63
66
|
const StyledTableWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
64
|
-
componentId: "sc-38sgfo-
|
|
67
|
+
componentId: "sc-38sgfo-3"
|
|
65
68
|
})(["display:inline-block;border-spacing:0;z-index:0;position:relative;", ""], _ref3 => {
|
|
66
69
|
let {
|
|
67
70
|
width = '100%',
|
|
@@ -73,7 +76,7 @@ const StyledTableWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
|
73
76
|
`;
|
|
74
77
|
});
|
|
75
78
|
const StyledTableContentWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
76
|
-
componentId: "sc-38sgfo-
|
|
79
|
+
componentId: "sc-38sgfo-4"
|
|
77
80
|
})(["position:relative;", ""], _ref4 => {
|
|
78
81
|
let {
|
|
79
82
|
height = 'auto'
|
|
@@ -83,7 +86,7 @@ const StyledTableContentWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
|
83
86
|
`;
|
|
84
87
|
});
|
|
85
88
|
const StyledVirtualListWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
86
|
-
componentId: "sc-38sgfo-
|
|
89
|
+
componentId: "sc-38sgfo-5"
|
|
87
90
|
})(["overflow:auto;", ""], _ref5 => {
|
|
88
91
|
let {
|
|
89
92
|
height = 'auto',
|
|
@@ -114,18 +117,17 @@ const getGridTemplateColumnsStyle = _ref6 => {
|
|
|
114
117
|
};
|
|
115
118
|
|
|
116
119
|
const StyledHeadWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
117
|
-
componentId: "sc-38sgfo-
|
|
120
|
+
componentId: "sc-38sgfo-6"
|
|
118
121
|
})(["position:relative;position:sticky;top:0;z-index:4;background:white;width:", ";"], props => props.colsLayoutStyle === ColsLayoutStyle.Fixed ? sizeToCss(props.totalColumnsWidth) : '100%');
|
|
119
122
|
const StyledHeadTr = /*#__PURE__*/styled(Grid).withConfig({
|
|
120
|
-
componentId: "sc-38sgfo-
|
|
121
|
-
})(["", ";", ";border-right:1px solid ", ";border-bottom:1px solid ", ";"], props => props.colsLayoutStyle === ColsLayoutStyle.Auto ? 'width:100%' : '', props => getGridTemplateColumnsStyle({
|
|
123
|
+
componentId: "sc-38sgfo-7"
|
|
124
|
+
})(["", ";", ";border-right:1px solid ", ";border-bottom:1px solid ", ";grid-auto-flow:column;"], props => props.colsLayoutStyle === ColsLayoutStyle.Auto ? 'width:100%' : '', props => getGridTemplateColumnsStyle({
|
|
122
125
|
cols: props.cols,
|
|
123
126
|
isExpandable: props.isExpandable,
|
|
124
127
|
colsLayoutStyle: props.colsLayoutStyle
|
|
125
128
|
}), props => props.theme.colors.neutral['080'], props => props.theme.colors.neutral['080']);
|
|
126
|
-
|
|
127
129
|
const StyledHeadTh = /*#__PURE__*/styled.div.withConfig({
|
|
128
|
-
componentId: "sc-38sgfo-
|
|
130
|
+
componentId: "sc-38sgfo-8"
|
|
129
131
|
})(["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:", ";}}"], columnPadding, ZIndexDataTable.HEADER_ROW, props => props.isDraggingActive ? '' : `:hover {
|
|
130
132
|
&:after {
|
|
131
133
|
display: block;
|
|
@@ -142,86 +144,81 @@ const StyledHeadTh = /*#__PURE__*/styled.div.withConfig({
|
|
|
142
144
|
cursor: pointer;
|
|
143
145
|
}`, props => props.theme.colors.brand[700], ZIndexDataTable.FOCUS_BORDER);
|
|
144
146
|
const StyledHeaderRightIconsWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
145
|
-
componentId: "sc-38sgfo-
|
|
147
|
+
componentId: "sc-38sgfo-9"
|
|
146
148
|
})(["height:100%;display:flex;align-items:center;max-height:24px;"]);
|
|
147
149
|
const StyledResizer = /*#__PURE__*/styled.div.withConfig({
|
|
148
|
-
componentId: "sc-38sgfo-
|
|
149
|
-
})(["display:inline-block;background:
|
|
150
|
-
let {
|
|
151
|
-
isResizing,
|
|
152
|
-
theme
|
|
153
|
-
} = _ref7;
|
|
154
|
-
return isResizing ? theme.colors.brand[600] : theme.colors.brand[400];
|
|
155
|
-
}); // CELL ***********************************************************************/
|
|
150
|
+
componentId: "sc-38sgfo-10"
|
|
151
|
+
})(["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 ***********************************************************************/
|
|
156
152
|
|
|
157
153
|
const StyledActionCell = /*#__PURE__*/styled.div.withConfig({
|
|
158
|
-
componentId: "sc-38sgfo-
|
|
154
|
+
componentId: "sc-38sgfo-11"
|
|
159
155
|
})(["position:relative;position:sticky;display:inline-block;right:0;background:white;"]);
|
|
160
156
|
const StyledCell = /*#__PURE__*/styled.div.withConfig({
|
|
161
|
-
componentId: "sc-38sgfo-
|
|
157
|
+
componentId: "sc-38sgfo-12"
|
|
162
158
|
})(["", " display:flex;align-items:center;width:100%;position:relative;"], cellPadding);
|
|
163
159
|
const StyledCellContent = /*#__PURE__*/styled.div.withConfig({
|
|
164
|
-
componentId: "sc-38sgfo-
|
|
160
|
+
componentId: "sc-38sgfo-13"
|
|
165
161
|
})(["display:grid;justify-self:flex-end;flex:1 1 auto;width:100%;height:100%;align-items:center;"]);
|
|
166
162
|
const StyledPencilIcon = /*#__PURE__*/styled(EditPencil).withConfig({
|
|
167
|
-
componentId: "sc-38sgfo-
|
|
163
|
+
componentId: "sc-38sgfo-14"
|
|
168
164
|
})([""]);
|
|
169
165
|
const StyledEditableContainer = /*#__PURE__*/styled(Grid).withConfig({
|
|
170
|
-
componentId: "sc-38sgfo-
|
|
171
|
-
})(["width:100%;height:100%;align-items:center;& ", "{display:", ";}&:hover{", "{display:block;}}&:focus{", " ", "{display:block;}}outline:none;"], StyledPencilIcon,
|
|
166
|
+
componentId: "sc-38sgfo-15"
|
|
167
|
+
})(["width:100%;height:100%;align-items:center;& ", "{display:", ";}&:hover{", "{display:block;}}&:focus{", " ", "{display:block;}}outline:none;"], StyledPencilIcon, _ref7 => {
|
|
172
168
|
let {
|
|
173
169
|
shouldDisplayEditIcon
|
|
174
|
-
} =
|
|
170
|
+
} = _ref7;
|
|
175
171
|
return shouldDisplayEditIcon ? 'block' : 'none';
|
|
176
172
|
}, StyledPencilIcon, styledFocusCss, StyledPencilIcon); // ROW ************************************************************************/
|
|
177
173
|
|
|
178
174
|
const StyledFullsizeGrid = /*#__PURE__*/styled(Grid).withConfig({
|
|
179
|
-
componentId: "sc-38sgfo-
|
|
175
|
+
componentId: "sc-38sgfo-16"
|
|
180
176
|
})(["position:relative;z-index:", ";min-height:", ";height:", ";"], ZIndexDataTable.ROW, props => props.minHeight || '36px', props => props.height || 'auto');
|
|
181
177
|
const GroupHeaderContainer = /*#__PURE__*/styled(Grid).withConfig({
|
|
182
|
-
componentId: "sc-38sgfo-
|
|
183
|
-
})(["position:relative;background-color:", ";align-items:center;padding:0 ", ";border-top:1px solid ", ";grid-template-columns:min-content 1fr;"],
|
|
178
|
+
componentId: "sc-38sgfo-17"
|
|
179
|
+
})(["position:relative;background-color:", ";align-items:center;padding:0 ", ";border-top:1px solid ", ";grid-template-columns:min-content 1fr;"], _ref8 => {
|
|
184
180
|
let {
|
|
185
181
|
theme
|
|
186
|
-
} =
|
|
182
|
+
} = _ref8;
|
|
187
183
|
return theme.colors.brand[200];
|
|
188
|
-
}, props => props.padding,
|
|
184
|
+
}, props => props.padding, _ref9 => {
|
|
189
185
|
let {
|
|
190
186
|
theme
|
|
191
|
-
} =
|
|
187
|
+
} = _ref9;
|
|
192
188
|
return theme.colors.brand[300];
|
|
193
189
|
});
|
|
194
190
|
const GroupHeaderTitle = /*#__PURE__*/styled.span.withConfig({
|
|
195
|
-
componentId: "sc-38sgfo-
|
|
191
|
+
componentId: "sc-38sgfo-18"
|
|
196
192
|
})(["font-weight:", ";font-size:12px;color:", ";"], props => props.theme.fontWeights.semibold, props => props.theme.colors.neutral[700]);
|
|
197
193
|
const StyledCellContainer = /*#__PURE__*/styled(Grid).withConfig({
|
|
198
|
-
componentId: "sc-38sgfo-
|
|
194
|
+
componentId: "sc-38sgfo-19"
|
|
199
195
|
})(["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 === ColsLayoutStyle.Fixed ? sizeToCss(props.totalColumnsWidth) : '100%', props => props.isDragOverlay ? 'width: fit-content;' : '', props => getGridTemplateColumnsStyle({
|
|
200
196
|
cols: props.cols,
|
|
201
197
|
colsLayoutStyle: props.colLayoutStyle,
|
|
202
198
|
isExpandable: props.isExpandable
|
|
203
|
-
}),
|
|
199
|
+
}), _ref10 => {
|
|
204
200
|
let {
|
|
205
201
|
backgroundColor,
|
|
206
202
|
isDragging,
|
|
207
203
|
theme
|
|
208
|
-
} =
|
|
204
|
+
} = _ref10;
|
|
209
205
|
return isDragging ? theme.colors.neutral[100] : backgroundColor || 'white';
|
|
210
|
-
}, props => props.isDragOverlay ? '' : styledFocusCss(props),
|
|
206
|
+
}, props => props.isDragOverlay ? '' : styledFocusCss(props), _ref11 => {
|
|
211
207
|
let {
|
|
212
208
|
isDropIndicatorPositionInside,
|
|
213
209
|
theme
|
|
214
|
-
} =
|
|
210
|
+
} = _ref11;
|
|
215
211
|
if (!isDropIndicatorPositionInside) return '';
|
|
216
212
|
return styledFocusCss({
|
|
217
213
|
theme
|
|
218
214
|
});
|
|
219
|
-
},
|
|
215
|
+
}, _ref12 => {
|
|
220
216
|
let {
|
|
221
217
|
shouldDisplayHover,
|
|
222
|
-
theme
|
|
223
|
-
|
|
224
|
-
|
|
218
|
+
theme,
|
|
219
|
+
disabled
|
|
220
|
+
} = _ref12;
|
|
221
|
+
return shouldDisplayHover && !disabled ? `:hover {
|
|
225
222
|
background-color: ${theme.colors.brand[200]};
|
|
226
223
|
}` : '';
|
|
227
224
|
}, props => props.isDragOverlay ? 'rgba(0,0,0,0.5)' : 'transparent', props => props.isDragging ? 0.8 : 1, props => !props.selected ? '' : `
|
|
@@ -229,4 +226,4 @@ const StyledCellContainer = /*#__PURE__*/styled(Grid).withConfig({
|
|
|
229
226
|
border: 1px solid ${props.theme.colors.brand[500]};
|
|
230
227
|
`, props => props.disabled ? props.theme.colors.neutral['500'] : '#333333');
|
|
231
228
|
|
|
232
|
-
export { GroupHeaderContainer, GroupHeaderTitle, StyledActionCell, StyledCell, StyledCellContainer, StyledCellContent, StyledDataTableWrapper, StyledEditableContainer, StyledFocusWithin, StyledFullsizeGrid, StyledHeadTh, StyledHeadTr, StyledHeadWrapper, StyledHeaderRightIconsWrapper, StyledPencilIcon, StyledResizer, StyledTableContentWrapper, StyledTableWrapper, StyledVirtualListWrapper };
|
|
229
|
+
export { GroupHeaderContainer, GroupHeaderTitle, StyledActionCell, StyledCell, StyledCellContainer, StyledCellContent, StyledDataTableContentWrapper, StyledDataTableWrapper, StyledEditableContainer, StyledFocusWithin, StyledFullsizeGrid, StyledHeadTh, StyledHeadTr, StyledHeadWrapper, StyledHeaderRightIconsWrapper, StyledPencilIcon, StyledResizer, StyledTableContentWrapper, StyledTableWrapper, StyledVirtualListWrapper };
|