-
Notifications
You must be signed in to change notification settings - Fork 86
feat: add root heading level support to dashboard layout #9249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: add root heading level support to dashboard layout #9249
Conversation
this.__removeHeadingLevelObserver(); | ||
const parentLayout = getParentLayout(this); | ||
if (parentLayout) { | ||
this.__headingLevelObserver = new MutationObserver(() => this.__updateRootHeadingLevel()); |
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 we just fire an event when the heading level changes? MIght be a bit more light-weight than creating a mutation observer per item instance.
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.
@ugur-vaadin Did you plan to address this?
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.
Updated the PR to use an event instead of a MutationObserver
.
*/ | ||
export function getParentLayout(node) { | ||
return __findFilteredAncestorInstance(node, (el) => { | ||
return el.constructor && el.constructor.toString().includes('DashboardLayoutMixin'); |
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 probably won't work in production where function and class names get minified. Did a quick test in a Flow project and "DashboardLayoutMixin" does not show up in any generated chunks. Since there are only two types of elements to test for, we could use the is
getter to check for the tag name:
web-components/packages/dashboard/src/vaadin-dashboard.js
Lines 110 to 112 in 8ecd313
static get is() { | |
return 'vaadin-dashboard'; | |
} |
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.
Updated the helper to use is
.
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.
@web-padawan Since you noted this in the other PR, should we prefer localName
over is
?
a0088af
to
e9590b4
Compare
Co-authored-by: Serhii Kulykov <iamkulykov@gmail.com>
Co-authored-by: Serhii Kulykov <iamkulykov@gmail.com>
|
Description
This PR adds root heading level support to
DashboardLayout
. It was previously added for Dashboard. This PR also refactors the heading level logic inDashboard
,DashboardWidget
, andDashboardSection
; centralizing them inDashboardLayoutMixin
andDashboardItemMixin
.Fixes #8924
Type of change
Checklist