feat(checkrange): added tooltip

This commit is contained in:
Johannes Eder 2021-09-28 16:47:03 +02:00
parent 337bf73067
commit ce6f09dd85

View File

@ -38,6 +38,7 @@ export class CheckRange {
_setUpShiftClickOnColumn(columnId) {
let column = this._columns[columnId];
this._addToolTip(column[0]);
column.forEach(el => el.addEventListener('click', (ev) => {
if(ev.shiftKey && this.lastCheckedCell !== null) {
@ -53,6 +54,24 @@ export class CheckRange {
}));
}
_addToolTip(cell){
console.log('adding Tooltip');
let tooltipWrap = document.createElement('span');
tooltipWrap.className = 'tooltip';
let tooltipContent = document.createElement('span');
tooltipContent.className = 'tooltip__content';
tooltipContent.appendChild(document.createTextNode('Shift Click to mark multiple cells.'));
tooltipWrap.append(tooltipContent);
let tooltipHandle = document.createElement('span');
tooltipHandle.className = 'tooltip__handle';
tooltipWrap.append(tooltipHandle);
let firstChild = cell.firstChild;
firstChild.parentNode.insertBefore(tooltipWrap, firstChild);
}
_checkMultipleCells(firstRowIndex, lastRowIndex, columnId) {
for(let i=firstRowIndex; i<=lastRowIndex; i++) {
let cell = this._columns[columnId][i];