-
Notifications
You must be signed in to change notification settings - Fork 62
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
feat(data-table): Add resizing feature for columns #785
base: next
Are you sure you want to change the base?
Conversation
} | ||
|
||
resizeCol(e) { | ||
const targetCol = e.path[0]; |
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.
replace it with composedPath. or do a check to see if e.path exists if not use composedPath
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
@@ -1158,10 +1205,19 @@ export class DataTable { | |||
} | |||
></fw-checkbox> | |||
)} | |||
{this.colResize && ( |
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.
can you move this to a function/variable which return this JSX element and use it in other places. I see some repetition of this code.
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
@Watch('colResize') | ||
handleColResize() { | ||
setTimeout(() => { | ||
this.colResize && this.setResizerHeight(); |
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.
can we rename it to setColResizerHeight to make it more descriptive?
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.
Done
const targetCol = e.path[0]; | ||
targetCol.classList.add('resizer-border'); | ||
const currentMousePos = e.clientX; | ||
const parent = e.path[0].parentElement; |
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.
replace it with composedPath. or do a check to see if e.path exists if not use composedPath
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.
if (resizers.length > 0) { | ||
resizers.forEach((item: HTMLElement) => { | ||
item.style.height = | ||
this.el.shadowRoot.querySelector('table').offsetHeight + 'px'; |
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.
can u move this line above the forEach statement. This is create reflow for every iteration since we are reading offsetHeight on each iteration. This value will remain constant.
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.
ba01b15
to
7c7da5e
Compare
Checklist:
How Has This Been Tested?