tabulator-tables 5.2.7 → 5.3.0

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 (214) hide show
  1. package/.eslintignore +3 -0
  2. package/.eslintrc.js +28 -0
  3. package/.github/workflows/bad-files-check.yml +39 -0
  4. package/.github/workflows/lint-and-test.yml +31 -0
  5. package/README.md +3 -3
  6. package/bower.json +1 -1
  7. package/build/Bundler.js +77 -77
  8. package/dist/css/tabulator.css +12 -7
  9. package/dist/css/tabulator.css.map +1 -1
  10. package/dist/css/tabulator.min.css +1 -1
  11. package/dist/css/tabulator.min.css.map +1 -1
  12. package/dist/css/tabulator_bootstrap3.css +12 -7
  13. package/dist/css/tabulator_bootstrap3.css.map +1 -1
  14. package/dist/css/tabulator_bootstrap3.min.css +1 -1
  15. package/dist/css/tabulator_bootstrap3.min.css.map +1 -1
  16. package/dist/css/tabulator_bootstrap4.css +12 -7
  17. package/dist/css/tabulator_bootstrap4.css.map +1 -1
  18. package/dist/css/tabulator_bootstrap4.min.css +1 -1
  19. package/dist/css/tabulator_bootstrap4.min.css.map +1 -1
  20. package/dist/css/tabulator_bootstrap5.css +12 -7
  21. package/dist/css/tabulator_bootstrap5.css.map +1 -1
  22. package/dist/css/tabulator_bootstrap5.min.css +1 -1
  23. package/dist/css/tabulator_bootstrap5.min.css.map +1 -1
  24. package/dist/css/tabulator_bulma.css +12 -7
  25. package/dist/css/tabulator_bulma.css.map +1 -1
  26. package/dist/css/tabulator_bulma.min.css +1 -1
  27. package/dist/css/tabulator_bulma.min.css.map +1 -1
  28. package/dist/css/tabulator_materialize.css +12 -7
  29. package/dist/css/tabulator_materialize.css.map +1 -1
  30. package/dist/css/tabulator_materialize.min.css +1 -1
  31. package/dist/css/tabulator_materialize.min.css.map +1 -1
  32. package/dist/css/tabulator_midnight.css +12 -7
  33. package/dist/css/tabulator_midnight.css.map +1 -1
  34. package/dist/css/tabulator_midnight.min.css +1 -1
  35. package/dist/css/tabulator_midnight.min.css.map +1 -1
  36. package/dist/css/tabulator_modern.css +12 -7
  37. package/dist/css/tabulator_modern.css.map +1 -1
  38. package/dist/css/tabulator_modern.min.css +1 -1
  39. package/dist/css/tabulator_modern.min.css.map +1 -1
  40. package/dist/css/tabulator_semanticui.css +12 -7
  41. package/dist/css/tabulator_semanticui.css.map +1 -1
  42. package/dist/css/tabulator_semanticui.min.css +1 -1
  43. package/dist/css/tabulator_semanticui.min.css.map +1 -1
  44. package/dist/css/tabulator_simple.css +12 -7
  45. package/dist/css/tabulator_simple.css.map +1 -1
  46. package/dist/css/tabulator_simple.min.css +1 -1
  47. package/dist/css/tabulator_simple.min.css.map +1 -1
  48. package/dist/css/tabulator_site.css +12 -7
  49. package/dist/css/tabulator_site.css.map +1 -1
  50. package/dist/css/tabulator_site.min.css +1 -1
  51. package/dist/css/tabulator_site.min.css.map +1 -1
  52. package/dist/js/jquery_wrapper.js +37 -37
  53. package/dist/js/tabulator.js +1388 -683
  54. package/dist/js/tabulator.js.map +1 -1
  55. package/dist/js/tabulator.min.js +2 -2
  56. package/dist/js/tabulator.min.js.map +1 -1
  57. package/dist/js/tabulator_esm.js +4135 -3470
  58. package/dist/js/tabulator_esm.js.map +1 -1
  59. package/dist/js/tabulator_esm.min.js +2 -2
  60. package/dist/js/tabulator_esm.min.js.map +1 -1
  61. package/package.json +4 -1
  62. package/src/js/builds/jquery_wrapper.js +37 -37
  63. package/src/js/core/ColumnManager.js +259 -231
  64. package/src/js/core/CoreFeature.js +16 -2
  65. package/src/js/core/FooterManager.js +10 -10
  66. package/src/js/core/Module.js +8 -8
  67. package/src/js/core/RowManager.js +79 -88
  68. package/src/js/core/Tabulator.js +86 -72
  69. package/src/js/core/TabulatorFull.js +1 -1
  70. package/src/js/core/cell/Cell.js +15 -16
  71. package/src/js/core/cell/CellComponent.js +2 -2
  72. package/src/js/core/column/Column.js +55 -66
  73. package/src/js/core/column/ColumnComponent.js +4 -4
  74. package/src/js/core/column/defaults/options.js +1 -1
  75. package/src/js/core/defaults/options.js +4 -2
  76. package/src/js/core/rendering/Renderer.js +19 -19
  77. package/src/js/core/rendering/renderers/BasicHorizontal.js +1 -2
  78. package/src/js/core/rendering/renderers/BasicVertical.js +1 -1
  79. package/src/js/core/rendering/renderers/VirtualDomHorizontal.js +42 -58
  80. package/src/js/core/rendering/renderers/VirtualDomVertical.js +31 -22
  81. package/src/js/core/row/Row.js +32 -8
  82. package/src/js/core/row/RowComponent.js +8 -4
  83. package/src/js/core/tools/Alert.js +44 -45
  84. package/src/js/core/tools/ComponentFunctionBinder.js +4 -2
  85. package/src/js/core/tools/DataLoader.js +3 -3
  86. package/src/js/core/tools/DeprecationAdvisor.js +47 -0
  87. package/src/js/core/tools/ExternalEventBus.js +5 -5
  88. package/src/js/core/tools/InteractionMonitor.js +31 -32
  89. package/src/js/core/tools/InternalEventBus.js +5 -5
  90. package/src/js/core/tools/ModuleBinder.js +6 -6
  91. package/src/js/core/tools/OptionsList.js +4 -4
  92. package/src/js/core/tools/Popup.js +211 -202
  93. package/src/js/modules/Accessor/Accessor.js +16 -16
  94. package/src/js/modules/Accessor/defaults/accessors.js +1 -1
  95. package/src/js/modules/Ajax/Ajax.js +7 -7
  96. package/src/js/modules/Ajax/defaults/loaderPromise.js +19 -19
  97. package/src/js/modules/Ajax/defaults/urlGenerator.js +1 -1
  98. package/src/js/modules/Clipboard/Clipboard.js +23 -23
  99. package/src/js/modules/Clipboard/defaults/pasteParsers.js +0 -2
  100. package/src/js/modules/ColumnCalcs/CalcComponent.js +2 -2
  101. package/src/js/modules/ColumnCalcs/ColumnCalcs.js +54 -50
  102. package/src/js/modules/ColumnCalcs/defaults/calculations.js +1 -1
  103. package/src/js/modules/DataTree/DataTree.js +19 -14
  104. package/src/js/modules/Download/Download.js +15 -8
  105. package/src/js/modules/Download/defaults/downloaders/csv.js +28 -28
  106. package/src/js/modules/Download/defaults/downloaders/html.js +2 -2
  107. package/src/js/modules/Download/defaults/downloaders/json.js +14 -14
  108. package/src/js/modules/Download/defaults/downloaders/jsonLines.js +1 -1
  109. package/src/js/modules/Download/defaults/downloaders/pdf.js +17 -19
  110. package/src/js/modules/Download/defaults/downloaders/xlsx.js +2 -2
  111. package/src/js/modules/Edit/Edit.js +219 -201
  112. package/src/js/modules/Edit/List.js +1026 -1006
  113. package/src/js/modules/Edit/defaults/editors/autocomplete.js +3 -3
  114. package/src/js/modules/Edit/defaults/editors/date.js +110 -0
  115. package/src/js/modules/Edit/defaults/editors/datetime.js +97 -0
  116. package/src/js/modules/Edit/defaults/editors/input.js +7 -7
  117. package/src/js/modules/Edit/defaults/editors/list.js +2 -2
  118. package/src/js/modules/Edit/defaults/editors/number.js +12 -12
  119. package/src/js/modules/Edit/defaults/editors/progress.js +11 -11
  120. package/src/js/modules/Edit/defaults/editors/range.js +5 -5
  121. package/src/js/modules/Edit/defaults/editors/select.js +3 -3
  122. package/src/js/modules/Edit/defaults/editors/star.js +9 -9
  123. package/src/js/modules/Edit/defaults/editors/textarea.js +97 -92
  124. package/src/js/modules/Edit/defaults/editors/tickCross.js +1 -3
  125. package/src/js/modules/Edit/defaults/editors/time.js +98 -0
  126. package/src/js/modules/Edit/defaults/editors.js +8 -2
  127. package/src/js/modules/Edit/inputMask.js +19 -26
  128. package/src/js/modules/Export/Export.js +69 -65
  129. package/src/js/modules/Filter/Filter.js +85 -95
  130. package/src/js/modules/Format/Format.js +24 -26
  131. package/src/js/modules/Format/defaults/formatters/buttonCross.js +1 -1
  132. package/src/js/modules/Format/defaults/formatters/buttonTick.js +1 -1
  133. package/src/js/modules/Format/defaults/formatters/color.js +1 -1
  134. package/src/js/modules/Format/defaults/formatters/datetime.js +7 -7
  135. package/src/js/modules/Format/defaults/formatters/datetimediff.js +7 -7
  136. package/src/js/modules/Format/defaults/formatters/handle.js +1 -1
  137. package/src/js/modules/Format/defaults/formatters/html.js +1 -1
  138. package/src/js/modules/Format/defaults/formatters/image.js +9 -9
  139. package/src/js/modules/Format/defaults/formatters/link.js +10 -10
  140. package/src/js/modules/Format/defaults/formatters/lookup.js +1 -1
  141. package/src/js/modules/Format/defaults/formatters/money.js +1 -1
  142. package/src/js/modules/Format/defaults/formatters/plaintext.js +1 -1
  143. package/src/js/modules/Format/defaults/formatters/progress.js +41 -42
  144. package/src/js/modules/Format/defaults/formatters/responsiveCollapse.js +3 -3
  145. package/src/js/modules/Format/defaults/formatters/rowSelection.js +1 -1
  146. package/src/js/modules/Format/defaults/formatters/rownum.js +9 -2
  147. package/src/js/modules/Format/defaults/formatters/star.js +1 -1
  148. package/src/js/modules/Format/defaults/formatters/textarea.js +1 -1
  149. package/src/js/modules/Format/defaults/formatters/tickCross.js +1 -1
  150. package/src/js/modules/Format/defaults/formatters/traffic.js +14 -14
  151. package/src/js/modules/FrozenColumns/FrozenColumns.js +6 -8
  152. package/src/js/modules/FrozenRows/FrozenRows.js +37 -7
  153. package/src/js/modules/GroupRows/Group.js +3 -3
  154. package/src/js/modules/GroupRows/GroupComponent.js +2 -2
  155. package/src/js/modules/GroupRows/GroupRows.js +12 -11
  156. package/src/js/modules/History/History.js +2 -2
  157. package/src/js/modules/HtmlTableImport/HtmlTableImport.js +3 -6
  158. package/src/js/modules/Import/Import.js +158 -159
  159. package/src/js/modules/Import/defaults/importers/array.js +5 -0
  160. package/src/js/modules/Import/defaults/importers/csv.js +49 -49
  161. package/src/js/modules/Import/defaults/importers/json.js +6 -6
  162. package/src/js/modules/Import/defaults/importers.js +2 -0
  163. package/src/js/modules/Interaction/Interaction.js +39 -40
  164. package/src/js/modules/Keybindings/Keybindings.js +14 -14
  165. package/src/js/modules/Keybindings/defaults/actions.js +1 -2
  166. package/src/js/modules/Layout/Layout.js +4 -5
  167. package/src/js/modules/Layout/defaults/modes/fitColumns.js +9 -10
  168. package/src/js/modules/Layout/defaults/modes/fitData.js +6 -4
  169. package/src/js/modules/Layout/defaults/modes/fitDataGeneral.js +2 -2
  170. package/src/js/modules/Layout/defaults/modes/fitDataStretch.js +2 -2
  171. package/src/js/modules/Localize/Localize.js +7 -7
  172. package/src/js/modules/Menu/Menu.js +8 -11
  173. package/src/js/modules/MoveColumns/MoveColumns.js +3 -6
  174. package/src/js/modules/MoveRows/MoveRows.js +30 -36
  175. package/src/js/modules/Mutator/Mutator.js +9 -9
  176. package/src/js/modules/Page/Page.js +73 -80
  177. package/src/js/modules/Page/defaults/pageCounters/pages.js +2 -2
  178. package/src/js/modules/Page/defaults/pageCounters/rows.js +1 -1
  179. package/src/js/modules/Persistence/Persistence.js +40 -44
  180. package/src/js/modules/Persistence/defaults/readers.js +1 -1
  181. package/src/js/modules/Popup/Popup.js +4 -5
  182. package/src/js/modules/Print/Print.js +2 -2
  183. package/src/js/modules/ReactiveData/ReactiveData.js +178 -115
  184. package/src/js/modules/ResizeColumns/ResizeColumns.js +3 -3
  185. package/src/js/modules/ResizeRows/ResizeRows.js +1 -1
  186. package/src/js/modules/ResizeTable/ResizeTable.js +77 -46
  187. package/src/js/modules/ResponsiveLayout/ResponsiveLayout.js +0 -3
  188. package/src/js/modules/SelectRow/SelectRow.js +26 -28
  189. package/src/js/modules/Sort/Sort.js +110 -79
  190. package/src/js/modules/Sort/defaults/sorters/alphanum.js +1 -1
  191. package/src/js/modules/Sort/defaults/sorters/array.js +24 -28
  192. package/src/js/modules/Sort/defaults/sorters/boolean.js +1 -1
  193. package/src/js/modules/Sort/defaults/sorters/date.js +1 -1
  194. package/src/js/modules/Sort/defaults/sorters/datetime.js +13 -13
  195. package/src/js/modules/Sort/defaults/sorters/exists.js +1 -1
  196. package/src/js/modules/Sort/defaults/sorters/number.js +1 -1
  197. package/src/js/modules/Sort/defaults/sorters/string.js +7 -7
  198. package/src/js/modules/Sort/defaults/sorters/time.js +1 -1
  199. package/src/js/modules/Tooltip/Tooltip.js +5 -7
  200. package/src/js/modules/Validate/Validate.js +10 -13
  201. package/src/js/modules/Validate/defaults/validators.js +8 -3
  202. package/src/scss/tabulator.scss +28 -17
  203. package/src/scss/themes/bootstrap/functions4.scss +1 -1
  204. package/src/scss/themes/bootstrap/tabulator_bootstrap3.scss +8 -8
  205. package/src/scss/themes/bootstrap/tabulator_bootstrap4.scss +8 -8
  206. package/src/scss/themes/bootstrap/tabulator_bootstrap5.scss +8 -8
  207. package/src/scss/themes/bulma/tabulator_bulma.scss +7 -7
  208. package/src/scss/themes/materialize/tabulator_materialize.scss +6 -6
  209. package/src/scss/themes/materialize/variables.scss +1 -1
  210. package/src/scss/themes/semanticui/tabulator_semanticui.scss +7 -7
  211. package/src/scss/themes/tabulator_midnight.scss +7 -7
  212. package/src/scss/themes/tabulator_modern.scss +14 -14
  213. package/src/scss/themes/tabulator_simple.scss +8 -8
  214. package/src/scss/themes/tabulator_site.scss +15 -15
@@ -13,7 +13,7 @@ export default class VirtualDomVertical extends Renderer{
13
13
  this.vDomRowHeight = 20; //approximation of row heights for padding
14
14
 
15
15
  this.vDomTop = 0; //hold position for first rendered row in the virtual DOM
16
- this.vDomBottom = 0; //hold possition for last rendered row in the virtual DOM
16
+ this.vDomBottom = 0; //hold position for last rendered row in the virtual DOM
17
17
 
18
18
  this.vDomScrollPosTop = 0; //last scroll position of the vDom top;
19
19
  this.vDomScrollPosBottom = 0; //last scroll position of the vDom bottom;
@@ -98,7 +98,12 @@ export default class VirtualDomVertical extends Renderer{
98
98
  callback();
99
99
  }
100
100
 
101
- this._virtualRenderFill((topRow === false ? this.rows.length - 1 : topRow), true, topOffset || 0);
101
+ if(this.rows().length){
102
+ this._virtualRenderFill((topRow === false ? this.rows.length - 1 : topRow), true, topOffset || 0);
103
+ }else{
104
+ this.clear();
105
+ this.table.rowManager._showPlaceholder();
106
+ }
102
107
 
103
108
  this.scrollColumns(left);
104
109
  }
@@ -292,7 +297,7 @@ export default class VirtualDomVertical extends Renderer{
292
297
 
293
298
  if(!position){
294
299
  this.vDomTopPad = 0;
295
- //adjust rowheight to match average of rendered elements
300
+ //adjust row height to match average of rendered elements
296
301
  this.vDomRowHeight = Math.floor((rowsHeight + topPadHeight) / i);
297
302
  this.vDomBottomPad = this.vDomRowHeight * (rowsCount - this.vDomBottom -1);
298
303
 
@@ -330,9 +335,10 @@ export default class VirtualDomVertical extends Renderer{
330
335
  addedRows = [],
331
336
  paddingAdjust = 0,
332
337
  index = this.vDomTop -1,
333
- i = 0;
338
+ i = 0,
339
+ working = true;
334
340
 
335
- while(true){
341
+ while(working){
336
342
  if(this.vDomTop){
337
343
  let row = rows[index],
338
344
  rowHeight, initialized;
@@ -368,15 +374,15 @@ export default class VirtualDomVertical extends Renderer{
368
374
  i++;
369
375
 
370
376
  }else{
371
- break;
377
+ working = false;
372
378
  }
373
379
 
374
380
  }else{
375
- break;
381
+ working = false;
376
382
  }
377
383
 
378
384
  }else{
379
- break;
385
+ working = false;
380
386
  }
381
387
  }
382
388
 
@@ -405,11 +411,12 @@ export default class VirtualDomVertical extends Renderer{
405
411
  _removeTopRow(rows, fillableSpace){
406
412
  var removableRows = [],
407
413
  paddingAdjust = 0,
408
- i = 0;
414
+ i = 0,
415
+ working = true;
409
416
 
410
- while(true){
417
+ while(working){
411
418
  let row = rows[this.vDomTop],
412
- rowHeight, diff;
419
+ rowHeight;
413
420
 
414
421
  if(row && i < this.vDomMaxRenderChain){
415
422
  rowHeight = row.getHeight() || this.vDomRowHeight;
@@ -423,10 +430,10 @@ export default class VirtualDomVertical extends Renderer{
423
430
  removableRows.push(row);
424
431
  i++;
425
432
  }else{
426
- break;
433
+ working = false;
427
434
  }
428
435
  }else{
429
- break;
436
+ working = false;
430
437
  }
431
438
  }
432
439
 
@@ -450,9 +457,10 @@ export default class VirtualDomVertical extends Renderer{
450
457
  addedRows = [],
451
458
  paddingAdjust = 0,
452
459
  index = this.vDomBottom + 1,
453
- i = 0;
460
+ i = 0,
461
+ working = true;
454
462
 
455
- while(true){
463
+ while(working){
456
464
  let row = rows[index],
457
465
  rowHeight, initialized;
458
466
 
@@ -486,10 +494,10 @@ export default class VirtualDomVertical extends Renderer{
486
494
  index++;
487
495
  i++;
488
496
  }else{
489
- break;
497
+ working = false;
490
498
  }
491
499
  }else{
492
- break;
500
+ working = false;
493
501
  }
494
502
  }
495
503
 
@@ -514,11 +522,12 @@ export default class VirtualDomVertical extends Renderer{
514
522
  _removeBottomRow(rows, fillableSpace){
515
523
  var removableRows = [],
516
524
  paddingAdjust = 0,
517
- i = 0;
525
+ i = 0,
526
+ working = true;
518
527
 
519
- while(true){
528
+ while(working){
520
529
  let row = rows[this.vDomBottom],
521
- rowHeight, diff;
530
+ rowHeight;
522
531
 
523
532
  if(row && i < this.vDomMaxRenderChain){
524
533
  rowHeight = row.getHeight() || this.vDomRowHeight;
@@ -532,10 +541,10 @@ export default class VirtualDomVertical extends Renderer{
532
541
  removableRows.push(row);
533
542
  i++;
534
543
  }else{
535
- break;
544
+ working = false;
536
545
  }
537
546
  }else{
538
- break;
547
+ working = false;
539
548
  }
540
549
  }
541
550
 
@@ -13,11 +13,13 @@ export default class Row extends CoreFeature{
13
13
  this.modules = {}; //hold module variables;
14
14
  this.cells = [];
15
15
  this.height = 0; //hold element height
16
- this.heightStyled = ""; //hold element height prestyled to improve render efficiency
16
+ this.heightStyled = ""; //hold element height pre-styled to improve render efficiency
17
17
  this.manualHeight = false; //user has manually set row height
18
18
  this.outerHeight = 0; //hold elements outer height
19
19
  this.initialized = false; //element has been rendered
20
20
  this.heightInitialized = false; //element has resized cells to fit
21
+ this.position = 0; //store position of element in row list
22
+ this.positionWatchers = [];
21
23
 
22
24
  this.component = null;
23
25
 
@@ -246,14 +248,14 @@ export default class Row extends CoreFeature{
246
248
  newRowData = this.chain("row-data-changing", [this, tempData, updatedData], null, updatedData);
247
249
 
248
250
  //set data
249
- for (var attrname in newRowData) {
251
+ for (let attrname in newRowData) {
250
252
  this.data[attrname] = newRowData[attrname];
251
253
  }
252
254
 
253
255
  this.dispatch("row-data-save-after", this);
254
256
 
255
257
  //update affected cells only
256
- for (var attrname in updatedData) {
258
+ for (let attrname in updatedData) {
257
259
 
258
260
  let columns = this.table.columnManager.getColumnsByFieldRoot(attrname);
259
261
 
@@ -375,9 +377,7 @@ export default class Row extends CoreFeature{
375
377
  }
376
378
 
377
379
  deleteActual(blockRedraw){
378
- var index = this.table.rowManager.getRowIndex(this);
379
-
380
- this.detatchModules();
380
+ this.detachModules();
381
381
 
382
382
  this.table.rowManager.deleteRow(this, blockRedraw);
383
383
 
@@ -390,7 +390,7 @@ export default class Row extends CoreFeature{
390
390
  this.dispatch("row-deleted", this);
391
391
  }
392
392
 
393
- detatchModules(){
393
+ detachModules(){
394
394
  this.dispatch("row-deleting", this);
395
395
  }
396
396
 
@@ -403,7 +403,7 @@ export default class Row extends CoreFeature{
403
403
  }
404
404
 
405
405
  wipe(){
406
- this.detatchModules();
406
+ this.detachModules();
407
407
  this.deleteCells();
408
408
 
409
409
  if(this.element){
@@ -417,6 +417,30 @@ export default class Row extends CoreFeature{
417
417
  this.element = false;
418
418
  this.modules = {};
419
419
  }
420
+
421
+ isDisplayed(){
422
+ return this.table.rowManager.getDisplayRows().includes(this);
423
+ }
424
+
425
+ getPosition(){
426
+ return this.isDisplayed() ? this.position : false;
427
+ }
428
+
429
+ setPosition(position){
430
+ if(position != this.position){
431
+ this.position = position;
432
+
433
+ this.positionWatchers.forEach((callback) => {
434
+ callback(this.position);
435
+ });
436
+ }
437
+ }
438
+
439
+ watchPosition(callback){
440
+ this.positionWatchers.push(callback);
441
+
442
+ callback(this.position);
443
+ }
420
444
 
421
445
  getGroup(){
422
446
  return this.modules.group || false;
@@ -9,10 +9,10 @@ export default class RowComponent {
9
9
  if (typeof target[name] !== "undefined") {
10
10
  return target[name];
11
11
  }else{
12
- return target._row.table.componentFunctionBinder.handle("row", target._row, name)
12
+ return target._row.table.componentFunctionBinder.handle("row", target._row, name);
13
13
  }
14
14
  }
15
- })
15
+ });
16
16
  }
17
17
 
18
18
  getData(transform){
@@ -42,8 +42,12 @@ export default class RowComponent {
42
42
  return this._row.getData("data")[this._row.table.options.index];
43
43
  }
44
44
 
45
- getPosition(active){
46
- return this._row.table.rowManager.getRowPosition(this._row, active);
45
+ getPosition(){
46
+ return this._row.getPosition();
47
+ }
48
+
49
+ watchPosition(callback){
50
+ return this._row.watchPosition(callback);
47
51
  }
48
52
 
49
53
  delete(){
@@ -1,63 +1,62 @@
1
1
  import CoreFeature from '../CoreFeature.js';
2
- import Helpers from './Helpers.js';
3
2
 
4
3
  export default class Alert extends CoreFeature{
5
- constructor(table){
6
- super(table);
4
+ constructor(table){
5
+ super(table);
7
6
 
8
- this.element = this._createAlertElement();
9
- this.msgElement = this._createMsgElement();
10
- this.type = null;
7
+ this.element = this._createAlertElement();
8
+ this.msgElement = this._createMsgElement();
9
+ this.type = null;
11
10
 
12
- this.element.appendChild(this.msgElement);
13
- }
11
+ this.element.appendChild(this.msgElement);
12
+ }
14
13
 
15
- _createAlertElement(){
16
- var el = document.createElement("div");
17
- el.classList.add("tabulator-alert");
18
- return el;
19
- }
14
+ _createAlertElement(){
15
+ var el = document.createElement("div");
16
+ el.classList.add("tabulator-alert");
17
+ return el;
18
+ }
20
19
 
21
- _createMsgElement(){
22
- var el = document.createElement("div");
23
- el.classList.add("tabulator-alert-msg");
24
- el.setAttribute("role", "alert");
25
- return el;
26
- }
20
+ _createMsgElement(){
21
+ var el = document.createElement("div");
22
+ el.classList.add("tabulator-alert-msg");
23
+ el.setAttribute("role", "alert");
24
+ return el;
25
+ }
27
26
 
28
- _typeClass(){
29
- return "tabulator-alert-state-" + this.type;
30
- }
27
+ _typeClass(){
28
+ return "tabulator-alert-state-" + this.type;
29
+ }
31
30
 
32
- alert(content, type = "msg"){
33
- if(content){
34
- this.clear();
31
+ alert(content, type = "msg"){
32
+ if(content){
33
+ this.clear();
35
34
 
36
- this.type = type;
35
+ this.type = type;
37
36
 
38
- while(this.msgElement.firstChild) this.msgElement.removeChild(this.msgElement.firstChild);
37
+ while(this.msgElement.firstChild) this.msgElement.removeChild(this.msgElement.firstChild);
39
38
 
40
- this.msgElement.classList.add(this._typeClass());
39
+ this.msgElement.classList.add(this._typeClass());
41
40
 
42
- if(typeof content === "function"){
43
- content = content();
44
- }
41
+ if(typeof content === "function"){
42
+ content = content();
43
+ }
45
44
 
46
- if(content instanceof HTMLElement){
47
- this.msgElement.appendChild(content);
48
- }else{
49
- this.msgElement.innerHTML = content;
50
- }
45
+ if(content instanceof HTMLElement){
46
+ this.msgElement.appendChild(content);
47
+ }else{
48
+ this.msgElement.innerHTML = content;
49
+ }
51
50
 
52
- this.table.element.appendChild(this.element);
53
- }
54
- }
51
+ this.table.element.appendChild(this.element);
52
+ }
53
+ }
55
54
 
56
- clear(){
57
- if(this.element.parentNode){
58
- this.element.parentNode.removeChild(this.element);
59
- }
55
+ clear(){
56
+ if(this.element.parentNode){
57
+ this.element.parentNode.removeChild(this.element);
58
+ }
60
59
 
61
- this.msgElement.classList.remove(this._typeClass());
62
- }
60
+ this.msgElement.classList.remove(this._typeClass());
61
+ }
63
62
  }
@@ -12,7 +12,7 @@ export default class ComponentFunctionBinder{
12
12
  }
13
13
 
14
14
  if(this.bindings[type][funcName]){
15
- console.warn("Unable to bind component handler, a matching function name is already bound", type, funcName, handler)
15
+ console.warn("Unable to bind component handler, a matching function name is already bound", type, funcName, handler);
16
16
  }else{
17
17
  this.bindings[type][funcName] = handler;
18
18
  }
@@ -23,7 +23,9 @@ export default class ComponentFunctionBinder{
23
23
  return this.bindings[type][name].bind(null, component);
24
24
  }else{
25
25
  if(name !== "then" && typeof name === "string" && !name.startsWith("_")){
26
- console.error("The " + type + " component does not have a " + name + " function, have you checked that you have the correct Tabulator module installed?")
26
+ if(this.table.options.debugInvalidComponentFuncs){
27
+ console.error("The " + type + " component does not have a " + name + " function, have you checked that you have the correct Tabulator module installed?");
28
+ }
27
29
  }
28
30
  }
29
31
  }
@@ -63,9 +63,9 @@ export default class DataLoader extends CoreFeature{
63
63
  this.clearAlert();
64
64
  }, this.table.options.dataLoaderErrorTimeout);
65
65
  })
66
- .finally(() => {
67
- this.loading = false;
68
- })
66
+ .finally(() => {
67
+ this.loading = false;
68
+ });
69
69
  }else{
70
70
  this.dispatchExternal("dataLoaded", data);
71
71
 
@@ -0,0 +1,47 @@
1
+ import CoreFeature from '../CoreFeature.js';
2
+
3
+ export default class DeprecationAdvisor extends CoreFeature{
4
+
5
+ constructor(table){
6
+ super(table);
7
+ }
8
+
9
+ _warnUser(){
10
+ if(this.options("debugDeprecation")){
11
+ console.warn(...arguments);
12
+ }
13
+ }
14
+
15
+ check(oldOption, newOption){
16
+ var msg = "";
17
+
18
+ if(typeof this.options(oldOption) !== "undefined"){
19
+ msg = "Deprecated Setup Option - Use of the %c" + oldOption + "%c option is now deprecated";
20
+
21
+ if(newOption){
22
+ msg = msg + ", Please use the %c" + newOption + "%c option instead";
23
+ this._warnUser(msg, 'font-weight: bold;', 'font-weight: normal;', 'font-weight: bold;', 'font-weight: normal;');
24
+ }else{
25
+ this._warnUser(msg, 'font-weight: bold;', 'font-weight: normal;');
26
+ }
27
+
28
+ return false;
29
+ }else{
30
+ return true;
31
+ }
32
+ }
33
+
34
+ checkMsg(oldOption, msg){
35
+ if(typeof this.options(oldOption) !== "undefined"){
36
+ this._warnUser("%cDeprecated Setup Option - Use of the %c" + oldOption + " %c option is now deprecated, " + msg, 'font-weight: normal;', 'font-weight: bold;', 'font-weight: normal;');
37
+
38
+ return false;
39
+ }else{
40
+ return true;
41
+ }
42
+ }
43
+
44
+ msg(msg){
45
+ this._warnUser(msg);
46
+ }
47
+ }
@@ -18,7 +18,7 @@ export default class ExternalEventBus {
18
18
  this.subscriptionNotifiers[key].push(callback);
19
19
 
20
20
  if(this.subscribed(key)){
21
- this._notifiySubscriptionChange(key, true);
21
+ this._notifySubscriptionChange(key, true);
22
22
  }
23
23
  }
24
24
 
@@ -29,7 +29,7 @@ export default class ExternalEventBus {
29
29
 
30
30
  this.events[key].push(callback);
31
31
 
32
- this._notifiySubscriptionChange(key, true);
32
+ this._notifySubscriptionChange(key, true);
33
33
  }
34
34
 
35
35
  unsubscribe(key, callback){
@@ -55,14 +55,14 @@ export default class ExternalEventBus {
55
55
  return;
56
56
  }
57
57
 
58
- this._notifiySubscriptionChange(key, false);
58
+ this._notifySubscriptionChange(key, false);
59
59
  }
60
60
 
61
61
  subscribed(key){
62
62
  return this.events[key] && this.events[key].length;
63
63
  }
64
64
 
65
- _notifiySubscriptionChange(key, subscribed){
65
+ _notifySubscriptionChange(key, subscribed){
66
66
  var notifiers = this.subscriptionNotifiers[key];
67
67
 
68
68
  if(notifiers){
@@ -100,6 +100,6 @@ export default class ExternalEventBus {
100
100
  console.log(...args);
101
101
  }
102
102
 
103
- return this._dispatch(...arguments)
103
+ return this._dispatch(...arguments);
104
104
  }
105
105
  }
@@ -1,5 +1,4 @@
1
1
  import CoreFeature from '../CoreFeature.js';
2
- import Helpers from './Helpers.js';
3
2
  import Row from '../row/Row.js';
4
3
 
5
4
  export default class InteractionManager extends CoreFeature {
@@ -50,7 +49,7 @@ export default class InteractionManager extends CoreFeature {
50
49
  subscriber:null,
51
50
  target:null,
52
51
  },
53
- }
52
+ };
54
53
 
55
54
  this.pseudoTracking = false;
56
55
  }
@@ -69,8 +68,8 @@ export default class InteractionManager extends CoreFeature {
69
68
  listenerMap[listener] = {
70
69
  handler:null,
71
70
  components:[],
72
- }
73
- })
71
+ };
72
+ });
74
73
 
75
74
  this.listeners = listenerMap;
76
75
  }
@@ -136,7 +135,7 @@ export default class InteractionManager extends CoreFeature {
136
135
  }
137
136
  }
138
137
 
139
- this.subscribe("table-destroy", this.clearWatchers.bind(this))
138
+ this.subscribe("table-destroy", this.clearWatchers.bind(this));
140
139
  }
141
140
 
142
141
  subscriptionChanged(component, key, added){
@@ -174,12 +173,12 @@ export default class InteractionManager extends CoreFeature {
174
173
  if(listener.components.length){
175
174
  if(!listener.handler){
176
175
  listener.handler = this.track.bind(this, key);
177
- this.el.addEventListener(key, listener.handler)
176
+ this.el.addEventListener(key, listener.handler);
178
177
  // this.el.addEventListener(key, listener.handler, {passive: true})
179
178
  }
180
179
  }else{
181
180
  if(listener.handler){
182
- this.el.removeEventListener(key, listener.handler)
181
+ this.el.removeEventListener(key, listener.handler);
183
182
  listener.handler = null;
184
183
  }
185
184
  }
@@ -209,7 +208,7 @@ export default class InteractionManager extends CoreFeature {
209
208
 
210
209
  let abort = classList.filter((item) => {
211
210
  return this.abortClasses.includes(item);
212
- })
211
+ });
213
212
 
214
213
  if(abort.length){
215
214
  break;
@@ -217,7 +216,7 @@ export default class InteractionManager extends CoreFeature {
217
216
 
218
217
  let elTargets = classList.filter((item) => {
219
218
  return componentMap.includes(item);
220
- })
219
+ });
221
220
 
222
221
  for (let target of elTargets) {
223
222
  targets[this.componentMap[target]] = el;
@@ -248,36 +247,36 @@ export default class InteractionManager extends CoreFeature {
248
247
  switch(key){
249
248
  case "row":
250
249
  case "group":
251
- if(listener.components.includes("row") || listener.components.includes("cell") || listener.components.includes("group")){
252
- let rows = this.table.rowManager.getVisibleRows(true);
250
+ if(listener.components.includes("row") || listener.components.includes("cell") || listener.components.includes("group")){
251
+ let rows = this.table.rowManager.getVisibleRows(true);
253
252
 
254
- component = rows.find((row) => {
255
- return row.getElement() === target;
256
- });
253
+ component = rows.find((row) => {
254
+ return row.getElement() === target;
255
+ });
257
256
 
258
- if(targets["row"] && targets["row"].parentNode && targets["row"].parentNode.closest(".tabulator-row")){
259
- targets[key] = false;
257
+ if(targets["row"] && targets["row"].parentNode && targets["row"].parentNode.closest(".tabulator-row")){
258
+ targets[key] = false;
259
+ }
260
260
  }
261
- }
262
- break;
261
+ break;
263
262
 
264
263
  case "column":
265
- if(listener.components.includes("column")){
266
- component = this.table.columnManager.findColumn(target);
267
- }
268
- break
264
+ if(listener.components.includes("column")){
265
+ component = this.table.columnManager.findColumn(target);
266
+ }
267
+ break;
269
268
 
270
269
  case "cell":
271
- if(listener.components.includes("cell")){
272
- if(targets["row"] instanceof Row){
273
- component = targets["row"].findCell(target);
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?")
270
+ if(listener.components.includes("cell")){
271
+ if(targets["row"] instanceof Row){
272
+ component = targets["row"].findCell(target);
273
+ }else{
274
+ if(targets["row"]){
275
+ 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?");
276
+ }
277
277
  }
278
278
  }
279
- }
280
- break;
279
+ break;
281
280
  }
282
281
  }
283
282
 
@@ -286,7 +285,7 @@ export default class InteractionManager extends CoreFeature {
286
285
  targetMatches[key] = {
287
286
  target:target,
288
287
  component:component,
289
- }
288
+ };
290
289
  }
291
290
  }
292
291
 
@@ -310,7 +309,7 @@ export default class InteractionManager extends CoreFeature {
310
309
  let listener = this.listeners[key];
311
310
 
312
311
  if(listener.handler){
313
- this.el.removeEventListener(key, listener.handler)
312
+ this.el.removeEventListener(key, listener.handler);
314
313
  listener.handler = null;
315
314
  }
316
315
  }
@@ -18,7 +18,7 @@ export default class InternalEventBus {
18
18
  this.subscriptionNotifiers[key].push(callback);
19
19
 
20
20
  if(this.subscribed(key)){
21
- this._notifiySubscriptionChange(key, true);
21
+ this._notifySubscriptionChange(key, true);
22
22
  }
23
23
  }
24
24
 
@@ -33,7 +33,7 @@ export default class InternalEventBus {
33
33
  return a.priority - b.priority;
34
34
  });
35
35
 
36
- this._notifiySubscriptionChange(key, true);
36
+ this._notifySubscriptionChange(key, true);
37
37
  }
38
38
 
39
39
  unsubscribe(key, callback){
@@ -57,7 +57,7 @@ export default class InternalEventBus {
57
57
  return;
58
58
  }
59
59
 
60
- this._notifiySubscriptionChange(key, false);
60
+ this._notifySubscriptionChange(key, false);
61
61
  }
62
62
 
63
63
  subscribed(key){
@@ -100,7 +100,7 @@ export default class InternalEventBus {
100
100
  return confirmed;
101
101
  }
102
102
 
103
- _notifiySubscriptionChange(key, subscribed){
103
+ _notifySubscriptionChange(key, subscribed){
104
104
  var notifiers = this.subscriptionNotifiers[key];
105
105
 
106
106
  if(notifiers){
@@ -116,7 +116,7 @@ export default class InternalEventBus {
116
116
 
117
117
  if(this.events[key]){
118
118
  this.events[key].forEach((subscriber) => {
119
- let callResult = subscriber.callback.apply(this, args);
119
+ subscriber.callback.apply(this, args);
120
120
  });
121
121
  }
122
122
  }