-
Notifications
You must be signed in to change notification settings - Fork 0
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: Convert DpTableHeader.vue to a template #205
Conversation
…sizableColumns component there was an error about e.getBoundingClientRect() this error exists because the dom structure of the component DpTableHeader changed so that there are not only HTML elements in tableHeader here needs to be a check if tableHeader.nodeName is 'TH'
…der_into_template
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.
First of all thanks for all the effort
/** | ||
* The convert of the component DpTableHeader.vue from a functional component to a template indicates, | ||
* that the DOM Element structure changed, so that the tableHeaders doesnt just contains HTML elements, | ||
* it contains other code parts which are not HTML elements. | ||
* So you get an error, that the method getBoundingClientRect is not a function, | ||
* because it needs the same dom structure as before and the belonging HTML elements. | ||
* So here needs to be a check if the tableHeader.nodeName is a 'th' element for this case. | ||
* A general check if the tableHeader.nodeName is an HTML element here is inconvenient, | ||
* so here its okay to do the check with directly with the 'th' element. | ||
*/ | ||
if(tableHeader.nodeName === "TH") { |
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.
Are You sure You have to check if its a TH? Isn't it enough to check if its a node?
if(tableHeader.nodeName)
?
And also its good to know where the bug came from right now, I think the depth of detail don't helps anyone in the feature. I suggest to shorten the comment.
And aside from that. Did You find out why There are none-TH elements in the Array?
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.
replacing node
instead of nodeName
didnt work. But it works with nodeTyoe
, so I changed the check this way. done 9c36b6e
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 reason why there are other elements are because of the v-if structure in the template. see comment in the code
@@ -0,0 +1,104 @@ | |||
<template> | |||
<th | |||
:class="`c-data-table__resizable ${isLast? 'u-pr-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.
:class="`c-data-table__resizable ${isLast? 'u-pr-0' : ''}`" | |
class="c-data-table__resizable" | |
:class="{ 'u-pr-0' : isLast }" |
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 4c37717
|
||
methods: { | ||
initResize (e, idx) { | ||
this.resize = document.querySelector(`th[data-col-idx='${idx}']`) |
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.
We can make this more vue-ish and use refs instead
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 4c37717
document.getElementsByTagName('body')[0].removeEventListener('mousemove', this.namedFunc) | ||
document.getElementsByTagName('body')[0].removeEventListener('mouseup', this.stopResize) | ||
document.getElementsByTagName('body')[0].classList.remove('resizing') |
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.
Nitpick to make it a bit shorter
document.getElementsByTagName('body')[0].removeEventListener('mousemove', this.namedFunc) | |
document.getElementsByTagName('body')[0].removeEventListener('mouseup', this.stopResize) | |
document.getElementsByTagName('body')[0].classList.remove('resizing') | |
document.querySelector('body').removeEventListener('mousemove', this.namedFunc) | |
document.querySelector('body').removeEventListener('mouseup', this.stopResize) | |
document.querySelector('body').classList.remove('resizing') |
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.
thanks. done 4c37717
v-if="isResizable" | ||
:is-last="headerFields.length === idx" | ||
:header-field="hf" | ||
:idx="idx"> |
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.
does v-text works here too?
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.
v-text doesnt work in combination with slots. thanks for the question to think about and to try it
{{ hf.label }} | ||
</template> | ||
</th> | ||
<th v-if="isTruncatable" |
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.
<th v-if="isTruncatable" | |
<th | |
v-if="isTruncatable" |
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 853e2c7
@click="listeners.toggleWrapAll()"> | ||
<dp-wrap-trigger :title="translations.headerExpandHint" /> | ||
</th> | ||
<th v-if="isExpandable" |
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.
<th v-if="isExpandable" | |
<th | |
v-if="isExpandable" |
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.
thanks. done 853e2c7
…re double ths inside the component and outside of the component
otherwise the slot doesnt know that it has a reference to the text
…der_into_template # Conflicts: # CHANGELOG.md
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.
lgtm (code review)
thanks for taking this on!
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.
just two noneblocking nitpicks
|
||
computed: { | ||
isResizableColumn () { | ||
return hasOwnProp(this.headerField, 'resizeable')? this.headerField.resizeable : true |
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.
return hasOwnProp(this.headerField, 'resizeable')? this.headerField.resizeable : true | |
return hasOwnProp(this.headerField, 'resizeable') ? this.headerField.resizeable : true |
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 7ea8c56
const newNextWidth = this.nextWidth - mouseMoved | ||
if (newWidth > 25 && newNextWidth > 25) { |
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.
const newNextWidth = this.nextWidth - mouseMoved | |
if (newWidth > 25 && newNextWidth > 25) { | |
const newNextWidth = this.nextWidth - mouseMoved | |
if (newWidth > 25 && newNextWidth > 25) { |
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 7ea8c56
add line break if new if condition add space before the question mark in ternary
…der_into_template
…der_into_template
Ticket:: https://yaits.demos-deutschland.de/T19784
Description:
DpTableHeader.vue
into a templateResizableColumns.js
to a vue file and templatee.getBoundingClientRect() is not a function
which is caused of the changes (see commit message and comment on code for the fix)