Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

Data grid add column actions #2024

Merged
merged 98 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
c020870
column-actions-poc
adoroshk Feb 7, 2024
c892c62
Merge branch 'main' of https://github.com/cerner/terra-framework into…
adoroshk Feb 7, 2024
d8ffac9
one resize handle for both headers rows
adoroshk Feb 10, 2024
b47027d
added actions example
adoroshk Feb 11, 2024
8be188f
lint fixes
adoroshk Feb 11, 2024
a9e3dc8
Merge branch 'main' of https://github.com/cerner/terra-framework into…
adoroshk Feb 11, 2024
f2654eb
changelogs updated
adoroshk Feb 11, 2024
a974186
snapshots updated
adoroshk Feb 11, 2024
10028af
column actions example fix
adoroshk Feb 11, 2024
3175eeb
Merge branch 'main' of https://github.com/cerner/terra-framework into…
adoroshk Feb 12, 2024
0435bea
tests updated to accomodate new functionality
adoroshk Feb 12, 2024
7539a62
hasColumnHeader moved to table component
adoroshk Feb 12, 2024
573ecc1
removed extra line
adoroshk Feb 12, 2024
9723b5c
FlowSheet actions example added
adoroshk Feb 12, 2024
78a1393
actions validation added
adoroshk Feb 13, 2024
d6f96c1
Merge branch 'main' of https://github.com/cerner/terra-framework into…
adoroshk Feb 13, 2024
ab44904
snapshots updated
adoroshk Feb 13, 2024
2eb2dad
added comments
adoroshk Feb 13, 2024
2badaf4
padding for action cell updated
adoroshk Feb 13, 2024
b9d85d5
action cell buttom padding adjusted
adoroshk Feb 13, 2024
453cb09
action button padding adjusted
adoroshk Feb 13, 2024
4fcf085
action buttor border inset
adoroshk Feb 13, 2024
bc8b9a4
aria-rowindex order accomodated for double headers
adoroshk Feb 14, 2024
6ba44dd
aria-rowcount and aria-rowindex updated to accomodate both - actions …
adoroshk Feb 14, 2024
91d9d1e
empty action cell text added
adoroshk Feb 14, 2024
7833bb9
role and scope of Column header cell updated
adoroshk Feb 14, 2024
0e92550
no action cell text fixed
adoroshk Feb 14, 2024
31481ea
actions moved out of <head> tag
adoroshk Feb 14, 2024
13d8c7c
removed role for experiments with JAWS
adoroshk Feb 15, 2024
be4bdc5
revert action cell to be <th> for testing with JAWS
adoroshk Feb 15, 2024
ee88cac
Merge branch 'main' into data-grid-add-column-action
adoroshk Feb 15, 2024
5abafd1
action cell reverted to be td, testing rowspan
adoroshk Feb 15, 2024
eb2a98d
rowspan reverted
adoroshk Feb 15, 2024
b7faa00
testing aria-owns
adoroshk Feb 15, 2024
0d61fc1
testing hiding button from JAWS with aria-hidden
adoroshk Feb 15, 2024
863e873
aria-hidden fix
adoroshk Feb 15, 2024
54146a6
aria-owns experiment
adoroshk Feb 15, 2024
a9b4160
aria-owns id fixed
adoroshk Feb 15, 2024
1524de6
adde aria-hidden to action td
adoroshk Feb 15, 2024
079d1fc
moved aria-hidden to button to test with JAWS
adoroshk Feb 15, 2024
81519f2
try if action owns resize handle helps
adoroshk Feb 15, 2024
2ae6a5c
resize handle id description added
adoroshk Feb 16, 2024
2c0738a
typos fixes and snapshot updates
adoroshk Feb 16, 2024
b279179
Column header cell jest tests added
adoroshk Feb 16, 2024
ddb7ed4
Column header jest tests added
adoroshk Feb 16, 2024
2743ad9
console.log removed from tests
adoroshk Feb 16, 2024
6653d5f
worklist data grid header keyboard navigation
adoroshk Feb 16, 2024
98e796e
Merge branch 'main' of https://github.com/cerner/terra-framework into…
adoroshk Feb 20, 2024
e56c6d6
docs updated
adoroshk Feb 20, 2024
51dc715
removed rowHeaders
adoroshk Feb 20, 2024
4b9ea74
reverting headers
adoroshk Feb 20, 2024
c275fe0
cell headers fix
adoroshk Feb 20, 2024
0842500
updare wdg wdio snapshots per shaddow in pinned column
adoroshk Feb 20, 2024
1715008
column action WDG wdio tests added
adoroshk Feb 20, 2024
798d5ef
wdio snapshots for fusion and lowlight themes added
adoroshk Feb 21, 2024
9098f6d
wdio tests for data grid fixed, screenshots updated
adoroshk Feb 21, 2024
09aa9ae
aria-owns condition changed to isResizeHandleActive
adoroshk Feb 21, 2024
3eb848b
flowsheet wdio screenshots updated per shadow in pinned columns
adoroshk Feb 21, 2024
79402c7
table wdio screenshots updated per pinned columns shaddow update
adoroshk Feb 21, 2024
3faf2a7
test if owning resize handle only for actions row works with JAWS
adoroshk Feb 21, 2024
9f5f2c7
passed active row index
adoroshk Feb 21, 2024
f0a2ea9
first row index fixed for data grid with hidden headers
adoroshk Feb 21, 2024
fe8ff94
jest tests updated
adoroshk Feb 21, 2024
571eb93
wdio snapshots reverted
adoroshk Feb 21, 2024
eaca6e9
changed action button focuing to be consistent with header button
adoroshk Feb 21, 2024
d10c706
Left arrow on action button consistent with header button
adoroshk Feb 21, 2024
8f97e91
removed unused prop, jupdated snapshots
adoroshk Feb 21, 2024
347e44b
ownsResizeHandle prop added
adoroshk Feb 22, 2024
3da2868
button setCallback fix, jest snapsots updated per new prop
adoroshk Feb 22, 2024
c6a5441
snapshots updated
adoroshk Feb 22, 2024
0ef5e05
ownsResizeHandle prop removed from header row cell as it doesn't help…
adoroshk Feb 22, 2024
caa14ad
snapshots updated
adoroshk Feb 22, 2024
ef6dc99
fixes col index shift in row selection
adoroshk Feb 22, 2024
2c3edc5
activeColumnIndex prop reverted, focusedColIndex removed
adoroshk Feb 22, 2024
9f7cbbc
Merge branch 'main' of https://github.com/cerner/terra-framework into…
adoroshk Feb 22, 2024
e6b094a
reverted fix for col index shift
adoroshk Feb 22, 2024
f27b915
regenerated wdio resize handle screenshots to see if it helps with fa…
adoroshk Feb 23, 2024
d5a3dde
Merge branch 'main' into data-grid-add-column-action
sdadn Feb 26, 2024
c51e7e2
updated snapshots
sdadn Feb 26, 2024
8184555
worklist data grid wdio snapshots updated test
adoroshk Feb 26, 2024
5b6c20d
fix resize handle init height
adoroshk Feb 26, 2024
b23678f
data-grid snapshots updated
adoroshk Feb 26, 2024
e08e64c
Merge branch 'main' into data-grid-add-column-action
adoroshk Feb 26, 2024
07b3fa1
jest snapshots updated
adoroshk Feb 26, 2024
77f5bcd
Update CHANGELOG.md
sdadn Feb 26, 2024
07ab860
Update CHANGELOG.md
sdadn Feb 26, 2024
ec72582
Update CHANGELOG.md
sdadn Feb 26, 2024
14cfc7a
Update packages/terra-data-grid/src/DataGrid.jsx
adoroshk Feb 26, 2024
95bd160
Update packages/terra-table/src/subcomponents/ColumnHeader.jsx
adoroshk Feb 26, 2024
cd59483
Update packages/terra-framework-docs/src/terra-dev-site/doc/table/Exa…
adoroshk Feb 26, 2024
bb935f5
Update packages/terra-framework-docs/src/terra-dev-site/doc/data-grid…
adoroshk Feb 26, 2024
e9bb251
Update packages/terra-framework-docs/src/terra-dev-site/doc/data-grid…
adoroshk Feb 26, 2024
7dec538
changelog fix
adoroshk Feb 27, 2024
d050bcd
checkForColumnActions renamed to hasColumnActions
adoroshk Feb 27, 2024
111b1e8
resizeHandlerInitHeight renamed to initialHeight
adoroshk Feb 27, 2024
0e2ca28
Merge branch 'main' of https://github.com/cerner/terra-framework into…
adoroshk Feb 27, 2024
bf7ea04
snapshot updated
adoroshk Feb 27, 2024
c6f182c
Merge branch 'main' into data-grid-add-column-action
adoroshk Feb 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@
"stylelint": "^15.0.0",
"terra-aggregate-translations": "^1.0.0",
"terra-application": "^1.57.0",
"terra-button": "^3.73.0",
"terra-disclosure-manager": "^4.9.0",
"terra-enzyme-intl": "^3.4.0",
"terra-icon": "^3.58.0",
Expand Down
5 changes: 4 additions & 1 deletion packages/terra-data-grid/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
## Unreleased

* Changed
* Removed the default rowMinimumHeight from FlowsheetDataGrid so that the `terra-table` default value is used.
* Removed the default rowMinimumHeight from FlowsheetDataGrid so that the `terra-table` default value is used.

* Added
* Column actions support added.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit (for consistency):

Suggested change
* Column actions support added.
* Added support for column actions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in 7dec538


## 1.12.0 - (February 1, 2024)

Expand Down
20 changes: 14 additions & 6 deletions packages/terra-data-grid/src/DataGrid.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import PropTypes from 'prop-types';
import classNames from 'classnames/bind';
import * as KeyCode from 'keycode-js';
import Table, {
GridConstants, GridContext, sectionShape, rowShape, columnShape, validateRowHeaderIndex,
GridConstants, GridContext, sectionShape, rowShape, columnShape, validateRowHeaderIndex, checkForColumnActions,
} from 'terra-table';
import VisuallyHiddenText from 'terra-visually-hidden-text';
import WorklistDataGridUtils from './utils/WorklistDataGridUtils';
Expand Down Expand Up @@ -205,8 +205,15 @@ const DataGrid = forwardRef((props, ref) => {

const [checkResizable, setCheckResizable] = useState(false);

// if columns are not visible then set the first selectable row index to 1
const [focusedRow, setFocusedRow] = useState(hasVisibleColumnHeaders ? 0 : 1);
// check if at least one column has a valid action
// same check is done in Table, but as Table can be a stand-alone component, it can't relay on a passed prop.
adoroshk marked this conversation as resolved.
Show resolved Hide resolved
const hasColumnHeaderActions = checkForColumnActions(pinnedColumns) || checkForColumnActions(overflowColumns);

// eslint-disable-next-line no-nested-ternary
const firstRowIndex = hasVisibleColumnHeaders ? 0 : (hasColumnHeaderActions ? 2 : 1);

// if columns are not visible then set the first selectable row index to 1 or 2
const [focusedRow, setFocusedRow] = useState(firstRowIndex);
const [focusedCol, setFocusedCol] = useState(0);

// Aria live region message management
Expand Down Expand Up @@ -426,7 +433,7 @@ const DataGrid = forwardRef((props, ref) => {
} else {
// Left key
nextCol -= 1;
setCheckResizable(cellCoordinates.row === 0);
setCheckResizable(cellCoordinates.row === 0 || (hasColumnHeaderActions && cellCoordinates.row === 1));
}
break;
case KeyCode.KEY_RIGHT:
Expand Down Expand Up @@ -486,7 +493,7 @@ const DataGrid = forwardRef((props, ref) => {
event.preventDefault(); // prevent the page from moving with the arrow keys.
return;
}
if (nextCol < 0 || nextRow < (hasVisibleColumnHeaders ? 0 : 1)) {
if (nextCol < 0 || nextRow < (firstRowIndex)) {
event.preventDefault(); // prevent the page from moving with the arrow keys.
return;
}
Expand Down Expand Up @@ -548,6 +555,7 @@ const DataGrid = forwardRef((props, ref) => {
// -------------------------------------

const isGridActive = grid.current?.contains(document.activeElement);
const isOneOfHeaderRows = focusedRow === 0 || (hasColumnHeaderActions && focusedRow === 1);

return (
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
Expand All @@ -569,7 +577,7 @@ const DataGrid = forwardRef((props, ref) => {
ariaLabelledBy={ariaLabelledBy}
ariaLabel={ariaLabel}
activeColumnIndex={(isGridActive && focusedRow === 0) ? focusedCol : undefined}
isActiveColumnResizing={focusedRow === 0 && checkResizable}
isActiveColumnResizing={isOneOfHeaderRows && checkResizable}
columnResizeIncrement={columnResizeIncrement}
pinnedColumns={pinnedColumns}
overflowColumns={overflowColumns}
Expand Down
Loading
Loading