tabulator-tables
Advanced tools
Comparing version 5.6.0 to 5.6.1
{ | ||
"name": "tabulator", | ||
"main": "dist/js/tabulator.js", | ||
"version": "5.6.0", | ||
"version": "5.6.1", | ||
"description": "Interactive table generation JavaScript library", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
{ | ||
"name": "tabulator-tables", | ||
"version": "5.6.0", | ||
"version": "5.6.1", | ||
"description": "Interactive table generation JavaScript library", | ||
@@ -5,0 +5,0 @@ "style": "dist/css/tabulator.css", |
@@ -260,2 +260,6 @@ import CoreFeature from '../CoreFeature.js'; | ||
titleElement.addEventListener("mousedown", (e) => { | ||
e.stopPropagation(); | ||
}); | ||
titleElement.addEventListener("change", () => { | ||
@@ -262,0 +266,0 @@ def.title = titleElement.value; |
@@ -1112,9 +1112,7 @@ import CoreFeature from './CoreFeature.js'; | ||
redraw (force){ | ||
const resized = this.adjustTableSize(); | ||
this.adjustTableSize(); | ||
this.table.tableWidth = this.table.element.clientWidth; | ||
if(!force){ | ||
if(resized) { | ||
this.reRenderInPosition(); | ||
} | ||
if(!force){ | ||
this.reRenderInPosition(); | ||
this.scrollHorizontal(this.scrollLeft); | ||
@@ -1121,0 +1119,0 @@ }else{ |
@@ -833,3 +833,3 @@ 'use strict'; | ||
this.rowManager.initializeRenderer(); | ||
this.rowManager.redraw(); | ||
this.rowManager.redraw(true); | ||
} | ||
@@ -836,0 +836,0 @@ |
@@ -40,3 +40,3 @@ //input element | ||
cellValue = newDatetime.toFormat("yyyy-MM-dd") + "T" + newDatetime.toFormat("hh:mm"); | ||
cellValue = newDatetime.toFormat("yyyy-MM-dd") + "T" + newDatetime.toFormat("HH:mm"); | ||
}else{ | ||
@@ -43,0 +43,0 @@ console.error("Editor Error - 'date' editor 'format' param is dependant on luxon.js"); |
@@ -40,3 +40,3 @@ //input element | ||
cellValue = newDatetime.toFormat("hh:mm"); | ||
cellValue = newDatetime.toFormat("HH:mm"); | ||
@@ -47,2 +47,4 @@ }else{ | ||
} | ||
console.log("val", cellValue); | ||
@@ -49,0 +51,0 @@ input.value = cellValue; |
@@ -599,4 +599,5 @@ import Module from '../../core/Module.js'; | ||
element = cell.getElement(), | ||
editFinished = false, | ||
cellEditor, component, params; | ||
//prevent editing if another cell is refusing to leave focus (eg. validation fail) | ||
@@ -613,9 +614,11 @@ | ||
function success(value){ | ||
if(self.currentCell === cell){ | ||
if(self.currentCell === cell && !editFinished){ | ||
var valid = self.chain("edit-success", [cell, value], true, true); | ||
if(valid === true || self.table.options.validationMode === "highlight"){ | ||
editFinished = true; | ||
self.clearEditor(); | ||
if(!cell.modules.edit){ | ||
@@ -632,8 +635,13 @@ cell.modules.edit = {}; | ||
cell.setValue(value, true); | ||
return valid === true; | ||
}else{ | ||
editFinished = true; | ||
self.invalidEdit = true; | ||
self.focusCellNoEvent(cell, true); | ||
rendered(); | ||
setTimeout(() => { | ||
editFinished = false; | ||
}, 10); | ||
return false; | ||
@@ -648,3 +656,5 @@ } | ||
function cancel(){ | ||
if(self.currentCell === cell){ | ||
// editFinished = true; | ||
if(self.currentCell === cell && !editFinished){ | ||
self.cancelEdit(); | ||
@@ -651,0 +661,0 @@ }else{ |
@@ -37,2 +37,3 @@ import Module from '../../core/Module.js'; | ||
this.subscribe("column-show", this.reinitializeColumns.bind(this)); | ||
this.subscribe("columns-loaded", this.reinitializeColumns.bind(this)); | ||
@@ -39,0 +40,0 @@ this.subscribe("table-redraw", this.layout.bind(this)); |
@@ -25,2 +25,9 @@ import CoreFeature from '../../core/CoreFeature.js'; | ||
this.end = {row:0, col:0}; | ||
if(this.rangeManager.rowHeader){ | ||
this.left = 1; | ||
this.right = 1; | ||
this.start.col = 1; | ||
this.end.col = 1; | ||
} | ||
@@ -85,10 +92,10 @@ this.initElement(); | ||
if(this.rangeManager.columnSelection){ | ||
this.setStart(0, element.getPosition() - 2); | ||
this.setStart(0, element.getPosition() - 1); | ||
} | ||
}else{ | ||
row = element.row.position - 1; | ||
col = element.column.getPosition() - 2; | ||
col = element.column.getPosition() - 1; | ||
if (element.column === this.rangeManager.rowHeader) { | ||
this.setStart(row, 0); | ||
this.setStart(row, 1); | ||
} else { | ||
@@ -107,5 +114,5 @@ this.setStart(row, col); | ||
if (this.rangeManager.selecting === "column") { | ||
this.setEnd(rowsCount - 1, element.getPosition() - 2); | ||
this.setEnd(rowsCount - 1, element.getPosition() - 1); | ||
} else if (this.rangeManager.selecting === "cell") { | ||
this.setEnd(0, element.getPosition() - 2); | ||
this.setEnd(0, element.getPosition() - 1); | ||
} | ||
@@ -115,7 +122,7 @@ } | ||
row = element.row.position - 1; | ||
col = element.column.getPosition() - 2; | ||
col = element.column.getPosition() - 1; | ||
isRowHeader = element.column === this.rangeManager.rowHeader; | ||
if (this.rangeManager.selecting === "row") { | ||
this.setEnd(row, this._getTableColumns().length - 2); | ||
this.setEnd(row, this._getTableColumns().length - 1); | ||
} else if (this.rangeManager.selecting !== "row" && isRowHeader) { | ||
@@ -202,7 +209,7 @@ this.setEnd(row, 0); | ||
atTopLeft(cell) { | ||
return cell.row.position - 1 === this.top && cell.column.getPosition() - 2 === this.left; | ||
return cell.row.position - 1 === this.top && cell.column.getPosition() - 1 === this.left; | ||
} | ||
atBottomRight(cell) { | ||
return cell.row.position - 1 === this.bottom && cell.column.getPosition() - 2 === this.right; | ||
return cell.row.position - 1 === this.bottom && cell.column.getPosition() - 1 === this.right; | ||
} | ||
@@ -219,3 +226,3 @@ | ||
occupiesColumn(col) { | ||
return this.left <= col.getPosition() - 2 && col.getPosition() - 2 <= this.right; | ||
return this.left <= col.getPosition() - 1 && col.getPosition() - 1 <= this.right; | ||
} | ||
@@ -289,3 +296,3 @@ | ||
getColumns() { | ||
return this._getTableColumns().slice(this.left + 1, this.right + 2); | ||
return this._getTableColumns().slice(this.left, this.right + 1); | ||
} | ||
@@ -292,0 +299,0 @@ |
@@ -126,3 +126,3 @@ import Module from "../../core/Module.js"; | ||
if(this.columnSelection && column.definition.headerSort && this.options("headerSortClickElement") !== "icon"){ | ||
console.warn("Using column headerSort with selectableRangeColumns option may result in unpredictable behavior"); | ||
console.warn("Using column headerSort with selectableRangeColumns option may result in unpredictable behavior. Consider using headerSortClickElement: 'icon'."); | ||
} | ||
@@ -426,3 +426,3 @@ | ||
case "right": | ||
nextCol = Math.min(nextCol + 1, this.getTableColumns().length - 2); | ||
nextCol = Math.min(nextCol + 1, this.getTableColumns().length - 1); | ||
break; | ||
@@ -521,9 +521,10 @@ case "up": | ||
cells = row.cells.filter((cell) => cell.column.visible), | ||
isStartingCellEmpty = !cells[colPos + 1].getValue(), | ||
isStartingCellEmpty = !cells[colPos].getValue(), | ||
isLeftOfStartingCellEmpty = cells[colPos] ? !cells[colPos].getValue() : false, | ||
jumpCol = colPos, | ||
nextCell = this.findJumpCell(cells.slice(0, colPos), true, isStartingCellEmpty, isLeftOfStartingCellEmpty); | ||
targetCells = this.rowHeader ? cells.slice(1, colPos) : cells.slice(0, colPos), | ||
nextCell = this.findJumpCell(targetCells, true, isStartingCellEmpty, isLeftOfStartingCellEmpty); | ||
if(nextCell){ | ||
jumpCol = nextCell.column.getPosition() - 2; | ||
jumpCol = nextCell.column.getPosition() - 1; | ||
} | ||
@@ -537,9 +538,9 @@ | ||
cells = row.cells.filter((cell) => cell.column.visible), | ||
isStartingCellEmpty = !cells[colPos + 1].getValue(), | ||
isRightOfStartingCellEmpty = cells[colPos + 2] ? !cells[colPos + 2].getValue() : false, | ||
isStartingCellEmpty = !cells[colPos].getValue(), | ||
isRightOfStartingCellEmpty = cells[colPos + 1] ? !cells[colPos + 1].getValue() : false, | ||
jumpCol = colPos, | ||
nextCell = this.findJumpCell(cells.slice(colPos + 2, cells.length), false, isStartingCellEmpty, isRightOfStartingCellEmpty); | ||
nextCell = this.findJumpCell(cells.slice(colPos + 1, cells.length), false, isStartingCellEmpty, isRightOfStartingCellEmpty); | ||
if(nextCell){ | ||
jumpCol = nextCell.column.getPosition() - 2; | ||
jumpCol = nextCell.column.getPosition() - 1; | ||
} | ||
@@ -595,4 +596,9 @@ | ||
const topLeftCell = this.getCell(0, 0); | ||
const bottomRightCell = this.getCell(-1, -1); | ||
var topLeftCell, bottomRightCell = this.getCell(-1, -1); | ||
if(this.rowHeader){ | ||
topLeftCell = this.getCell(0, 1); | ||
}else{ | ||
topLeftCell = this.getCell(0, 0); | ||
} | ||
@@ -621,5 +627,4 @@ range.setBounds(topLeftCell, bottomRightCell); | ||
var tableHolder = this.table.rowManager.element, | ||
rowHeader = this.rowHeader.getElement(), | ||
rect, view, withinHorizontalView, withinVerticalView; | ||
rowHeader, rect, view, withinHorizontalView, withinVerticalView; | ||
if (typeof row === 'undefined') { | ||
@@ -632,2 +637,6 @@ row = this.getRowByRangePos(range.end.row).getElement(); | ||
} | ||
if (this.rowHeader) { | ||
rowHeader = this.rowHeader.getElement(); | ||
} | ||
@@ -642,3 +651,3 @@ rect = { | ||
view = { | ||
left: tableHolder.scrollLeft + rowHeader.offsetWidth, | ||
left: tableHolder.scrollLeft, | ||
right: Math.ceil(tableHolder.scrollLeft + tableHolder.clientWidth), | ||
@@ -648,2 +657,6 @@ top: tableHolder.scrollTop, | ||
}; | ||
if (rowHeader) { | ||
view.left += rowHeader.offsetWidth; | ||
} | ||
@@ -656,3 +669,6 @@ withinHorizontalView = view.left < rect.left && rect.left < view.right && view.left < rect.right && rect.right < view.right; | ||
if (rect.left < view.left) { | ||
tableHolder.scrollLeft = rect.left - rowHeader.offsetWidth; | ||
tableHolder.scrollLeft = rect.left; | ||
if (rowHeader) { | ||
tableHolder.scrollLeft -= rowHeader.offsetWidth; | ||
} | ||
} else if (rect.right > view.right) { | ||
@@ -776,4 +792,3 @@ tableHolder.scrollLeft = rect.right - tableHolder.clientWidth; | ||
if (colIdx < 0) { | ||
colIdx = this.getTableColumns().length + colIdx - 1; | ||
colIdx = this.getTableColumns().length + colIdx; | ||
if (colIdx < 0) { | ||
@@ -790,3 +805,3 @@ return null; | ||
return row ? row.getCells(false, true).filter((cell) => cell.column.visible)[colIdx + 1] : null; | ||
return row ? row.getCells(false, true).filter((cell) => cell.column.visible)[colIdx] : null; | ||
} | ||
@@ -804,3 +819,3 @@ | ||
getColumnByRangePos(pos) { | ||
return this.getTableColumns()[pos + 1]; | ||
return this.getTableColumns()[pos]; | ||
} | ||
@@ -807,0 +822,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
11123243
84611