tabulator-tables 5.6.0 → 5.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/bower.json +1 -1
  2. package/dist/css/tabulator.css +5 -5
  3. package/dist/css/tabulator.css.map +1 -1
  4. package/dist/css/tabulator.min.css +1 -1
  5. package/dist/css/tabulator.min.css.map +1 -1
  6. package/dist/css/tabulator_bootstrap3.css +5 -5
  7. package/dist/css/tabulator_bootstrap3.css.map +1 -1
  8. package/dist/css/tabulator_bootstrap3.min.css +1 -1
  9. package/dist/css/tabulator_bootstrap3.min.css.map +1 -1
  10. package/dist/css/tabulator_bootstrap4.css +5 -5
  11. package/dist/css/tabulator_bootstrap4.css.map +1 -1
  12. package/dist/css/tabulator_bootstrap4.min.css +1 -1
  13. package/dist/css/tabulator_bootstrap4.min.css.map +1 -1
  14. package/dist/css/tabulator_bootstrap5.css +5 -5
  15. package/dist/css/tabulator_bootstrap5.css.map +1 -1
  16. package/dist/css/tabulator_bootstrap5.min.css +1 -1
  17. package/dist/css/tabulator_bootstrap5.min.css.map +1 -1
  18. package/dist/css/tabulator_bulma.css +5 -5
  19. package/dist/css/tabulator_bulma.css.map +1 -1
  20. package/dist/css/tabulator_bulma.min.css +1 -1
  21. package/dist/css/tabulator_bulma.min.css.map +1 -1
  22. package/dist/css/tabulator_materialize.css +5 -5
  23. package/dist/css/tabulator_materialize.css.map +1 -1
  24. package/dist/css/tabulator_materialize.min.css +1 -1
  25. package/dist/css/tabulator_materialize.min.css.map +1 -1
  26. package/dist/css/tabulator_midnight.css +5 -5
  27. package/dist/css/tabulator_midnight.css.map +1 -1
  28. package/dist/css/tabulator_midnight.min.css +1 -1
  29. package/dist/css/tabulator_midnight.min.css.map +1 -1
  30. package/dist/css/tabulator_modern.css +5 -5
  31. package/dist/css/tabulator_modern.css.map +1 -1
  32. package/dist/css/tabulator_modern.min.css +1 -1
  33. package/dist/css/tabulator_modern.min.css.map +1 -1
  34. package/dist/css/tabulator_semanticui.css +5 -5
  35. package/dist/css/tabulator_semanticui.css.map +1 -1
  36. package/dist/css/tabulator_semanticui.min.css +1 -1
  37. package/dist/css/tabulator_semanticui.min.css.map +1 -1
  38. package/dist/css/tabulator_simple.css +5 -5
  39. package/dist/css/tabulator_simple.css.map +1 -1
  40. package/dist/css/tabulator_simple.min.css +1 -1
  41. package/dist/css/tabulator_simple.min.css.map +1 -1
  42. package/dist/css/tabulator_site.css +5 -5
  43. package/dist/css/tabulator_site.css.map +1 -1
  44. package/dist/css/tabulator_site.min.css +1 -1
  45. package/dist/css/tabulator_site.min.css.map +1 -1
  46. package/dist/js/tabulator.js +83 -46
  47. package/dist/js/tabulator.js.map +1 -1
  48. package/dist/js/tabulator.min.js +2 -2
  49. package/dist/js/tabulator.min.js.map +1 -1
  50. package/dist/js/tabulator_esm.js +83 -46
  51. package/dist/js/tabulator_esm.js.map +1 -1
  52. package/dist/js/tabulator_esm.min.js +2 -2
  53. package/dist/js/tabulator_esm.min.js.map +1 -1
  54. package/package.json +1 -1
  55. package/src/js/core/RowManager.js +3 -5
  56. package/src/js/core/Tabulator.js +1 -1
  57. package/src/js/core/column/Column.js +4 -0
  58. package/src/js/modules/Edit/Edit.js +16 -6
  59. package/src/js/modules/Edit/defaults/editors/datetime.js +1 -1
  60. package/src/js/modules/Edit/defaults/editors/time.js +3 -1
  61. package/src/js/modules/FrozenColumns/FrozenColumns.js +1 -0
  62. package/src/js/modules/SelectRange/Range.js +18 -11
  63. package/src/js/modules/SelectRange/SelectRange.js +35 -20
  64. package/src/scss/tabulator.scss +7 -7
@@ -1,4 +1,4 @@
1
- /* Tabulator v5.6.0 (c) Oliver Folkerd 2024 */
1
+ /* Tabulator v5.6.1 (c) Oliver Folkerd 2024 */
2
2
  class CoreFeature{
3
3
 
4
4
  constructor(table){
@@ -2384,6 +2384,10 @@ class Column extends CoreFeature{
2384
2384
  titleElement.focus();
2385
2385
  });
2386
2386
 
2387
+ titleElement.addEventListener("mousedown", (e) => {
2388
+ e.stopPropagation();
2389
+ });
2390
+
2387
2391
  titleElement.addEventListener("change", () => {
2388
2392
  def.title = titleElement.value;
2389
2393
  this.dispatchExternal("columnTitleChanged", this.getComponent());
@@ -6049,12 +6053,14 @@ function time(cell, onRendered, success, cancel, editorParams){
6049
6053
  newDatetime = DT.fromFormat(String(cellValue), inputFormat);
6050
6054
  }
6051
6055
 
6052
- cellValue = newDatetime.toFormat("hh:mm");
6056
+ cellValue = newDatetime.toFormat("HH:mm");
6053
6057
 
6054
6058
  }else {
6055
6059
  console.error("Editor Error - 'date' editor 'format' param is dependant on luxon.js");
6056
6060
  }
6057
6061
  }
6062
+
6063
+ console.log("val", cellValue);
6058
6064
 
6059
6065
  input.value = cellValue;
6060
6066
 
@@ -6176,7 +6182,7 @@ function datetime(cell, onRendered, success, cancel, editorParams){
6176
6182
  newDatetime = DT.fromFormat(String(cellValue), inputFormat);
6177
6183
  }
6178
6184
 
6179
- cellValue = newDatetime.toFormat("yyyy-MM-dd") + "T" + newDatetime.toFormat("hh:mm");
6185
+ cellValue = newDatetime.toFormat("yyyy-MM-dd") + "T" + newDatetime.toFormat("HH:mm");
6180
6186
  }else {
6181
6187
  console.error("Editor Error - 'date' editor 'format' param is dependant on luxon.js");
6182
6188
  }
@@ -8315,8 +8321,9 @@ class Edit$1 extends Module{
8315
8321
  allowEdit = true,
8316
8322
  rendered = function(){},
8317
8323
  element = cell.getElement(),
8324
+ editFinished = false,
8318
8325
  cellEditor, component, params;
8319
-
8326
+
8320
8327
  //prevent editing if another cell is refusing to leave focus (eg. validation fail)
8321
8328
 
8322
8329
  if(this.currentCell){
@@ -8328,13 +8335,15 @@ class Edit$1 extends Module{
8328
8335
 
8329
8336
  //handle successful value change
8330
8337
  function success(value){
8331
- if(self.currentCell === cell){
8338
+ if(self.currentCell === cell && !editFinished){
8332
8339
  var valid = self.chain("edit-success", [cell, value], true, true);
8333
-
8340
+
8334
8341
  if(valid === true || self.table.options.validationMode === "highlight"){
8342
+
8343
+ editFinished = true;
8344
+
8335
8345
  self.clearEditor();
8336
8346
 
8337
-
8338
8347
  if(!cell.modules.edit){
8339
8348
  cell.modules.edit = {};
8340
8349
  }
@@ -8346,12 +8355,17 @@ class Edit$1 extends Module{
8346
8355
  }
8347
8356
 
8348
8357
  cell.setValue(value, true);
8349
-
8358
+
8350
8359
  return valid === true;
8351
8360
  }else {
8361
+ editFinished = true;
8352
8362
  self.invalidEdit = true;
8353
8363
  self.focusCellNoEvent(cell, true);
8354
8364
  rendered();
8365
+
8366
+ setTimeout(() => {
8367
+ editFinished = false;
8368
+ }, 10);
8355
8369
  return false;
8356
8370
  }
8357
8371
  }
@@ -8359,7 +8373,9 @@ class Edit$1 extends Module{
8359
8373
 
8360
8374
  //handle aborted edit
8361
8375
  function cancel(){
8362
- if(self.currentCell === cell){
8376
+ // editFinished = true;
8377
+
8378
+ if(self.currentCell === cell && !editFinished){
8363
8379
  self.cancelEdit();
8364
8380
  }
8365
8381
  }
@@ -11068,6 +11084,7 @@ class FrozenColumns extends Module{
11068
11084
  this.subscribe("column-deleted", this.reinitializeColumns.bind(this));
11069
11085
  this.subscribe("column-hide", this.reinitializeColumns.bind(this));
11070
11086
  this.subscribe("column-show", this.reinitializeColumns.bind(this));
11087
+ this.subscribe("columns-loaded", this.reinitializeColumns.bind(this));
11071
11088
 
11072
11089
  this.subscribe("table-redraw", this.layout.bind(this));
11073
11090
  this.subscribe("layout-refreshing", this.blockLayout.bind(this));
@@ -20067,6 +20084,13 @@ class Range extends CoreFeature{
20067
20084
  this.table = table;
20068
20085
  this.start = {row:0, col:0};
20069
20086
  this.end = {row:0, col:0};
20087
+
20088
+ if(this.rangeManager.rowHeader){
20089
+ this.left = 1;
20090
+ this.right = 1;
20091
+ this.start.col = 1;
20092
+ this.end.col = 1;
20093
+ }
20070
20094
 
20071
20095
  this.initElement();
20072
20096
 
@@ -20126,14 +20150,14 @@ class Range extends CoreFeature{
20126
20150
 
20127
20151
  if (element.type === "column") {
20128
20152
  if(this.rangeManager.columnSelection){
20129
- this.setStart(0, element.getPosition() - 2);
20153
+ this.setStart(0, element.getPosition() - 1);
20130
20154
  }
20131
20155
  }else {
20132
20156
  row = element.row.position - 1;
20133
- col = element.column.getPosition() - 2;
20157
+ col = element.column.getPosition() - 1;
20134
20158
 
20135
20159
  if (element.column === this.rangeManager.rowHeader) {
20136
- this.setStart(row, 0);
20160
+ this.setStart(row, 1);
20137
20161
  } else {
20138
20162
  this.setStart(row, col);
20139
20163
  }
@@ -20147,18 +20171,18 @@ class Range extends CoreFeature{
20147
20171
  if (element.type === "column") {
20148
20172
  if(this.rangeManager.columnSelection){
20149
20173
  if (this.rangeManager.selecting === "column") {
20150
- this.setEnd(rowsCount - 1, element.getPosition() - 2);
20174
+ this.setEnd(rowsCount - 1, element.getPosition() - 1);
20151
20175
  } else if (this.rangeManager.selecting === "cell") {
20152
- this.setEnd(0, element.getPosition() - 2);
20176
+ this.setEnd(0, element.getPosition() - 1);
20153
20177
  }
20154
20178
  }
20155
20179
  }else {
20156
20180
  row = element.row.position - 1;
20157
- col = element.column.getPosition() - 2;
20181
+ col = element.column.getPosition() - 1;
20158
20182
  isRowHeader = element.column === this.rangeManager.rowHeader;
20159
20183
 
20160
20184
  if (this.rangeManager.selecting === "row") {
20161
- this.setEnd(row, this._getTableColumns().length - 2);
20185
+ this.setEnd(row, this._getTableColumns().length - 1);
20162
20186
  } else if (this.rangeManager.selecting !== "row" && isRowHeader) {
20163
20187
  this.setEnd(row, 0);
20164
20188
  } else if (this.rangeManager.selecting === "column") {
@@ -20240,11 +20264,11 @@ class Range extends CoreFeature{
20240
20264
  }
20241
20265
 
20242
20266
  atTopLeft(cell) {
20243
- return cell.row.position - 1 === this.top && cell.column.getPosition() - 2 === this.left;
20267
+ return cell.row.position - 1 === this.top && cell.column.getPosition() - 1 === this.left;
20244
20268
  }
20245
20269
 
20246
20270
  atBottomRight(cell) {
20247
- return cell.row.position - 1 === this.bottom && cell.column.getPosition() - 2 === this.right;
20271
+ return cell.row.position - 1 === this.bottom && cell.column.getPosition() - 1 === this.right;
20248
20272
  }
20249
20273
 
20250
20274
  occupies(cell) {
@@ -20256,7 +20280,7 @@ class Range extends CoreFeature{
20256
20280
  }
20257
20281
 
20258
20282
  occupiesColumn(col) {
20259
- return this.left <= col.getPosition() - 2 && col.getPosition() - 2 <= this.right;
20283
+ return this.left <= col.getPosition() - 1 && col.getPosition() - 1 <= this.right;
20260
20284
  }
20261
20285
 
20262
20286
  overlaps(left, top, right, bottom) {
@@ -20325,7 +20349,7 @@ class Range extends CoreFeature{
20325
20349
  }
20326
20350
 
20327
20351
  getColumns() {
20328
- return this._getTableColumns().slice(this.left + 1, this.right + 2);
20352
+ return this._getTableColumns().slice(this.left, this.right + 1);
20329
20353
  }
20330
20354
 
20331
20355
  clearValues(){
@@ -20511,7 +20535,7 @@ class SelectRange extends Module {
20511
20535
 
20512
20536
  initializeColumn(column) {
20513
20537
  if(this.columnSelection && column.definition.headerSort && this.options("headerSortClickElement") !== "icon"){
20514
- console.warn("Using column headerSort with selectableRangeColumns option may result in unpredictable behavior");
20538
+ console.warn("Using column headerSort with selectableRangeColumns option may result in unpredictable behavior. Consider using headerSortClickElement: 'icon'.");
20515
20539
  }
20516
20540
 
20517
20541
  if (column.modules.edit) ;
@@ -20806,7 +20830,7 @@ class SelectRange extends Module {
20806
20830
  nextCol = Math.max(nextCol - 1, 0);
20807
20831
  break;
20808
20832
  case "right":
20809
- nextCol = Math.min(nextCol + 1, this.getTableColumns().length - 2);
20833
+ nextCol = Math.min(nextCol + 1, this.getTableColumns().length - 1);
20810
20834
  break;
20811
20835
  case "up":
20812
20836
  nextRow = Math.max(nextRow - 1, 0);
@@ -20900,13 +20924,14 @@ class SelectRange extends Module {
20900
20924
  findJumpCellLeft(rowPos, colPos){
20901
20925
  var row = this.getRowByRangePos(rowPos),
20902
20926
  cells = row.cells.filter((cell) => cell.column.visible),
20903
- isStartingCellEmpty = !cells[colPos + 1].getValue(),
20927
+ isStartingCellEmpty = !cells[colPos].getValue(),
20904
20928
  isLeftOfStartingCellEmpty = cells[colPos] ? !cells[colPos].getValue() : false,
20905
20929
  jumpCol = colPos,
20906
- nextCell = this.findJumpCell(cells.slice(0, colPos), true, isStartingCellEmpty, isLeftOfStartingCellEmpty);
20930
+ targetCells = this.rowHeader ? cells.slice(1, colPos) : cells.slice(0, colPos),
20931
+ nextCell = this.findJumpCell(targetCells, true, isStartingCellEmpty, isLeftOfStartingCellEmpty);
20907
20932
 
20908
20933
  if(nextCell){
20909
- jumpCol = nextCell.column.getPosition() - 2;
20934
+ jumpCol = nextCell.column.getPosition() - 1;
20910
20935
  }
20911
20936
 
20912
20937
  return jumpCol;
@@ -20915,13 +20940,13 @@ class SelectRange extends Module {
20915
20940
  findJumpCellRight(rowPos, colPos){
20916
20941
  var row = this.getRowByRangePos(rowPos),
20917
20942
  cells = row.cells.filter((cell) => cell.column.visible),
20918
- isStartingCellEmpty = !cells[colPos + 1].getValue(),
20919
- isRightOfStartingCellEmpty = cells[colPos + 2] ? !cells[colPos + 2].getValue() : false,
20943
+ isStartingCellEmpty = !cells[colPos].getValue(),
20944
+ isRightOfStartingCellEmpty = cells[colPos + 1] ? !cells[colPos + 1].getValue() : false,
20920
20945
  jumpCol = colPos,
20921
- nextCell = this.findJumpCell(cells.slice(colPos + 2, cells.length), false, isStartingCellEmpty, isRightOfStartingCellEmpty);
20946
+ nextCell = this.findJumpCell(cells.slice(colPos + 1, cells.length), false, isStartingCellEmpty, isRightOfStartingCellEmpty);
20922
20947
 
20923
20948
  if(nextCell){
20924
- jumpCol = nextCell.column.getPosition() - 2;
20949
+ jumpCol = nextCell.column.getPosition() - 1;
20925
20950
  }
20926
20951
 
20927
20952
  return jumpCol;
@@ -20972,8 +20997,13 @@ class SelectRange extends Module {
20972
20997
  range = this.resetRanges();
20973
20998
  this.selecting = "all";
20974
20999
 
20975
- const topLeftCell = this.getCell(0, 0);
20976
- const bottomRightCell = this.getCell(-1, -1);
21000
+ var topLeftCell, bottomRightCell = this.getCell(-1, -1);
21001
+
21002
+ if(this.rowHeader){
21003
+ topLeftCell = this.getCell(0, 1);
21004
+ }else {
21005
+ topLeftCell = this.getCell(0, 0);
21006
+ }
20977
21007
 
20978
21008
  range.setBounds(topLeftCell, bottomRightCell);
20979
21009
  return;
@@ -20997,9 +21027,8 @@ class SelectRange extends Module {
20997
21027
 
20998
21028
  autoScroll(range, row, column) {
20999
21029
  var tableHolder = this.table.rowManager.element,
21000
- rowHeader = this.rowHeader.getElement(),
21001
- rect, view, withinHorizontalView, withinVerticalView;
21002
-
21030
+ rowHeader, rect, view, withinHorizontalView, withinVerticalView;
21031
+
21003
21032
  if (typeof row === 'undefined') {
21004
21033
  row = this.getRowByRangePos(range.end.row).getElement();
21005
21034
  }
@@ -21007,6 +21036,10 @@ class SelectRange extends Module {
21007
21036
  if (typeof column === 'undefined') {
21008
21037
  column = this.getColumnByRangePos(range.end.col).getElement();
21009
21038
  }
21039
+
21040
+ if (this.rowHeader) {
21041
+ rowHeader = this.rowHeader.getElement();
21042
+ }
21010
21043
 
21011
21044
  rect = {
21012
21045
  left: column.offsetLeft,
@@ -21016,11 +21049,15 @@ class SelectRange extends Module {
21016
21049
  };
21017
21050
 
21018
21051
  view = {
21019
- left: tableHolder.scrollLeft + rowHeader.offsetWidth,
21052
+ left: tableHolder.scrollLeft,
21020
21053
  right: Math.ceil(tableHolder.scrollLeft + tableHolder.clientWidth),
21021
21054
  top: tableHolder.scrollTop,
21022
21055
  bottom: tableHolder.scrollTop + tableHolder.offsetHeight - this.table.rowManager.scrollbarWidth,
21023
21056
  };
21057
+
21058
+ if (rowHeader) {
21059
+ view.left += rowHeader.offsetWidth;
21060
+ }
21024
21061
 
21025
21062
  withinHorizontalView = view.left < rect.left && rect.left < view.right && view.left < rect.right && rect.right < view.right;
21026
21063
 
@@ -21028,7 +21065,10 @@ class SelectRange extends Module {
21028
21065
 
21029
21066
  if (!withinHorizontalView) {
21030
21067
  if (rect.left < view.left) {
21031
- tableHolder.scrollLeft = rect.left - rowHeader.offsetWidth;
21068
+ tableHolder.scrollLeft = rect.left;
21069
+ if (rowHeader) {
21070
+ tableHolder.scrollLeft -= rowHeader.offsetWidth;
21071
+ }
21032
21072
  } else if (rect.right > view.right) {
21033
21073
  tableHolder.scrollLeft = rect.right - tableHolder.clientWidth;
21034
21074
  }
@@ -21147,8 +21187,7 @@ class SelectRange extends Module {
21147
21187
  var row;
21148
21188
 
21149
21189
  if (colIdx < 0) {
21150
- colIdx = this.getTableColumns().length + colIdx - 1;
21151
-
21190
+ colIdx = this.getTableColumns().length + colIdx;
21152
21191
  if (colIdx < 0) {
21153
21192
  return null;
21154
21193
  }
@@ -21160,7 +21199,7 @@ class SelectRange extends Module {
21160
21199
 
21161
21200
  row = this.table.rowManager.getRowFromPosition(rowIdx + 1);
21162
21201
 
21163
- return row ? row.getCells(false, true).filter((cell) => cell.column.visible)[colIdx + 1] : null;
21202
+ return row ? row.getCells(false, true).filter((cell) => cell.column.visible)[colIdx] : null;
21164
21203
  }
21165
21204
 
21166
21205
 
@@ -21173,7 +21212,7 @@ class SelectRange extends Module {
21173
21212
  }
21174
21213
 
21175
21214
  getColumnByRangePos(pos) {
21176
- return this.getTableColumns()[pos + 1];
21215
+ return this.getTableColumns()[pos];
21177
21216
  }
21178
21217
 
21179
21218
  getTableRows() {
@@ -25354,13 +25393,11 @@ class RowManager extends CoreFeature{
25354
25393
 
25355
25394
  //redraw table
25356
25395
  redraw (force){
25357
- const resized = this.adjustTableSize();
25396
+ this.adjustTableSize();
25358
25397
  this.table.tableWidth = this.table.element.clientWidth;
25359
25398
 
25360
- if(!force){
25361
- if(resized) {
25362
- this.reRenderInPosition();
25363
- }
25399
+ if(!force){
25400
+ this.reRenderInPosition();
25364
25401
  this.scrollHorizontal(this.scrollLeft);
25365
25402
  }else {
25366
25403
  this.renderTable();
@@ -27886,7 +27923,7 @@ class Tabulator {
27886
27923
  this.options.height = isNaN(height) ? height : height + "px";
27887
27924
  this.element.style.height = this.options.height;
27888
27925
  this.rowManager.initializeRenderer();
27889
- this.rowManager.redraw();
27926
+ this.rowManager.redraw(true);
27890
27927
  }
27891
27928
 
27892
27929
  //////////////////// Event Bus ///////////////////