tabulator-tables 5.0.3 → 5.0.8

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 (57) hide show
  1. package/bower.json +1 -1
  2. package/build/rollup.js +1 -1
  3. package/dist/css/tabulator_bootstrap3.css +9 -0
  4. package/dist/css/tabulator_bootstrap3.css.map +1 -1
  5. package/dist/css/tabulator_bootstrap3.min.css +1 -1
  6. package/dist/css/tabulator_bootstrap3.min.css.map +1 -1
  7. package/dist/css/tabulator_bulma.css +5 -1
  8. package/dist/css/tabulator_bulma.css.map +1 -1
  9. package/dist/css/tabulator_bulma.min.css +1 -1
  10. package/dist/css/tabulator_bulma.min.css.map +1 -1
  11. package/dist/css/tabulator_semanticui.css +11 -2
  12. package/dist/css/tabulator_semanticui.css.map +1 -1
  13. package/dist/css/tabulator_semanticui.min.css +1 -1
  14. package/dist/css/tabulator_semanticui.min.css.map +1 -1
  15. package/dist/js/tabulator.js +456 -307
  16. package/dist/js/tabulator.js.map +1 -1
  17. package/dist/js/tabulator.min.js +2 -2
  18. package/dist/js/tabulator.min.js.map +1 -1
  19. package/dist/js/tabulator_esm.js +483 -354
  20. package/dist/js/tabulator_esm.js.map +1 -1
  21. package/dist/js/tabulator_esm.min.js +2 -2
  22. package/dist/js/tabulator_esm.min.js.map +1 -1
  23. package/package.json +1 -1
  24. package/src/js/core/ColumnManager.js +18 -17
  25. package/src/js/core/RowManager.js +5 -3
  26. package/src/js/core/Tabulator.js +180 -125
  27. package/src/js/core/column/Column.js +2 -2
  28. package/src/js/core/tools/{ComponentFuctionBinder.js → ComponentFunctionBinder.js} +1 -1
  29. package/src/js/core/tools/Helpers.js +19 -13
  30. package/src/js/core/tools/InteractionMonitor.js +4 -1
  31. package/src/js/core/tools/OptionsList.js +2 -2
  32. package/src/js/modules/Ajax/defaults/contentTypeFormatters.js +22 -1
  33. package/src/js/modules/ColumnCalcs/ColumnCalcs.js +1 -1
  34. package/src/js/modules/DataTree/DataTree.js +1 -1
  35. package/src/js/modules/Edit/Edit.js +7 -6
  36. package/src/js/modules/Edit/defaults/editors/progress.js +2 -2
  37. package/src/js/modules/Filter/Filter.js +9 -4
  38. package/src/js/modules/Format/defaults/formatters/datetime.js +2 -2
  39. package/src/js/modules/Format/defaults/formatters/datetimediff.js +1 -1
  40. package/src/js/modules/Format/defaults/formatters/money.js +8 -1
  41. package/src/js/modules/FrozenColumns/FrozenColumns.js +21 -0
  42. package/src/js/modules/FrozenRows/FrozenRows.js +4 -1
  43. package/src/js/modules/GroupRows/Group.js +10 -4
  44. package/src/js/modules/GroupRows/GroupRows.js +41 -29
  45. package/src/js/modules/History/History.js +3 -1
  46. package/src/js/modules/History/defaults/redoers.js +1 -0
  47. package/src/js/modules/History/defaults/undoers.js +1 -0
  48. package/src/js/modules/HtmlTableImport/HtmlTableImport.js +8 -29
  49. package/src/js/modules/MoveColumns/MoveColumns.js +64 -61
  50. package/src/js/modules/Page/Page.js +2 -1
  51. package/src/js/modules/ResponsiveLayout/ResponsiveLayout.js +5 -1
  52. package/src/js/modules/SelectRow/SelectRow.js +3 -3
  53. package/src/js/modules/Sort/Sort.js +1 -1
  54. package/src/js/modules/Sort/defaults/sorters/datetime.js +3 -2
  55. package/src/scss/themes/bootstrap/tabulator_bootstrap3.scss +9 -0
  56. package/src/scss/themes/bulma/tabulator_bulma.scss +5 -1
  57. package/src/scss/themes/semanticui/tabulator_semanticui.scss +12 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tabulator-tables",
3
- "version": "5.0.3",
3
+ "version": "5.0.8",
4
4
  "description": "Interactive table generation JavaScript library",
5
5
  "style": "dist/css/tabulator.css",
6
6
  "main": "dist/js/tabulator.js",
@@ -7,6 +7,8 @@ import OptionsList from './tools/OptionsList.js';
7
7
  import RendererBasicHorizontal from './rendering/renderers/BasicHorizontal.js';
8
8
  import RendererVirtualDomHorizontal from './rendering/renderers/VirtualDomHorizontal.js';
9
9
 
10
+ import defaultColumnOptions from './column/defaults/options.js';
11
+
10
12
  export default class ColumnManager extends CoreFeature {
11
13
 
12
14
  constructor (table){
@@ -19,7 +21,7 @@ export default class ColumnManager extends CoreFeature {
19
21
  this.columnsByIndex = []; //columns by index
20
22
  this.columnsByField = {}; //columns by field
21
23
  this.scrollLeft = 0;
22
- this.optionsList = new OptionsList(this.table, "column definition");
24
+ this.optionsList = new OptionsList(this.table, "column definition", defaultColumnOptions);
23
25
 
24
26
  this.renderer = null;
25
27
  }
@@ -64,6 +66,7 @@ export default class ColumnManager extends CoreFeature {
64
66
  var el = document.createElement("div");
65
67
 
66
68
  el.classList.add("tabulator-headers");
69
+ el.setAttribute("role", "row");
67
70
 
68
71
  return el;
69
72
  }
@@ -72,6 +75,7 @@ export default class ColumnManager extends CoreFeature {
72
75
  var el = document.createElement("div");
73
76
 
74
77
  el.classList.add("tabulator-header");
78
+ el.setAttribute("role", "rowgroup");
75
79
 
76
80
  if(!this.table.options.headerVisible){
77
81
  el.classList.add("tabulator-header-hidden");
@@ -230,9 +234,9 @@ export default class ColumnManager extends CoreFeature {
230
234
  index = nextToColumn ? this.findColumnIndex(nextToColumn) : nextToColumn;
231
235
 
232
236
  if(nextToColumn && index > -1){
233
-
234
- var parentIndex = this.columns.indexOf(nextToColumn.getTopColumn());
235
- var nextEl = nextToColumn.getElement();
237
+ var topColumn = nextToColumn.getTopColumn()
238
+ var parentIndex = this.columns.indexOf(topColumn);
239
+ var nextEl = topColumn.getElement();
236
240
 
237
241
  if(before){
238
242
  this.columns.splice(parentIndex, 0, column);
@@ -241,7 +245,6 @@ export default class ColumnManager extends CoreFeature {
241
245
  this.columns.splice(parentIndex + 1, 0, column);
242
246
  nextEl.parentNode.insertBefore(colEl, nextEl.nextSibling);
243
247
  }
244
-
245
248
  }else{
246
249
  if(before){
247
250
  this.columns.unshift(column);
@@ -250,10 +253,10 @@ export default class ColumnManager extends CoreFeature {
250
253
  this.columns.push(column);
251
254
  this.headersElement.appendChild(column.getElement());
252
255
  }
253
-
254
- column.columnRendered();
255
256
  }
256
257
 
258
+ column.columnRendered();
259
+
257
260
  return column;
258
261
  }
259
262
 
@@ -276,7 +279,7 @@ export default class ColumnManager extends CoreFeature {
276
279
  }
277
280
 
278
281
  //ensure column headers take up the correct amount of space in column groups
279
- _verticalAlignHeaders(){
282
+ verticalAlignHeaders(){
280
283
  var minHeight = 0;
281
284
 
282
285
  this.columns.forEach((column) => {
@@ -433,7 +436,7 @@ export default class ColumnManager extends CoreFeature {
433
436
  to.element.parentNode.insertBefore(to.element, from.element);
434
437
  }
435
438
 
436
- this._verticalAlignHeaders();
439
+ this.verticalAlignHeaders();
437
440
 
438
441
  this.table.rowManager.reinitialize();
439
442
  }
@@ -608,13 +611,11 @@ export default class ColumnManager extends CoreFeature {
608
611
 
609
612
  this.dispatch("column-add", definition, before, nextToColumn);
610
613
 
611
- this.redraw(true);
612
-
613
614
  if(this.layoutMode() != "fitColumns"){
614
615
  column.reinitializeWidth();
615
616
  }
616
617
 
617
- this._verticalAlignHeaders();
618
+ this.redraw(true);
618
619
 
619
620
  this.table.rowManager.reinitialize();
620
621
 
@@ -648,18 +649,18 @@ export default class ColumnManager extends CoreFeature {
648
649
  this.columns.splice(index, 1);
649
650
  }
650
651
 
651
- this._verticalAlignHeaders();
652
+ this.verticalAlignHeaders();
652
653
 
653
654
  this.redraw();
654
655
  }
655
656
 
656
657
  //redraw columns
657
658
  redraw(force){
658
- if(force){
659
- if(Helpers.elVisible(this.element)){
660
- this._verticalAlignHeaders();
661
- }
659
+ if(Helpers.elVisible(this.element)){
660
+ this.verticalAlignHeaders();
661
+ }
662
662
 
663
+ if(force){
663
664
  this.table.rowManager.resetScroll();
664
665
  this.table.rowManager.reinitialize();
665
666
  }
@@ -49,6 +49,7 @@ export default class RowManager extends CoreFeature{
49
49
 
50
50
  el.classList.add("tabulator-tableholder");
51
51
  el.setAttribute("tabindex", 0);
52
+ el.setAttribute("role", "rowgroup");
52
53
 
53
54
  return el;
54
55
  }
@@ -57,6 +58,7 @@ export default class RowManager extends CoreFeature{
57
58
  var el = document.createElement("div");
58
59
 
59
60
  el.classList.add("tabulator-table");
61
+ el.setAttribute("role", "rowgroup");
60
62
 
61
63
  return el;
62
64
  }
@@ -305,7 +307,7 @@ export default class RowManager extends CoreFeature{
305
307
  this.dispatch("row-added", row, data, pos, index);
306
308
  });
307
309
 
308
- this.reRenderInPosition();
310
+ this.refreshActiveData(false, false, true);
309
311
 
310
312
  this.regenerateRowNumbers();
311
313
 
@@ -853,13 +855,13 @@ export default class RowManager extends CoreFeature{
853
855
  }
854
856
 
855
857
  renderTable(){
856
-
857
858
  this.dispatchExternal("renderStarted");
858
859
 
859
860
  this.element.scrollTop = 0;
860
861
 
862
+ this._clearTable();
863
+
861
864
  if(this.displayRowsCount){
862
- this._clearTable();
863
865
  this.renderer.renderRows();
864
866
 
865
867
  if(this.firstRender){
@@ -7,7 +7,7 @@ import RowManager from './RowManager.js';
7
7
  import FooterManager from './FooterManager.js';
8
8
 
9
9
  import InteractionMonitor from './tools/InteractionMonitor.js';
10
- import ComponentFuctionBinder from './tools/ComponentFuctionBinder.js';
10
+ import ComponentFunctionBinder from './tools/ComponentFunctionBinder.js';
11
11
  import DataLoader from './tools/DataLoader.js';
12
12
 
13
13
  import ExternalEventBus from './tools/ExternalEventBus.js';
@@ -33,10 +33,11 @@ class Tabulator {
33
33
  this.interactionMonitor = false; //track user interaction
34
34
  this.browser = ""; //hold current browser type
35
35
  this.browserSlow = false; //handle reduced functionality for slower browsers
36
- this.browserMobile = false; //check if running on moble, prevent resize cancelling edit on keyboard appearence
36
+ this.browserMobile = false; //check if running on mobile, prevent resize cancelling edit on keyboard appearance
37
37
  this.rtl = false; //check if the table is in RTL mode
38
+ this.originalElement = null; //hold original table element if it has been replaced
38
39
 
39
- this.componentFunctionBinder = new ComponentFuctionBinder(this); //bind component functions
40
+ this.componentFunctionBinder = new ComponentFunctionBinder(this); //bind component functions
40
41
  this.dataLoader = false; //bind component functions
41
42
 
42
43
  this.modules = {}; //hold all modules bound to this table
@@ -51,13 +52,13 @@ class Tabulator {
51
52
 
52
53
  this.initialzeCoreSystems(options);
53
54
 
54
- //delay table creation to allow event bindings immediatly after the constructor
55
+ //delay table creation to allow event bindings immediately after the constructor
55
56
  setTimeout(() => {
56
57
  this._create();
57
58
  })
58
59
  }
59
60
 
60
- TableRegistry.register(this); //register table for inderdevice communication
61
+ TableRegistry.register(this); //register table for inter-device communication
61
62
  }
62
63
 
63
64
  initializeElement(element){
@@ -91,7 +92,7 @@ class Tabulator {
91
92
 
92
93
  this._clearObjectPointers();
93
94
 
94
- this._mapDepricatedFunctionality();
95
+ this._mapDeprecatedFunctionality();
95
96
 
96
97
  this.externalEvents = new ExternalEventBus(this, this.options, this.options.debugEventsExternal);
97
98
  this.eventBus = new InternalEventBus(this.options.debugEventsInternal);
@@ -104,30 +105,8 @@ class Tabulator {
104
105
  this.footerManager.initialize();
105
106
  }
106
107
 
107
- rtlCheck(){
108
- var style = window.getComputedStyle(this.element);
109
-
110
- switch(this.options.textDirection){
111
- case"auto":
112
- if(style.direction !== "rtl"){
113
- break;
114
- };
115
-
116
- case "rtl":
117
- this.element.classList.add("tabulator-rtl");
118
- this.rtl = true;
119
- break;
120
-
121
- case "ltr":
122
- this.element.classList.add("tabulator-ltr");
123
-
124
- default:
125
- this.rtl = false;
126
- }
127
- }
128
-
129
- //convert depricated functionality to new functions
130
- _mapDepricatedFunctionality(){
108
+ //convert deprecated functionality to new functions
109
+ _mapDeprecatedFunctionality(){
131
110
  //all previously deprecated functionality removed in the 5.0 release
132
111
  }
133
112
 
@@ -148,15 +127,17 @@ class Tabulator {
148
127
  this.element.classList.remove("tabulator-block-select");
149
128
  }
150
129
 
151
- //concreate table
130
+ //create table
152
131
  _create(){
153
132
  this.externalEvents.dispatch("tableBuilding");
154
133
  this.eventBus.dispatch("table-building");
155
134
 
156
- this.rtlCheck();
135
+ this._rtlCheck();
157
136
 
158
137
  this._buildElement();
159
138
 
139
+ this._initializeTable();
140
+
160
141
  this._loadInitialData();
161
142
 
162
143
  this.initialized = true;
@@ -164,6 +145,28 @@ class Tabulator {
164
145
  this.externalEvents.dispatch("tableBuilt");
165
146
  }
166
147
 
148
+ _rtlCheck(){
149
+ var style = window.getComputedStyle(this.element);
150
+
151
+ switch(this.options.textDirection){
152
+ case"auto":
153
+ if(style.direction !== "rtl"){
154
+ break;
155
+ };
156
+
157
+ case "rtl":
158
+ this.element.classList.add("tabulator-rtl");
159
+ this.rtl = true;
160
+ break;
161
+
162
+ case "ltr":
163
+ this.element.classList.add("tabulator-ltr");
164
+
165
+ default:
166
+ this.rtl = false;
167
+ }
168
+ }
169
+
167
170
  //clear pointers to objects in default config object
168
171
  _clearObjectPointers(){
169
172
  this.options.columns = this.options.columns.slice(0);
@@ -176,7 +179,28 @@ class Tabulator {
176
179
  //build tabulator element
177
180
  _buildElement(){
178
181
  var element = this.element,
179
- options = this.options;
182
+ options = this.options,
183
+ newElement;
184
+
185
+ if(element.tagName === "TABLE"){
186
+ this.originalElement = this.element;
187
+ newElement = document.createElement("div");
188
+
189
+ //transfer attributes to new element
190
+ var attributes = element.attributes;
191
+
192
+ // loop through attributes and apply them on div
193
+ for(var i in attributes){
194
+ if(typeof attributes[i] == "object"){
195
+ newElement.setAttribute(attributes[i].name, attributes[i].value);
196
+ }
197
+ }
198
+
199
+ // replace table with div element
200
+ element.parentNode.replaceChild(newElement, element);
201
+
202
+ this.element = element = newElement;
203
+ }
180
204
 
181
205
  element.classList.add("tabulator");
182
206
  element.setAttribute("role", "grid");
@@ -201,6 +225,14 @@ class Tabulator {
201
225
  options.maxHeight = isNaN(options.maxHeight) ? options.maxHeight : options.maxHeight + "px";
202
226
  element.style.maxHeight = options.maxHeight;
203
227
  }
228
+ }
229
+
230
+ //initialize core systems and modules
231
+ _initializeTable(){
232
+ var element = this.element,
233
+ options = this.options;
234
+
235
+ this.interactionMonitor.initialize();
204
236
 
205
237
  this.columnManager.initialize();
206
238
  this.rowManager.initialize();
@@ -216,7 +248,6 @@ class Tabulator {
216
248
 
217
249
  //configure placeholder element
218
250
  if(typeof options.placeholder == "string"){
219
-
220
251
  var el = document.createElement("div");
221
252
  el.classList.add("tabulator-placeholder");
222
253
 
@@ -261,7 +292,7 @@ class Tabulator {
261
292
  destroy(){
262
293
  var element = this.element;
263
294
 
264
- TableRegistry.deregister(this); //deregister table from inderdevice communication
295
+ TableRegistry.deregister(this); //deregister table from inter-device communication
265
296
 
266
297
  this.eventBus.dispatch("table-destroy");
267
298
 
@@ -380,68 +411,80 @@ class Tabulator {
380
411
 
381
412
  //replace data, keeping table in position with same sort
382
413
  replaceData(data, params, config){
383
- return this.dataLoader.load(data, params, config, true, true);
414
+ if(this.initialized){
415
+ return this.dataLoader.load(data, params, config, true, true);
416
+ }else{
417
+ console.warn("replaceData failed - table not yet initialized. Please wait for the `tableBuilt` event before calling this function.");
418
+ }
384
419
  }
385
420
 
386
421
  //update table data
387
422
  updateData(data){
388
423
  var responses = 0;
389
424
 
390
- return new Promise((resolve, reject) => {
391
- this.dataLoader.blockActiveLoad();
425
+ if(this.initialized){
426
+ return new Promise((resolve, reject) => {
427
+ this.dataLoader.blockActiveLoad();
392
428
 
393
- if(typeof data === "string"){
394
- data = JSON.parse(data);
395
- }
429
+ if(typeof data === "string"){
430
+ data = JSON.parse(data);
431
+ }
396
432
 
397
- if(data){
398
- data.forEach((item) => {
399
- var row = this.rowManager.findRow(item[this.options.index]);
433
+ if(data){
434
+ data.forEach((item) => {
435
+ var row = this.rowManager.findRow(item[this.options.index]);
400
436
 
401
- if(row){
402
- responses++;
437
+ if(row){
438
+ responses++;
403
439
 
404
- row.updateData(item)
405
- .then(()=>{
406
- responses--;
440
+ row.updateData(item)
441
+ .then(()=>{
442
+ responses--;
407
443
 
408
- if(!responses){
409
- resolve();
410
- }
411
- });
412
- }
413
- });
414
- }else{
415
- console.warn("Update Error - No data provided");
416
- reject("Update Error - No data provided");
417
- }
418
- });
444
+ if(!responses){
445
+ resolve();
446
+ }
447
+ });
448
+ }
449
+ });
450
+ }else{
451
+ console.warn("Update Error - No data provided");
452
+ reject("Update Error - No data provided");
453
+ }
454
+ });
455
+ }else{
456
+ console.warn("updateData failed - table not yet initialized. Please wait for the `tableBuilt` event before calling this function.");
457
+ }
419
458
  }
420
459
 
421
460
  addData(data, pos, index){
422
- return new Promise((resolve, reject) => {
423
- this.dataLoader.blockActiveLoad();
461
+ if(this.initialized){
462
+ return new Promise((resolve, reject) => {
463
+ this.dataLoader.blockActiveLoad();
424
464
 
425
- if(typeof data === "string"){
426
- data = JSON.parse(data);
427
- }
465
+ if(typeof data === "string"){
466
+ data = JSON.parse(data);
467
+ }
428
468
 
429
- if(data){
430
- this.rowManager.addRows(data, pos, index)
431
- .then((rows) => {
432
- var output = [];
469
+ if(data){
470
+ this.rowManager.addRows(data, pos, index)
471
+ .then((rows) => {
472
+ var output = [];
433
473
 
434
- rows.forEach(function(row){
435
- output.push(row.getComponent());
436
- });
474
+ rows.forEach(function(row){
475
+ output.push(row.getComponent());
476
+ });
437
477
 
438
- resolve(output);
439
- });
440
- }else{
441
- console.warn("Update Error - No data provided");
442
- reject("Update Error - No data provided");
443
- }
444
- });
478
+ resolve(output);
479
+ });
480
+ }else{
481
+ console.warn("Update Error - No data provided");
482
+ reject("Update Error - No data provided");
483
+ }
484
+ });
485
+ }else{
486
+ console.warn("addData failed - table not yet initialized. Please wait for the `tableBuilt` event before calling this function.");
487
+ }
445
488
  }
446
489
 
447
490
  //update table data
@@ -449,46 +492,50 @@ class Tabulator {
449
492
  var rows = [],
450
493
  responses = 0;
451
494
 
452
- return new Promise((resolve, reject) => {
453
- this.dataLoader.blockActiveLoad();
454
-
455
- if(typeof data === "string"){
456
- data = JSON.parse(data);
457
- }
495
+ if(this.initialized){
496
+ return new Promise((resolve, reject) => {
497
+ this.dataLoader.blockActiveLoad();
458
498
 
459
- if(data){
460
- data.forEach((item) => {
461
- var row = this.rowManager.findRow(item[this.options.index]);
499
+ if(typeof data === "string"){
500
+ data = JSON.parse(data);
501
+ }
462
502
 
463
- responses++;
503
+ if(data){
504
+ data.forEach((item) => {
505
+ var row = this.rowManager.findRow(item[this.options.index]);
464
506
 
465
- if(row){
466
- row.updateData(item)
467
- .then(()=>{
468
- responses--;
469
- rows.push(row.getComponent());
507
+ responses++;
470
508
 
471
- if(!responses){
472
- resolve(rows);
473
- }
474
- });
475
- }else{
476
- this.rowManager.addRows(item)
477
- .then((newRows)=>{
478
- responses--;
479
- rows.push(newRows[0].getComponent());
480
-
481
- if(!responses){
482
- resolve(rows);
483
- }
484
- });
485
- }
486
- });
487
- }else{
488
- console.warn("Update Error - No data provided");
489
- reject("Update Error - No data provided");
490
- }
491
- });
509
+ if(row){
510
+ row.updateData(item)
511
+ .then(()=>{
512
+ responses--;
513
+ rows.push(row.getComponent());
514
+
515
+ if(!responses){
516
+ resolve(rows);
517
+ }
518
+ });
519
+ }else{
520
+ this.rowManager.addRows(item)
521
+ .then((newRows)=>{
522
+ responses--;
523
+ rows.push(newRows[0].getComponent());
524
+
525
+ if(!responses){
526
+ resolve(rows);
527
+ }
528
+ });
529
+ }
530
+ });
531
+ }else{
532
+ console.warn("Update Error - No data provided");
533
+ reject("Update Error - No data provided");
534
+ }
535
+ });
536
+ }else{
537
+ console.warn("updateOrAddData failed - table not yet initialized. Please wait for the `tableBuilt` event before calling this function.");
538
+ }
492
539
  }
493
540
 
494
541
  //get row object
@@ -553,14 +600,18 @@ class Tabulator {
553
600
 
554
601
  //add row to table
555
602
  addRow(data, pos, index){
556
- if(typeof data === "string"){
557
- data = JSON.parse(data);
558
- }
603
+ if(this.initialized){
604
+ if(typeof data === "string"){
605
+ data = JSON.parse(data);
606
+ }
559
607
 
560
- return this.rowManager.addRows(data, pos, index)
561
- .then((rows)=>{
562
- return rows[0].getComponent();
563
- });
608
+ return this.rowManager.addRows(data, pos, index)
609
+ .then((rows)=>{
610
+ return rows[0].getComponent();
611
+ });
612
+ }else{
613
+ console.warn("addRow failed - table not yet initialized. Please wait for the `tableBuilt` event before calling this function.");
614
+ }
564
615
  }
565
616
 
566
617
  //update a row if it exitsts otherwise create it
@@ -595,7 +646,7 @@ class Tabulator {
595
646
  if(row){
596
647
  return row.updateData(data)
597
648
  .then(()=>{
598
- resolve(row.getComponent());
649
+ return Promise.resolve(row.getComponent());
599
650
  })
600
651
  }else{
601
652
  console.warn("Update Error - No matching row found:", index);
@@ -769,8 +820,12 @@ class Tabulator {
769
820
  //////////// General Public Functions ////////////
770
821
  //redraw list without updating data
771
822
  redraw(force){
772
- this.columnManager.redraw(force);
773
- this.rowManager.redraw(force);
823
+ if(this.initialized){
824
+ this.columnManager.redraw(force);
825
+ this.rowManager.redraw(force);
826
+ }else{
827
+ console.warn("redraw failed - table not yet initialized. Please wait for the `tableBuilt` event before calling this function.");
828
+ }
774
829
  }
775
830
 
776
831
  setHeight(height){
@@ -668,7 +668,7 @@ class Column extends CoreFeature{
668
668
  this.reinitializeWidth();
669
669
  }
670
670
 
671
- this.table.columnManager._verticalAlignHeaders();
671
+ this.table.columnManager.verticalAlignHeaders();
672
672
 
673
673
  this.dispatch("column-show", this, responsiveToggle);
674
674
 
@@ -693,7 +693,7 @@ class Column extends CoreFeature{
693
693
 
694
694
  this.element.style.display = "none";
695
695
 
696
- this.table.columnManager._verticalAlignHeaders();
696
+ this.table.columnManager.verticalAlignHeaders();
697
697
 
698
698
  if(this.parent.isGroup){
699
699
  this.parent.checkColumnVisibility();
@@ -1,4 +1,4 @@
1
- export default class ComponentFuctionBinder{
1
+ export default class ComponentFunctionBinder{
2
2
 
3
3
  constructor(table){
4
4
  this.table = table;
@@ -13,25 +13,31 @@ export default class Helpers{
13
13
  };
14
14
  }
15
15
 
16
- static deepClone(obj, clone, list = {}){
16
+ static deepClone(obj, clone, list = []){
17
+ var objectProto = {}.__proto__,
18
+ arrayProto = [].__proto__;
19
+
17
20
  if (!clone){
18
21
  clone = Object.assign(Array.isArray(obj) ? [] : {}, obj);
19
22
  }
20
23
 
21
24
  for(var i in obj) {
22
- let subject = obj[i];
23
-
24
- if(subject != null && typeof(subject) === "object"){
25
- if (subject instanceof Date) {
26
- clone[i] = new Date(subject);
27
- } else {
28
- if(list[subject]){
29
- clone[i] = list[subject];
30
- }else{
31
- list[subject] = Object.assign(Array.isArray(obj) ? [] : {}, obj);
32
- clone[i] = this.deepClone(subject, list[subject], list);
33
- }
25
+ let subject = obj[i],
26
+ match, copy;
27
+
28
+ if(subject != null && typeof subject === "object" && (subject.__proto__ === objectProto || subject.__proto__ === arrayProto)){
29
+ match = list.findIndex((item) => {
30
+ return item.subject === subject;
31
+ });
32
+
33
+ if(match > -1){
34
+ clone[i] = list[match].copy;
35
+ }else{
36
+ copy = Object.assign(Array.isArray(subject) ? [] : {}, subject);
37
+
38
+ list.unshift({subject, copy});
34
39
 
40
+ clone[i] = this.deepClone(subject, copy, list);
35
41
  }
36
42
  }
37
43
  }