tabulator-tables 5.1.0 → 5.1.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/build/rollup.js +2 -1
  3. package/dist/css/tabulator.css +15 -8
  4. package/dist/css/tabulator.css.map +1 -1
  5. package/dist/css/tabulator.min.css +1 -1
  6. package/dist/css/tabulator.min.css.map +1 -1
  7. package/dist/css/tabulator_bootstrap3.css +15 -8
  8. package/dist/css/tabulator_bootstrap3.css.map +1 -1
  9. package/dist/css/tabulator_bootstrap3.min.css +1 -1
  10. package/dist/css/tabulator_bootstrap3.min.css.map +1 -1
  11. package/dist/css/tabulator_bootstrap4.css +15 -8
  12. package/dist/css/tabulator_bootstrap4.css.map +1 -1
  13. package/dist/css/tabulator_bootstrap4.min.css +1 -1
  14. package/dist/css/tabulator_bootstrap4.min.css.map +1 -1
  15. package/dist/css/tabulator_bulma.css +15 -8
  16. package/dist/css/tabulator_bulma.css.map +1 -1
  17. package/dist/css/tabulator_bulma.min.css +1 -1
  18. package/dist/css/tabulator_bulma.min.css.map +1 -1
  19. package/dist/css/tabulator_materialize.css +15 -8
  20. package/dist/css/tabulator_materialize.css.map +1 -1
  21. package/dist/css/tabulator_materialize.min.css +1 -1
  22. package/dist/css/tabulator_materialize.min.css.map +1 -1
  23. package/dist/css/tabulator_midnight.css +15 -8
  24. package/dist/css/tabulator_midnight.css.map +1 -1
  25. package/dist/css/tabulator_midnight.min.css +1 -1
  26. package/dist/css/tabulator_midnight.min.css.map +1 -1
  27. package/dist/css/tabulator_modern.css +15 -8
  28. package/dist/css/tabulator_modern.css.map +1 -1
  29. package/dist/css/tabulator_modern.min.css +1 -1
  30. package/dist/css/tabulator_modern.min.css.map +1 -1
  31. package/dist/css/tabulator_semanticui.css +15 -8
  32. package/dist/css/tabulator_semanticui.css.map +1 -1
  33. package/dist/css/tabulator_semanticui.min.css +1 -1
  34. package/dist/css/tabulator_semanticui.min.css.map +1 -1
  35. package/dist/css/tabulator_simple.css +15 -8
  36. package/dist/css/tabulator_simple.css.map +1 -1
  37. package/dist/css/tabulator_simple.min.css +1 -1
  38. package/dist/css/tabulator_simple.min.css.map +1 -1
  39. package/dist/css/tabulator_site.css +15 -8
  40. package/dist/css/tabulator_site.css.map +1 -1
  41. package/dist/css/tabulator_site.min.css +1 -1
  42. package/dist/css/tabulator_site.min.css.map +1 -1
  43. package/dist/js/tabulator.js +124 -66
  44. package/dist/js/tabulator.js.map +1 -1
  45. package/dist/js/tabulator.min.js +2 -2
  46. package/dist/js/tabulator.min.js.map +1 -1
  47. package/dist/js/tabulator_esm.js +380 -329
  48. package/dist/js/tabulator_esm.js.map +1 -1
  49. package/dist/js/tabulator_esm.min.js +2 -2
  50. package/dist/js/tabulator_esm.min.js.map +1 -1
  51. package/package.json +1 -1
  52. package/src/js/core/FooterManager.js +14 -2
  53. package/src/js/core/RowManager.js +312 -279
  54. package/src/js/core/column/ColumnComponent.js +2 -0
  55. package/src/js/core/tools/InteractionMonitor.js +31 -23
  56. package/src/js/modules/ColumnCalcs/ColumnCalcs.js +2 -2
  57. package/src/js/modules/DataTree/DataTree.js +0 -1
  58. package/src/js/modules/Edit/Edit.js +2 -2
  59. package/src/js/modules/GroupRows/GroupComponent.js +1 -1
  60. package/src/js/modules/Import/Import.js +1 -3
  61. package/src/js/modules/Page/Page.js +5 -3
  62. package/src/js/modules/ResponsiveLayout/ResponsiveLayout.js +4 -4
  63. package/src/js/modules/SelectRow/SelectRow.js +1 -1
  64. package/src/scss/tabulator.scss +17 -12
@@ -1,3 +1,5 @@
1
+ import Column from './Column.js';
2
+
1
3
  //public column object
2
4
  export default class ColumnComponent {
3
5
  constructor (column){
@@ -1,5 +1,6 @@
1
1
  import CoreFeature from '../CoreFeature.js';
2
2
  import Helpers from './Helpers.js';
3
+ import Row from '../row/Row.js';
3
4
 
4
5
  export default class InteractionManager extends CoreFeature {
5
6
 
@@ -31,7 +32,7 @@ export default class InteractionManager extends CoreFeature {
31
32
  "tabulator-group":"group",
32
33
  "tabulator-col":"column",
33
34
  };
34
-
35
+
35
36
  this.pseudoTrackers = {
36
37
  "row":{
37
38
  subscriber:null,
@@ -50,12 +51,13 @@ export default class InteractionManager extends CoreFeature {
50
51
  target:null,
51
52
  },
52
53
  }
53
-
54
+
54
55
  this.pseudoTracking = false;
55
56
  }
56
57
 
57
58
  initialize(){
58
59
  this.el = this.table.element;
60
+
59
61
  this.buildListenerMap();
60
62
  this.bindSubscriptionWatchers();
61
63
  }
@@ -72,55 +74,55 @@ export default class InteractionManager extends CoreFeature {
72
74
 
73
75
  this.listeners = listenerMap;
74
76
  }
75
-
77
+
76
78
  bindPseudoEvents(){
77
79
  Object.keys(this.pseudoTrackers).forEach((key) => {
78
80
  this.pseudoTrackers[key].subscriber = this.pseudoMouseEnter.bind(this, key);
79
81
  this.subscribe(key + "-mouseover", this.pseudoTrackers[key].subscriber);
80
82
  });
81
-
83
+
82
84
  this.pseudoTracking = true;
83
85
  }
84
-
86
+
85
87
  pseudoMouseEnter(key, e, target){
86
88
  if(this.pseudoTrackers[key].target !== target){
87
89
 
88
90
  if(this.pseudoTrackers[key].target){
89
91
  this.dispatch(key + "-mouseleave", e, target);
90
92
  }
91
-
93
+
92
94
  this.pseudoMouseLeave(key, e);
93
-
95
+
94
96
  this.pseudoTrackers[key].target = target;
95
-
97
+
96
98
  this.dispatch(key + "-mouseenter", e, target);
97
99
  }
98
100
  }
99
-
101
+
100
102
  pseudoMouseLeave(key, e){
101
103
  var leaveList = Object.keys(this.pseudoTrackers),
102
104
  linkedKeys = {
103
105
  "row":["cell"],
104
106
  "cell":["row"],
105
107
  };
106
-
108
+
107
109
  leaveList = leaveList.filter((item) => {
108
110
  var links = linkedKeys[key];
109
111
  return item !== key && (!links || (links && !links.includes(item)));
110
112
  });
111
-
112
-
113
+
114
+
113
115
  leaveList.forEach((key) => {
114
116
  var target = this.pseudoTrackers[key].target;
115
-
117
+
116
118
  if(this.pseudoTrackers[key].target){
117
119
  this.dispatch(key + "-mouseleave", e, target);
118
-
120
+
119
121
  this.pseudoTrackers[key].target = null;
120
122
  }
121
123
  });
122
124
  }
123
-
125
+
124
126
 
125
127
  bindSubscriptionWatchers(){
126
128
  var listeners = Object.keys(this.listeners),
@@ -141,7 +143,7 @@ export default class InteractionManager extends CoreFeature {
141
143
  var listener = this.listeners[key].components,
142
144
  index = listener.indexOf(component),
143
145
  changed = false;
144
-
146
+
145
147
  if(added){
146
148
  if(index === -1){
147
149
  listener.push(component);
@@ -155,7 +157,7 @@ export default class InteractionManager extends CoreFeature {
155
157
  }
156
158
  }
157
159
  }
158
-
160
+
159
161
  if((key === "mouseenter" || key === "mouseleave") && !this.pseudoTracking){
160
162
  this.bindPseudoEvents();
161
163
  }
@@ -189,9 +191,9 @@ export default class InteractionManager extends CoreFeature {
189
191
 
190
192
  var targets = this.findTargets(path);
191
193
  targets = this.bindComponents(type, targets);
192
-
194
+
193
195
  this.triggerEvents(type, e, targets);
194
-
196
+
195
197
  if(this.pseudoTracking && (type == "mouseover" || type == "mouseleave") && !Object.keys(targets).length){
196
198
  this.pseudoMouseLeave("none", e);
197
199
  }
@@ -252,6 +254,10 @@ export default class InteractionManager extends CoreFeature {
252
254
  component = rows.find((row) => {
253
255
  return row.getElement() === target;
254
256
  });
257
+
258
+ if(targets["row"].parentNode && targets["row"].parentNode.closest(".tabulator-row")){
259
+ targets[key] = false;
260
+ }
255
261
  }
256
262
  break;
257
263
 
@@ -263,10 +269,12 @@ export default class InteractionManager extends CoreFeature {
263
269
 
264
270
  case "cell":
265
271
  if(listener.components.includes("cell")){
266
- if(targets["row"]){
272
+ if(targets["row"] instanceof Row){
267
273
  component = targets["row"].findCell(target);
268
- }else{
269
- console.warn("Event Target Lookup Error - The row this cell is attached to cannot be found, has the table been reinitialized without being destroyed first?")
274
+ }else{
275
+ if(targets["row"]){
276
+ console.warn("Event Target Lookup Error - The row this cell is attached to cannot be found, has the table been reinitialized without being destroyed first?")
277
+ }
270
278
  }
271
279
  }
272
280
  break;
@@ -300,7 +308,7 @@ export default class InteractionManager extends CoreFeature {
300
308
  clearWatchers(){
301
309
  for(let key in this.listeners){
302
310
  let listener = this.listeners[key];
303
-
311
+
304
312
  if(listener.handler){
305
313
  this.el.removeEventListener(key, listener.handler)
306
314
  listener.handler = null;
@@ -331,12 +331,12 @@ class ColumnCalcs extends Module{
331
331
 
332
332
  rowsToData(rows){
333
333
  var data = [];
334
-
334
+
335
335
  rows.forEach((row) => {
336
336
  data.push(row.getData());
337
337
 
338
338
  if(this.table.options.dataTree && this.table.options.dataTreeChildColumnCalcs){
339
- if(row.modules.dataTree.open){
339
+ if(row.modules.dataTree && row.modules.dataTree.open){
340
340
  var children = this.rowsToData(this.table.modules.dataTree.getFilteredTreeChildren(row));
341
341
  data = data.concat(children);
342
342
  }
@@ -579,7 +579,6 @@ class DataTree extends Module{
579
579
  }
580
580
 
581
581
  redrawNeeded(data){
582
- console.log("needed?", data)
583
582
  return (this.field ? typeof data[this.field] !== "undefined" : false) || (this.elementField ? typeof data[this.elementField] !== "undefined" : false);
584
583
  }
585
584
  }
@@ -52,7 +52,7 @@ class Edit extends Module{
52
52
  this.subscribe("column-layout", this.initializeColumnCheck.bind(this));
53
53
  this.subscribe("column-delete", this.columnDeleteCheck.bind(this));
54
54
  this.subscribe("row-deleting", this.rowDeleteCheck.bind(this));
55
- this.subscribe("data-refeshing", this.cancelEdit.bind(this));
55
+ this.subscribe("data-refreshing", this.cancelEdit.bind(this));
56
56
 
57
57
  this.subscribe("keybinding-nav-prev", this.navigatePrev.bind(this, undefined));
58
58
  this.subscribe("keybinding-nav-next", this.keybindingNavigateNext.bind(this));
@@ -74,7 +74,7 @@ class Edit extends Module{
74
74
  if(cell){
75
75
  if(!this.navigateNext(cell, e)){
76
76
  if(newRow){
77
- // cell.getElement().firstChild.blur();
77
+ cell.getElement().firstChild.blur();
78
78
 
79
79
  if(newRow === true){
80
80
  newRow = this.table.addRow({})
@@ -9,7 +9,7 @@ class GroupComponent {
9
9
  if (typeof target[name] !== "undefined") {
10
10
  return target[name];
11
11
  }else{
12
- return target._group.table.componentFunctionBinder.handle("row", target._group, name)
12
+ return target._group.groupManager.table.componentFunctionBinder.handle("row", target._group, name)
13
13
  }
14
14
  }
15
15
  })
@@ -123,9 +123,7 @@ class Import extends Module{
123
123
 
124
124
  structureData(parsedData){
125
125
  var data = [];
126
-
127
- console.log("structure", parsedData)
128
-
126
+
129
127
  if(Array.isArray(parsedData) && parsedData.length && Array.isArray(parsedData[0])){
130
128
  if(this.table.options.autoColumns){
131
129
  data = this.structureArrayToObject(parsedData);
@@ -828,9 +828,11 @@ class Page extends Module{
828
828
  margin = this.table.options.progressiveLoadScrollMargin || (this.table.rowManager.element.clientHeight * 2);
829
829
 
830
830
  if(this.table.rowManager.element.scrollHeight <= (this.table.rowManager.element.clientHeight + margin)){
831
- setTimeout(() => {
832
- this.nextPage();
833
- });
831
+ if(this.page < this.max){
832
+ setTimeout(() => {
833
+ this.nextPage();
834
+ });
835
+ }
834
836
  }
835
837
  break;
836
838
  }
@@ -61,14 +61,14 @@ class ResponsiveLayout extends Module{
61
61
  this.hiddenColumns = [];
62
62
 
63
63
  //determine level of responsivity for each column
64
- this.table.columnManager.columnsByIndex.forEach(function(column, i){
64
+ this.table.columnManager.columnsByIndex.forEach((column, i) => {
65
65
  if(column.modules.responsive){
66
66
  if(column.modules.responsive.order && column.modules.responsive.visible){
67
67
  column.modules.responsive.index = i;
68
68
  columns.push(column);
69
69
 
70
- if(!column.visible && self.mode === "collapse"){
71
- self.hiddenColumns.push(column);
70
+ if(!column.visible && this.mode === "collapse"){
71
+ this.hiddenColumns.push(column);
72
72
  }
73
73
  }
74
74
  }
@@ -76,7 +76,7 @@ class ResponsiveLayout extends Module{
76
76
 
77
77
  //sort list by responsivity
78
78
  columns = columns.reverse();
79
- columns = columns.sort(function(a, b){
79
+ columns = columns.sort((a, b) => {
80
80
  var diff = b.modules.responsive.order - a.modules.responsive.order;
81
81
  return diff || (b.modules.responsive.index - a.modules.responsive.index);
82
82
  });
@@ -38,7 +38,7 @@ class SelectRow extends Module{
38
38
  this.subscribe("rows-retrieve", this.rowRetrieve.bind(this));
39
39
 
40
40
  if(this.table.options.selectable && !this.table.options.selectablePersistence){
41
- this.subscribe("data-refeshing", this.deselectRows.bind(this));
41
+ this.subscribe("data-refreshing", this.deselectRows.bind(this));
42
42
  }
43
43
  }
44
44
  }
@@ -392,15 +392,17 @@ $footerActiveColor:#d00 !default; //footer bottom active text color
392
392
 
393
393
  width:100%;
394
394
 
395
- span{
395
+ .tabulator-placeholder-contents {
396
396
  display: inline-block;
397
+ text-align: center;
397
398
 
398
- margin:0 auto;
399
399
  padding:10px;
400
400
 
401
401
  color:#ccc;
402
402
  font-weight: bold;
403
403
  font-size: 20px;
404
+
405
+ white-space: normal;
404
406
  }
405
407
  }
406
408
 
@@ -432,17 +434,8 @@ $footerActiveColor:#d00 !default; //footer bottom active text color
432
434
  }
433
435
  }
434
436
 
435
-
436
-
437
437
  //footer element
438
438
  .tabulator-footer{
439
- display: flex;
440
- flex-direction: row;
441
- align-items: center;
442
- justify-content: space-between;
443
-
444
- padding:5px 10px;
445
-
446
439
  border-top:1px solid $footerSeperatorColor;
447
440
  background-color: $footerBackgroundColor;
448
441
 
@@ -456,10 +449,22 @@ $footerActiveColor:#d00 !default; //footer bottom active text color
456
449
  -webkit-user-select: none;
457
450
  -o-user-select: none;
458
451
 
452
+ .tabulator-footer-contents {
453
+ display: flex;
454
+ flex-direction: row;
455
+ align-items: center;
456
+ justify-content: space-between;
457
+
458
+ padding:5px 10px;
459
+
460
+ &:empty{
461
+ display: none;
462
+ }
463
+ }
464
+
459
465
  .tabulator-calcs-holder{
460
466
  box-sizing:border-box;
461
467
  width:calc(100% + 20px);
462
- margin:-5px -10px 5px -10px;
463
468
 
464
469
  text-align: left;
465
470