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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tabulator-tables",
3
- "version": "5.2.4",
3
+ "version": "5.2.7",
4
4
  "description": "Interactive table generation JavaScript library",
5
5
  "style": "dist/css/tabulator.css",
6
6
  "main": "dist/js/tabulator.js",
@@ -51,7 +51,7 @@ export default class RowManager extends CoreFeature{
51
51
 
52
52
  el.classList.add("tabulator-tableholder");
53
53
  el.setAttribute("tabindex", 0);
54
- el.setAttribute("role", "rowgroup");
54
+ // el.setAttribute("role", "rowgroup");
55
55
 
56
56
  return el;
57
57
  }
@@ -50,6 +50,7 @@ class Tabulator {
50
50
  this.optionsList = new OptionsList(this, "table constructor");
51
51
 
52
52
  this.initialized = false;
53
+ this.destroyed = false;
53
54
 
54
55
  if(this.initializeElement(element)){
55
56
 
@@ -279,6 +280,8 @@ class Tabulator {
279
280
  destroy(){
280
281
  var element = this.element;
281
282
 
283
+ this.destroyed = true;
284
+
282
285
  TableRegistry.deregister(this); //deregister table from inter-device communication
283
286
 
284
287
  this.eventBus.dispatch("table-destroy");
@@ -118,7 +118,6 @@ export default class Cell extends CoreFeature{
118
118
  }
119
119
  break;
120
120
  case "undefined":
121
- case "null":
122
121
  this.element.innerHTML = "";
123
122
  break;
124
123
  default:
@@ -294,4 +293,4 @@ export default class Cell extends CoreFeature{
294
293
 
295
294
  return this.component;
296
295
  }
297
- }
296
+ }
@@ -158,8 +158,6 @@ class Column extends CoreFeature{
158
158
  }
159
159
  }
160
160
 
161
- this.contentElement = this._bindEvents();
162
-
163
161
  this.contentElement = this._buildColumnHeaderContent();
164
162
 
165
163
  this.element.appendChild(this.contentElement);
@@ -173,83 +171,6 @@ class Column extends CoreFeature{
173
171
  this.dispatch("column-init", this);
174
172
  }
175
173
 
176
- _bindEvents(){
177
- var def = this.definition,
178
- dblTap, tapHold, tap;
179
-
180
- //setup header click event bindings
181
- if(typeof(def.headerClick) == "function"){
182
- this.element.addEventListener("click", (e) => {def.headerClick(e, this.getComponent());});
183
- }
184
-
185
- if(typeof(def.headerDblClick) == "function"){
186
- this.element.addEventListener("dblclick", (e) => {def.headerDblClick(e, this.getComponent());});
187
- }
188
-
189
- if(typeof(def.headerContext) == "function"){
190
- this.element.addEventListener("contextmenu", (e) => {def.headerContext(e, this.getComponent());});
191
- }
192
-
193
- //setup header tap event bindings
194
- if(typeof(def.headerTap) == "function"){
195
- tap = false;
196
-
197
- this.element.addEventListener("touchstart", (e) => {
198
- tap = true;
199
- }, {passive: true});
200
-
201
- this.element.addEventListener("touchend", (e) => {
202
- if(tap){
203
- def.headerTap(e, this.getComponent());
204
- }
205
-
206
- tap = false;
207
- });
208
- }
209
-
210
- if(typeof(def.headerDblTap) == "function"){
211
- dblTap = null;
212
-
213
- this.element.addEventListener("touchend", (e) => {
214
-
215
- if(dblTap){
216
- clearTimeout(dblTap);
217
- dblTap = null;
218
-
219
- def.headerDblTap(e, this.getComponent());
220
- }else{
221
-
222
- dblTap = setTimeout(() => {
223
- clearTimeout(dblTap);
224
- dblTap = null;
225
- }, 300);
226
- }
227
-
228
- });
229
- }
230
-
231
- if(typeof(def.headerTapHold) == "function"){
232
- tapHold = null;
233
-
234
- this.element.addEventListener("touchstart", (e) => {
235
- clearTimeout(tapHold);
236
-
237
- tapHold = setTimeout(function(){
238
- clearTimeout(tapHold);
239
- tapHold = null;
240
- tap = false;
241
- def.headerTapHold(e, this.getComponent());
242
- }, 1000);
243
-
244
- }, {passive: true});
245
-
246
- this.element.addEventListener("touchend", (e) => {
247
- clearTimeout(tapHold);
248
- tapHold = null;
249
- });
250
- }
251
- }
252
-
253
174
  //build header element for header
254
175
  _buildColumnHeader(){
255
176
  var def = this.definition,
@@ -377,7 +298,6 @@ class Column extends CoreFeature{
377
298
  }
378
299
  break;
379
300
  case "undefined":
380
- case "null":
381
301
  el.innerHTML = "";
382
302
  break;
383
303
  default:
@@ -999,4 +919,4 @@ class Column extends CoreFeature{
999
919
 
1000
920
  Column.defaultOptionList = defaultOptions;
1001
921
 
1002
- export default Column;
922
+ export default Column;
@@ -186,6 +186,8 @@ export default class Renderer extends CoreFeature{
186
186
  this.elementVertical.scrollTop = this.elementVertical.scrollTop - this.elementVertical.clientHeight + rowEl.offsetHeight;
187
187
  }
188
188
 
189
+ break;
190
+
189
191
  case "top":
190
192
  this.elementVertical.scrollTop = rowEl.offsetTop;
191
193
  break;
@@ -22,6 +22,14 @@ export default class Popup extends CoreFeature{
22
22
 
23
23
  this.blurEvent = this.hide.bind(this, false);
24
24
  this.escEvent = this._escapeCheck.bind(this);
25
+
26
+ this.destroyBinding = this.tableDestroyed;
27
+ this.destroyed = false;
28
+ }
29
+
30
+ tableDestroyed(){
31
+ this.destroyed = true;
32
+ this.hide(true);
25
33
  }
26
34
 
27
35
  _lookupContainer(){
@@ -105,6 +113,10 @@ export default class Popup extends CoreFeature{
105
113
 
106
114
  show(origin, position){
107
115
  var x, y, parentEl, parentOffset, containerOffset, coords;
116
+
117
+ if(this.destroyed || this.table.destroyed){
118
+ return this;
119
+ }
108
120
 
109
121
  if(origin instanceof HTMLElement){
110
122
  parentEl = origin;
@@ -139,6 +151,12 @@ export default class Popup extends CoreFeature{
139
151
  this._fitToScreen(x, y, parentEl, parentOffset, position);
140
152
 
141
153
  this.visible = true;
154
+
155
+ this.subscribe("table-destroy", this.destroyBinding);
156
+
157
+ this.element.addEventListener("mousedown", (e) => {
158
+ e.stopPropagation();
159
+ })
142
160
 
143
161
  return this;
144
162
  }
@@ -190,8 +208,10 @@ export default class Popup extends CoreFeature{
190
208
  this.subscribe("cell-editing", this.blurEvent);
191
209
  document.body.addEventListener("click", this.blurEvent);
192
210
  document.body.addEventListener("contextmenu", this.blurEvent);
211
+ document.body.addEventListener("mousedown", this.blurEvent);
193
212
  window.addEventListener("resize", this.blurEvent);
194
213
  document.body.addEventListener("keydown", this.escEvent);
214
+
195
215
  }, 100);
196
216
 
197
217
  this.blurCallback = callback;
@@ -212,6 +232,7 @@ export default class Popup extends CoreFeature{
212
232
  document.body.removeEventListener("keydown", this.escEvent);
213
233
  document.body.removeEventListener("click", this.blurEvent);
214
234
  document.body.removeEventListener("contextmenu", this.blurEvent);
235
+ document.body.removeEventListener("mousedown", this.blurEvent);
215
236
  window.removeEventListener("resize", this.blurEvent);
216
237
  this.table.rowManager.element.removeEventListener("scroll", this.blurEvent);
217
238
  this.unsubscribe("cell-editing", this.blurEvent);
@@ -234,6 +255,8 @@ export default class Popup extends CoreFeature{
234
255
  if(this.blurCallback && !silent){
235
256
  this.blurCallback();
236
257
  }
258
+
259
+ this.unsubscribe("table-destroy", this.destroyBinding);
237
260
  }
238
261
 
239
262
  return this;
@@ -30,11 +30,10 @@ export default function(list, options, setFileContents){
30
30
 
31
31
  switch(typeof col.value){
32
32
  case "object":
33
- col.value = JSON.stringify(col.value);
33
+ col.value = col.value !== null ? JSON.stringify(col.value) : "";
34
34
  break;
35
35
 
36
36
  case "undefined":
37
- case "null":
38
37
  col.value = "";
39
38
  break;
40
39
  }
@@ -59,4 +58,4 @@ export default function(list, options, setFileContents){
59
58
  }
60
59
 
61
60
  setFileContents(fileContents, "text/csv");
62
- };
61
+ };
@@ -57,11 +57,10 @@ export default function(list, options, setFileContents){
57
57
  if(col){
58
58
  switch(typeof col.value){
59
59
  case "object":
60
- col.value = JSON.stringify(col.value);
60
+ col.value = col.value !== null ? JSON.stringify(col.value) : "";
61
61
  break;
62
62
 
63
63
  case "undefined":
64
- case "null":
65
64
  col.value = "";
66
65
  break;
67
66
  }
@@ -111,4 +110,4 @@ export default function(list, options, setFileContents){
111
110
  }
112
111
 
113
112
  setFileContents(doc.output("arraybuffer"), "application/pdf");
114
- };
113
+ };
@@ -29,6 +29,8 @@ export default class Edit{
29
29
 
30
30
  this.listIteration = 0;
31
31
 
32
+ this.lastAction="";
33
+
32
34
  this.blurable = true;
33
35
 
34
36
  this.actions = {
@@ -70,7 +72,7 @@ export default class Edit{
70
72
  this.initialValues = this.params.multiselect ? initialValue : [initialValue];
71
73
 
72
74
  if(this.isFilter){
73
- this.input.value = this.initialValues.join(",");
75
+ this.input.value = this.initialValues ? this.initialValues.join(",") : "";
74
76
  this.headerFilterInitialListGen();
75
77
  }
76
78
  }
@@ -159,7 +161,7 @@ export default class Edit{
159
161
  _initializeParams(params){
160
162
  var valueKeys = ["values", "valuesURL", "valuesLookup"],
161
163
  valueCheck;
162
-
164
+
163
165
  params = Object.assign({}, params);
164
166
 
165
167
  params.verticalNavigation = params.verticalNavigation || "editor";
@@ -168,9 +170,9 @@ export default class Edit{
168
170
  params.filterDelay = typeof params.filterDelay === "undefined" ? 300 : params.filterDelay;
169
171
 
170
172
  params.emptyValue = Object.keys(params).includes("emptyValue") ? params.emptyValue : "";
171
-
173
+
172
174
  valueCheck = Object.keys(params).filter(key => valueKeys.includes(key)).length;
173
-
175
+
174
176
  if(!valueCheck){
175
177
  console.warn("list editor config error - either the values, valuesURL, or valuesLookup option must be set")
176
178
  }else if(valueCheck > 1){
@@ -370,10 +372,12 @@ export default class Edit{
370
372
  }
371
373
 
372
374
  _keyEnter(e){
373
- if(this.focusedItem){
374
- this._chooseItem(this.focusedItem);
375
+ if(this.params.autocomplete && this.lastAction === "typing"){
376
+ this._resolveValue(true);
375
377
  }else{
376
- this._cancel();
378
+ if(this.focusedItem){
379
+ this._chooseItem(this.focusedItem);
380
+ }
377
381
  }
378
382
  }
379
383
 
@@ -402,6 +406,7 @@ export default class Edit{
402
406
 
403
407
  _keyAutoCompLetter(e){
404
408
  this._filter();
409
+ this.lastAction = "typing";
405
410
  this.typing = true;
406
411
  }
407
412
 
@@ -426,6 +431,8 @@ export default class Edit{
426
431
  }
427
432
 
428
433
  _focusItem(item){
434
+ this.lastAction = "focus";
435
+
429
436
  if(this.focusedItem && this.focusedItem.element){
430
437
  this.focusedItem.element.classList.remove("focused");
431
438
  }
@@ -595,6 +602,12 @@ export default class Edit{
595
602
 
596
603
  this._parseListItem(value, data, 0);
597
604
  });
605
+
606
+ if(!this.currentItems.length && this.params.freetext){
607
+ this.input.value = this.initialValues;
608
+ this.typing = true;
609
+ this.lastAction = "typing";
610
+ }
598
611
 
599
612
  this.data = data;
600
613
 
@@ -939,6 +952,8 @@ export default class Edit{
939
952
  }else{
940
953
  this.currentItems = [item];
941
954
  item.selected = true;
955
+
956
+ console.log("choose")
942
957
 
943
958
  this.input.value = item.label;
944
959
 
@@ -510,11 +510,10 @@ class Export extends Module{
510
510
  }else{
511
511
  switch(typeof value){
512
512
  case "object":
513
- value = JSON.stringify(value);
513
+ value = value !== null ? JSON.stringify(value) : "";
514
514
  break;
515
515
 
516
516
  case "undefined":
517
- case "null":
518
517
  value = "";
519
518
  break;
520
519
 
@@ -1,8 +1,8 @@
1
1
  import Module from '../../core/Module.js';
2
2
  import Helpers from '../../core/tools/Helpers.js';
3
3
 
4
- import Cell from '../../core/cell/Cell';
5
- import Column from '../../core/column/Column';
4
+ import Cell from '../../core/cell/Cell.js';
5
+ import Column from '../../core/column/Column.js';
6
6
 
7
7
  class Interaction extends Module{
8
8
 
@@ -311,4 +311,4 @@ class Interaction extends Module{
311
311
 
312
312
  Interaction.moduleName = "interaction";
313
313
 
314
- export default Interaction;
314
+ export default Interaction;
@@ -609,7 +609,6 @@ class Page extends Module{
609
609
  }
610
610
  break;
611
611
  case "undefined":
612
- case "null":
613
612
  this.pageCounterElement.innerHTML = "";
614
613
  break;
615
614
  default:
@@ -895,4 +894,4 @@ Page.moduleName = "page";
895
894
  //load defaults
896
895
  Page.pageCounters = defaultPageCounters;
897
896
 
898
- export default Page;
897
+ export default Page;
@@ -156,7 +156,7 @@ class ResizeColumns extends Module{
156
156
 
157
157
  config.handleEl = handle;
158
158
 
159
- if(element.parentNode){
159
+ if(element.parentNode && column.visible){
160
160
  element.after(handle);
161
161
  }
162
162
  }
@@ -378,7 +378,7 @@ class Sort extends Module{
378
378
  //set the column header sort direction
379
379
  setColumnHeader(column, dir){
380
380
  column.modules.sort.dir = dir;
381
- column.getElement().setAttribute("aria-sort", dir);
381
+ column.getElement().setAttribute("aria-sort", dir === "asc" ? "ascending" : "descending");
382
382
  }
383
383
 
384
384
  //sort each item in sort list
@@ -244,7 +244,7 @@ $footerActiveColor:#d00 !default; //footer bottom active text color
244
244
  }
245
245
  }
246
246
 
247
- &[aria-sort="asc"]{
247
+ &[aria-sort="ascending"]{
248
248
  .tabulator-col-content .tabulator-col-sorter{
249
249
  color: $sortArrowActive;
250
250
 
@@ -256,7 +256,7 @@ $footerActiveColor:#d00 !default; //footer bottom active text color
256
256
  }
257
257
  }
258
258
 
259
- &[aria-sort="desc"]{
259
+ &[aria-sort="descending"]{
260
260
  .tabulator-col-content .tabulator-col-sorter{
261
261
  color: $sortArrowActive;
262
262