-
Notifications
You must be signed in to change notification settings - Fork 72
[terra-table] Adding subsections to sections #2112
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make sure we are on the same page I wanted to double-check that subsections are going to be supported on table only in not supported in Grids. If that's correct, that should be also mentioned in documentation. In case I am wrong and subsections are supported in grids, there should be grid examples and tests added.
@@ -0,0 +1,90 @@ | |||
// TODO: fix linter error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this TODO addressed, or is it out of scope of this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like it was from a previous PR but there doesn't seem to be any linter issues. Removed here: 86bd928
/** | ||
* An array of subsections objects to be rendered within the section. | ||
*/ | ||
subsections: PropTypes.arrayOf(subsectionShape), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A documentation update is needed per subsection property added to the section shape here:
terra-framework/packages/terra-framework-docs/src/terra-dev-site/doc/table/About.1.doc.mdx
Line 148 in cc25304
|Name|Type|Required|Default Value|Description| |
import PropTypes from 'prop-types'; | ||
import rowShape from './rowShape'; | ||
|
||
const sectionShape = PropTypes.shape({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A documentation page needs to be updated with section shape info similar to the way we have for section
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added here: 2395c42
}; | ||
|
||
return ( | ||
<Table |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add this example to user facing part of the documentation as well, so that users have access to the implementation code example.
I believe subsections are only for flowsheet datagrids (@mjpalazzo is that correct?). Consuming these changes in flowsheet will be done in a separate PR. |
That is correct. Flowsheet only |
There doesn't appear to be a new or updated example to show how to implement subsections. |
.orion-fusion-theme { | ||
--terra-table-subsection-font-size: 0.808571428571rem; | ||
--terra-table-subsection-font-weight: 700; | ||
--terra-table-subsection-font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't we be using the base font family? I wouldn't expect us to have to define this in our sass file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed here: 6ee7c59
padding-top: 0.3571428571rem; | ||
padding-bottom: 0.3571428571rem; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would expect the padding to be themeable as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added here: 29bba90
<h3 | ||
className={cx('subsection')} | ||
> | ||
<span | ||
className={cx('sticky')} | ||
> | ||
{text} | ||
</span> | ||
</h3> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we be using the SectionHeader Terra component here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe @BenBoersma tried that but terra section header doesn't have the subsection styling guidelines provided by UX.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disregard this, managed to override the styles of terra-section-header.
</h3> | ||
</th> | ||
</tr> | ||
</> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is the content for the subsection?
{!isCollapsed && subsection.rows.map((row, rowIndex) => ( | ||
<Row | ||
rowIndex={subsection.subSectionRowIndex + (rowIndex + 1)} | ||
key={row.id} | ||
height={rowHeight} | ||
id={row.id} | ||
sectionId={!isHidden ? id : undefined} | ||
tableId={tableId} | ||
cells={row.cells} | ||
ariaLabel={row.ariaLabel} | ||
rowSelectionMode={rowSelectionMode} | ||
displayedColumns={displayedColumns} | ||
rowHeaderIndex={rowHeaderIndex} | ||
onCellSelect={onCellSelect} | ||
isSelected={row.isSelected} | ||
isTableStriped={isTableStriped} | ||
rowMinimumHeight={rowMinimumHeight} | ||
firstRowId={firstRowId} | ||
lastRowId={lastRowId} | ||
/> | ||
))} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The SubSection component should be rendering its own rows.
@cm9361 This PR only adds subsection support for terra-table. Consuming that in flowsheet and adding documentation for consumers will be done in the next PR. |
@@ -387,6 +393,7 @@ function Cell(props) { | |||
const columnHeaderId = `${tableId}-${columnId}-headerCell`; | |||
const rowHeaderId = !isRowHeader && rowHeaderIndex !== -1 ? `${tableId}-rowheader-${rowId} ` : ''; | |||
const sectionHeaderId = sectionId ? `${tableId}-${sectionId} ` : ''; | |||
const subsectionHeaderId = subsectionId ? `${tableId}-${sectionId}-${subsectionId} ` : ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the section id in the id for the subsection?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added it so we'll know which section the subsection is associated with. Do we need that or is the section id redundant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess having the section helps to ensure uniqueness.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does not appear that the onCellSelect method has been updated to include the subsection id.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed here: a981a90
tableId, | ||
}; | ||
|
||
if (subsections) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if the section has its own rows as well as subsections? I don't believe that use case is covered in this design.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From my understanding, a section would have either rows or subsections but not both. If both are passed in, then the rows will be ignored and not rendered. Does that meet the requirements? cc @mjpalazzo .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is a link to a video that shows the full workflow:
https://oracle-my.sharepoint.com/:v:/r/personal/sriraksha_k_oracle_com/Documents/Orders%20for%20Signature%20Accessibility/Routing%20Section%20issue%20in%20OFS.mov?csf=1&web=1&e=pJAyt6&nav=eyJwbGF5YmFja09wdGlvbnMiOnt9LCJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbE1vZGUiOiJtaXMiLCJyZWZlcnJhbFZpZXciOiJwb3N0cm9sbC1jb3B5bGluayIsInJlZmVycmFsUGxheWJhY2tTZXNzaW9uSWQiOiI4MmMxMWE2ZC02YjQ3LTQ5MTgtOTRhZC1lNzViYWU5YzUxYTUifX0%3D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The subsections are used to show the routing of medication orders. There is typically a row under the subsection for each medication that qualifies for that route; e.g., electronic prescription, pharmacy call, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I meant if section level row and subsections are both simultaneously possible?
e.g.
- section header
- section row
- section row
- subsection
- subsection row
- subsection row 2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will have to reach out the Clinical product manager for that question.
text={subsection.text} | ||
isTitleSticky | ||
boundedWidth={boundingWidth} | ||
level={3} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like the value of 3 should be a constant so that we can give a meaningful name to the value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added constant in a018196
collapsed: isCollapsed, | ||
collapsible: isCollapsible, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Subsections are not collapsible. We should not need classes on the subsection. The subsection visibility should be covered by the parent section. We shouldn't even render subsections or their header rows if the section is collapsed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Subsections don't get rendered, as confirmed by this test. But I can remove these classes if they are redundant.
terra-framework/packages/terra-table/tests/wdio/table-spec.js
Lines 193 to 197 in 9270557
it('validates a table with with collapsed sections', () => { | |
browser.url('/raw/tests/cerner-terra-framework-docs/table/table-with-collapsible-sections-and-sub-sections'); | |
expect(browser.$('//*[@id="table-with-sub-sections"]/tbody[3]')).toHaveChildren(2); | |
Terra.validates.element('table-with-collasped-subsections', { selector: tableWithSubSectionsSelector }); | |
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed redundant css here: 0fc369b
> | ||
|
||
<SectionHeader | ||
className={cx('subsection')} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this class be something like subsection-header-row to match the section classes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This appends the subsection
class to the existing header-row
class, so it would be header-row subsection
, but I can rename it if it's preferred.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed it here: e94e26b
</th> | ||
</tr> | ||
</tbody> | ||
<tbody className={cx('subsection-rows', { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like this would be the subsection class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this is not needed, removed here: 0fc369b
Doesn't the isSection method in the DataGrid component need to be updated to account for the new subsections? If that is done, does that fix all your keyboard navigation issues? |
<tr | ||
aria-rowindex={subsection.subSectionRowIndex} | ||
className={cx('header-row', theme.className)} | ||
data-section-id={id} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be data-subsection-id or something similar? This would not technically be a section, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed here: d1c988e
|
@cm9361 I haven't been able to work on the DataGrid component yet. So far, I've mainly been focusing on adding support for subsections to the Table component for this Jira & PR. |
Summary
Adding subsections to sections which include a section header.What was changed:
Why it was changed:
Testing
This change was tested using:
Reviews
In addition to engineering reviews, this PR needs:
Additional Details
This PR resolves:
Partially resolves.
UXPLATFORM-10224
Thank you for contributing to Terra.
@cerner/terra