tabulator-tables 5.2.4 → 5.2.7

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 (74) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.md +1 -0
  2. package/README.md +15 -3
  3. package/bower.json +1 -1
  4. package/dist/css/tabulator.css +4 -4
  5. package/dist/css/tabulator.css.map +1 -1
  6. package/dist/css/tabulator.min.css +1 -1
  7. package/dist/css/tabulator.min.css.map +1 -1
  8. package/dist/css/tabulator_bootstrap3.css +4 -4
  9. package/dist/css/tabulator_bootstrap3.css.map +1 -1
  10. package/dist/css/tabulator_bootstrap3.min.css +1 -1
  11. package/dist/css/tabulator_bootstrap3.min.css.map +1 -1
  12. package/dist/css/tabulator_bootstrap4.css +4 -4
  13. package/dist/css/tabulator_bootstrap4.css.map +1 -1
  14. package/dist/css/tabulator_bootstrap4.min.css +1 -1
  15. package/dist/css/tabulator_bootstrap4.min.css.map +1 -1
  16. package/dist/css/tabulator_bootstrap5.css +84 -75
  17. package/dist/css/tabulator_bootstrap5.css.map +1 -1
  18. package/dist/css/tabulator_bootstrap5.min.css +1 -1
  19. package/dist/css/tabulator_bootstrap5.min.css.map +1 -1
  20. package/dist/css/tabulator_bulma.css +16 -4
  21. package/dist/css/tabulator_bulma.css.map +1 -1
  22. package/dist/css/tabulator_bulma.min.css +1 -1
  23. package/dist/css/tabulator_bulma.min.css.map +1 -1
  24. package/dist/css/tabulator_materialize.css +4 -4
  25. package/dist/css/tabulator_materialize.css.map +1 -1
  26. package/dist/css/tabulator_materialize.min.css +1 -1
  27. package/dist/css/tabulator_materialize.min.css.map +1 -1
  28. package/dist/css/tabulator_midnight.css +4 -4
  29. package/dist/css/tabulator_midnight.css.map +1 -1
  30. package/dist/css/tabulator_midnight.min.css +1 -1
  31. package/dist/css/tabulator_midnight.min.css.map +1 -1
  32. package/dist/css/tabulator_modern.css +4 -4
  33. package/dist/css/tabulator_modern.css.map +1 -1
  34. package/dist/css/tabulator_modern.min.css +1 -1
  35. package/dist/css/tabulator_modern.min.css.map +1 -1
  36. package/dist/css/tabulator_semanticui.css +4 -4
  37. package/dist/css/tabulator_semanticui.css.map +1 -1
  38. package/dist/css/tabulator_semanticui.min.css +1 -1
  39. package/dist/css/tabulator_semanticui.min.css.map +1 -1
  40. package/dist/css/tabulator_simple.css +4 -4
  41. package/dist/css/tabulator_simple.css.map +1 -1
  42. package/dist/css/tabulator_simple.min.css +1 -1
  43. package/dist/css/tabulator_simple.min.css.map +1 -1
  44. package/dist/css/tabulator_site.css +4 -4
  45. package/dist/css/tabulator_site.css.map +1 -1
  46. package/dist/css/tabulator_site.min.css +1 -1
  47. package/dist/css/tabulator_site.min.css.map +1 -1
  48. package/dist/js/tabulator.js +77 -126
  49. package/dist/js/tabulator.js.map +1 -1
  50. package/dist/js/tabulator.min.js +2 -2
  51. package/dist/js/tabulator.min.js.map +1 -1
  52. package/dist/js/tabulator_esm.js +57 -99
  53. package/dist/js/tabulator_esm.js.map +1 -1
  54. package/dist/js/tabulator_esm.min.js +2 -2
  55. package/dist/js/tabulator_esm.min.js.map +1 -1
  56. package/package.json +1 -1
  57. package/src/js/core/RowManager.js +1 -1
  58. package/src/js/core/Tabulator.js +3 -0
  59. package/src/js/core/cell/Cell.js +1 -2
  60. package/src/js/core/column/Column.js +1 -81
  61. package/src/js/core/rendering/Renderer.js +2 -0
  62. package/src/js/core/tools/Popup.js +23 -0
  63. package/src/js/modules/Download/defaults/downloaders/csv.js +2 -3
  64. package/src/js/modules/Download/defaults/downloaders/pdf.js +2 -3
  65. package/src/js/modules/Edit/List.js +22 -7
  66. package/src/js/modules/Export/Export.js +1 -2
  67. package/src/js/modules/Interaction/Interaction.js +3 -3
  68. package/src/js/modules/Page/Page.js +1 -2
  69. package/src/js/modules/ResizeColumns/ResizeColumns.js +1 -1
  70. package/src/js/modules/Sort/Sort.js +1 -1
  71. package/src/scss/tabulator.scss +2 -2
  72. package/src/scss/themes/bootstrap/tabulator_bootstrap5.scss +58 -49
  73. package/src/scss/themes/bootstrap/variables5.scss +4 -4
  74. package/src/scss/themes/bulma/tabulator_bulma.scss +47 -32
@@ -1,4 +1,4 @@
1
- /* Tabulator v5.2.4 (c) Oliver Folkerd 2022 */
1
+ /* Tabulator v5.2.7 (c) Oliver Folkerd 2022 */
2
2
  class CoreFeature{
3
3
 
4
4
  constructor(table){
@@ -194,6 +194,14 @@ class Popup extends CoreFeature{
194
194
 
195
195
  this.blurEvent = this.hide.bind(this, false);
196
196
  this.escEvent = this._escapeCheck.bind(this);
197
+
198
+ this.destroyBinding = this.tableDestroyed;
199
+ this.destroyed = false;
200
+ }
201
+
202
+ tableDestroyed(){
203
+ this.destroyed = true;
204
+ this.hide(true);
197
205
  }
198
206
 
199
207
  _lookupContainer(){
@@ -277,6 +285,10 @@ class Popup extends CoreFeature{
277
285
 
278
286
  show(origin, position){
279
287
  var x, y, parentEl, parentOffset, coords;
288
+
289
+ if(this.destroyed || this.table.destroyed){
290
+ return this;
291
+ }
280
292
 
281
293
  if(origin instanceof HTMLElement){
282
294
  parentEl = origin;
@@ -311,6 +323,12 @@ class Popup extends CoreFeature{
311
323
  this._fitToScreen(x, y, parentEl, parentOffset, position);
312
324
 
313
325
  this.visible = true;
326
+
327
+ this.subscribe("table-destroy", this.destroyBinding);
328
+
329
+ this.element.addEventListener("mousedown", (e) => {
330
+ e.stopPropagation();
331
+ });
314
332
 
315
333
  return this;
316
334
  }
@@ -362,8 +380,10 @@ class Popup extends CoreFeature{
362
380
  this.subscribe("cell-editing", this.blurEvent);
363
381
  document.body.addEventListener("click", this.blurEvent);
364
382
  document.body.addEventListener("contextmenu", this.blurEvent);
383
+ document.body.addEventListener("mousedown", this.blurEvent);
365
384
  window.addEventListener("resize", this.blurEvent);
366
385
  document.body.addEventListener("keydown", this.escEvent);
386
+
367
387
  }, 100);
368
388
 
369
389
  this.blurCallback = callback;
@@ -384,6 +404,7 @@ class Popup extends CoreFeature{
384
404
  document.body.removeEventListener("keydown", this.escEvent);
385
405
  document.body.removeEventListener("click", this.blurEvent);
386
406
  document.body.removeEventListener("contextmenu", this.blurEvent);
407
+ document.body.removeEventListener("mousedown", this.blurEvent);
387
408
  window.removeEventListener("resize", this.blurEvent);
388
409
  this.table.rowManager.element.removeEventListener("scroll", this.blurEvent);
389
410
  this.unsubscribe("cell-editing", this.blurEvent);
@@ -406,6 +427,8 @@ class Popup extends CoreFeature{
406
427
  if(this.blurCallback && !silent){
407
428
  this.blurCallback();
408
429
  }
430
+
431
+ this.unsubscribe("table-destroy", this.destroyBinding);
409
432
  }
410
433
 
411
434
  return this;
@@ -1564,7 +1587,6 @@ class Cell extends CoreFeature{
1564
1587
  }
1565
1588
  break;
1566
1589
  case "undefined":
1567
- case "null":
1568
1590
  this.element.innerHTML = "";
1569
1591
  break;
1570
1592
  default:
@@ -2066,8 +2088,6 @@ class Column extends CoreFeature{
2066
2088
  }
2067
2089
  }
2068
2090
 
2069
- this.contentElement = this._bindEvents();
2070
-
2071
2091
  this.contentElement = this._buildColumnHeaderContent();
2072
2092
 
2073
2093
  this.element.appendChild(this.contentElement);
@@ -2081,83 +2101,6 @@ class Column extends CoreFeature{
2081
2101
  this.dispatch("column-init", this);
2082
2102
  }
2083
2103
 
2084
- _bindEvents(){
2085
- var def = this.definition,
2086
- dblTap, tapHold, tap;
2087
-
2088
- //setup header click event bindings
2089
- if(typeof(def.headerClick) == "function"){
2090
- this.element.addEventListener("click", (e) => {def.headerClick(e, this.getComponent());});
2091
- }
2092
-
2093
- if(typeof(def.headerDblClick) == "function"){
2094
- this.element.addEventListener("dblclick", (e) => {def.headerDblClick(e, this.getComponent());});
2095
- }
2096
-
2097
- if(typeof(def.headerContext) == "function"){
2098
- this.element.addEventListener("contextmenu", (e) => {def.headerContext(e, this.getComponent());});
2099
- }
2100
-
2101
- //setup header tap event bindings
2102
- if(typeof(def.headerTap) == "function"){
2103
- tap = false;
2104
-
2105
- this.element.addEventListener("touchstart", (e) => {
2106
- tap = true;
2107
- }, {passive: true});
2108
-
2109
- this.element.addEventListener("touchend", (e) => {
2110
- if(tap){
2111
- def.headerTap(e, this.getComponent());
2112
- }
2113
-
2114
- tap = false;
2115
- });
2116
- }
2117
-
2118
- if(typeof(def.headerDblTap) == "function"){
2119
- dblTap = null;
2120
-
2121
- this.element.addEventListener("touchend", (e) => {
2122
-
2123
- if(dblTap){
2124
- clearTimeout(dblTap);
2125
- dblTap = null;
2126
-
2127
- def.headerDblTap(e, this.getComponent());
2128
- }else {
2129
-
2130
- dblTap = setTimeout(() => {
2131
- clearTimeout(dblTap);
2132
- dblTap = null;
2133
- }, 300);
2134
- }
2135
-
2136
- });
2137
- }
2138
-
2139
- if(typeof(def.headerTapHold) == "function"){
2140
- tapHold = null;
2141
-
2142
- this.element.addEventListener("touchstart", (e) => {
2143
- clearTimeout(tapHold);
2144
-
2145
- tapHold = setTimeout(function(){
2146
- clearTimeout(tapHold);
2147
- tapHold = null;
2148
- tap = false;
2149
- def.headerTapHold(e, this.getComponent());
2150
- }, 1000);
2151
-
2152
- }, {passive: true});
2153
-
2154
- this.element.addEventListener("touchend", (e) => {
2155
- clearTimeout(tapHold);
2156
- tapHold = null;
2157
- });
2158
- }
2159
- }
2160
-
2161
2104
  //build header element for header
2162
2105
  _buildColumnHeader(){
2163
2106
  var def = this.definition,
@@ -2284,7 +2227,6 @@ class Column extends CoreFeature{
2284
2227
  }
2285
2228
  break;
2286
2229
  case "undefined":
2287
- case "null":
2288
2230
  el.innerHTML = "";
2289
2231
  break;
2290
2232
  default:
@@ -4650,11 +4592,10 @@ function csv(list, options, setFileContents){
4650
4592
 
4651
4593
  switch(typeof col.value){
4652
4594
  case "object":
4653
- col.value = JSON.stringify(col.value);
4595
+ col.value = col.value !== null ? JSON.stringify(col.value) : "";
4654
4596
  break;
4655
4597
 
4656
4598
  case "undefined":
4657
- case "null":
4658
4599
  col.value = "";
4659
4600
  break;
4660
4601
  }
@@ -4774,11 +4715,10 @@ function pdf(list, options, setFileContents){
4774
4715
  if(col){
4775
4716
  switch(typeof col.value){
4776
4717
  case "object":
4777
- col.value = JSON.stringify(col.value);
4718
+ col.value = col.value !== null ? JSON.stringify(col.value) : "";
4778
4719
  break;
4779
4720
 
4780
4721
  case "undefined":
4781
- case "null":
4782
4722
  col.value = "";
4783
4723
  break;
4784
4724
  }
@@ -5590,6 +5530,8 @@ class Edit{
5590
5530
 
5591
5531
  this.listIteration = 0;
5592
5532
 
5533
+ this.lastAction="";
5534
+
5593
5535
  this.blurable = true;
5594
5536
 
5595
5537
  this.actions = {
@@ -5631,7 +5573,7 @@ class Edit{
5631
5573
  this.initialValues = this.params.multiselect ? initialValue : [initialValue];
5632
5574
 
5633
5575
  if(this.isFilter){
5634
- this.input.value = this.initialValues.join(",");
5576
+ this.input.value = this.initialValues ? this.initialValues.join(",") : "";
5635
5577
  this.headerFilterInitialListGen();
5636
5578
  }
5637
5579
  }
@@ -5720,7 +5662,7 @@ class Edit{
5720
5662
  _initializeParams(params){
5721
5663
  var valueKeys = ["values", "valuesURL", "valuesLookup"],
5722
5664
  valueCheck;
5723
-
5665
+
5724
5666
  params = Object.assign({}, params);
5725
5667
 
5726
5668
  params.verticalNavigation = params.verticalNavigation || "editor";
@@ -5729,9 +5671,9 @@ class Edit{
5729
5671
  params.filterDelay = typeof params.filterDelay === "undefined" ? 300 : params.filterDelay;
5730
5672
 
5731
5673
  params.emptyValue = Object.keys(params).includes("emptyValue") ? params.emptyValue : "";
5732
-
5674
+
5733
5675
  valueCheck = Object.keys(params).filter(key => valueKeys.includes(key)).length;
5734
-
5676
+
5735
5677
  if(!valueCheck){
5736
5678
  console.warn("list editor config error - either the values, valuesURL, or valuesLookup option must be set");
5737
5679
  }else if(valueCheck > 1){
@@ -5931,10 +5873,12 @@ class Edit{
5931
5873
  }
5932
5874
 
5933
5875
  _keyEnter(e){
5934
- if(this.focusedItem){
5935
- this._chooseItem(this.focusedItem);
5876
+ if(this.params.autocomplete && this.lastAction === "typing"){
5877
+ this._resolveValue(true);
5936
5878
  }else {
5937
- this._cancel();
5879
+ if(this.focusedItem){
5880
+ this._chooseItem(this.focusedItem);
5881
+ }
5938
5882
  }
5939
5883
  }
5940
5884
 
@@ -5963,6 +5907,7 @@ class Edit{
5963
5907
 
5964
5908
  _keyAutoCompLetter(e){
5965
5909
  this._filter();
5910
+ this.lastAction = "typing";
5966
5911
  this.typing = true;
5967
5912
  }
5968
5913
 
@@ -5987,6 +5932,8 @@ class Edit{
5987
5932
  }
5988
5933
 
5989
5934
  _focusItem(item){
5935
+ this.lastAction = "focus";
5936
+
5990
5937
  if(this.focusedItem && this.focusedItem.element){
5991
5938
  this.focusedItem.element.classList.remove("focused");
5992
5939
  }
@@ -6156,6 +6103,12 @@ class Edit{
6156
6103
 
6157
6104
  this._parseListItem(value, data, 0);
6158
6105
  });
6106
+
6107
+ if(!this.currentItems.length && this.params.freetext){
6108
+ this.input.value = this.initialValues;
6109
+ this.typing = true;
6110
+ this.lastAction = "typing";
6111
+ }
6159
6112
 
6160
6113
  this.data = data;
6161
6114
 
@@ -6499,6 +6452,8 @@ class Edit{
6499
6452
  }else {
6500
6453
  this.currentItems = [item];
6501
6454
  item.selected = true;
6455
+
6456
+ console.log("choose");
6502
6457
 
6503
6458
  this.input.value = item.label;
6504
6459
 
@@ -8188,11 +8143,10 @@ class Export extends Module{
8188
8143
  }else {
8189
8144
  switch(typeof value){
8190
8145
  case "object":
8191
- value = JSON.stringify(value);
8146
+ value = value !== null ? JSON.stringify(value) : "";
8192
8147
  break;
8193
8148
 
8194
8149
  case "undefined":
8195
- case "null":
8196
8150
  value = "";
8197
8151
  break;
8198
8152
 
@@ -15150,7 +15104,6 @@ class Page extends Module{
15150
15104
  }
15151
15105
  break;
15152
15106
  case "undefined":
15153
- case "null":
15154
15107
  this.pageCounterElement.innerHTML = "";
15155
15108
  break;
15156
15109
  default:
@@ -16735,7 +16688,7 @@ class ResizeColumns extends Module{
16735
16688
 
16736
16689
  config.handleEl = handle;
16737
16690
 
16738
- if(element.parentNode){
16691
+ if(element.parentNode && column.visible){
16739
16692
  element.after(handle);
16740
16693
  }
16741
16694
  }
@@ -18517,7 +18470,7 @@ class Sort extends Module{
18517
18470
  //set the column header sort direction
18518
18471
  setColumnHeader(column, dir){
18519
18472
  column.modules.sort.dir = dir;
18520
- column.getElement().setAttribute("aria-sort", dir);
18473
+ column.getElement().setAttribute("aria-sort", dir === "asc" ? "ascending" : "descending");
18521
18474
  }
18522
18475
 
18523
18476
  //sort each item in sort list
@@ -19460,6 +19413,8 @@ class Renderer extends CoreFeature{
19460
19413
  this.elementVertical.scrollTop = this.elementVertical.scrollTop - this.elementVertical.clientHeight + rowEl.offsetHeight;
19461
19414
  }
19462
19415
 
19416
+ break;
19417
+
19463
19418
  case "top":
19464
19419
  this.elementVertical.scrollTop = rowEl.offsetTop;
19465
19420
  break;
@@ -21420,7 +21375,7 @@ class RowManager extends CoreFeature{
21420
21375
 
21421
21376
  el.classList.add("tabulator-tableholder");
21422
21377
  el.setAttribute("tabindex", 0);
21423
- el.setAttribute("role", "rowgroup");
21378
+ // el.setAttribute("role", "rowgroup");
21424
21379
 
21425
21380
  return el;
21426
21381
  }
@@ -24097,6 +24052,7 @@ class Tabulator {
24097
24052
  this.optionsList = new OptionsList(this, "table constructor");
24098
24053
 
24099
24054
  this.initialized = false;
24055
+ this.destroyed = false;
24100
24056
 
24101
24057
  if(this.initializeElement(element)){
24102
24058
 
@@ -24325,6 +24281,8 @@ class Tabulator {
24325
24281
  destroy(){
24326
24282
  var element = this.element;
24327
24283
 
24284
+ this.destroyed = true;
24285
+
24328
24286
  TableRegistry.deregister(this); //deregister table from inter-device communication
24329
24287
 
24330
24288
  this.eventBus.dispatch("table-destroy");