tabulator-tables 5.6.1 → 6.0.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 (167) hide show
  1. package/bower.json +1 -1
  2. package/build/{Bundler.js → Bundler.mjs} +8 -6
  3. package/build/rollup.mjs +9 -0
  4. package/dist/css/tabulator.css +62 -0
  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 +72 -0
  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 +78 -0
  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 +78 -0
  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 +84 -0
  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 +77 -0
  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 +72 -0
  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 +82 -0
  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 +74 -0
  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 +75 -0
  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 +85 -0
  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 +3882 -2809
  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 +3845 -2770
  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 +17 -17
  57. package/src/js/builds/esm.js +2 -0
  58. package/src/js/core/ColumnManager.js +15 -0
  59. package/src/js/core/Module.js +2 -4
  60. package/src/js/core/RowManager.js +1 -1
  61. package/src/js/core/Tabulator.js +35 -22
  62. package/src/js/core/TabulatorFull.js +15 -5
  63. package/src/js/core/cell/Cell.js +4 -0
  64. package/src/js/core/column/Column.js +228 -217
  65. package/src/js/core/column/ColumnComponent.js +1 -3
  66. package/src/js/core/defaults/options.js +1 -0
  67. package/src/js/core/modules/optional.js +2 -1
  68. package/src/js/core/row/Row.js +23 -11
  69. package/src/js/core/tools/DataLoader.js +1 -1
  70. package/src/js/core/tools/ModuleBinder.js +123 -75
  71. package/src/js/core/tools/TableRegistry.js +58 -55
  72. package/src/js/modules/Accessor/Accessor.js +7 -8
  73. package/src/js/modules/Accessor/defaults/accessors.js +5 -1
  74. package/src/js/modules/Ajax/Ajax.js +10 -12
  75. package/src/js/modules/Clipboard/Clipboard.js +10 -10
  76. package/src/js/modules/Clipboard/defaults/pasteActions.js +0 -43
  77. package/src/js/modules/Clipboard/defaults/pasteParsers.js +0 -55
  78. package/src/js/modules/Clipboard/extensions/extensions.js +9 -0
  79. package/src/js/modules/Clipboard/extensions/keybindings/actions.js +9 -0
  80. package/src/js/modules/Clipboard/extensions/keybindings/bindings.js +3 -0
  81. package/src/js/modules/ColumnCalcs/CalcComponent.js +2 -4
  82. package/src/js/modules/ColumnCalcs/ColumnCalcs.js +16 -18
  83. package/src/js/modules/Comms/Comms.js +5 -8
  84. package/src/js/modules/DataTree/DataTree.js +11 -11
  85. package/src/js/modules/Download/Download.js +9 -11
  86. package/src/js/modules/Edit/Edit.js +47 -15
  87. package/src/js/modules/Edit/List.js +12 -12
  88. package/src/js/modules/Edit/defaults/editors/time.js +0 -2
  89. package/src/js/modules/Edit/defaults/editors.js +0 -4
  90. package/src/js/modules/Export/Export.js +70 -62
  91. package/src/js/modules/Export/ExportColumn.js +2 -4
  92. package/src/js/modules/Export/ExportRow.js +2 -4
  93. package/src/js/modules/Export/defaults/columnLookups.js +3 -0
  94. package/src/js/modules/Export/defaults/rowLookups.js +18 -0
  95. package/src/js/modules/Filter/Filter.js +7 -9
  96. package/src/js/modules/Format/Format.js +7 -9
  97. package/src/js/modules/Format/defaults/formatters.js +0 -4
  98. package/src/js/modules/FrozenColumns/FrozenColumns.js +8 -6
  99. package/src/js/modules/FrozenRows/FrozenRows.js +4 -6
  100. package/src/js/modules/GroupRows/Group.js +2 -4
  101. package/src/js/modules/GroupRows/GroupComponent.js +2 -4
  102. package/src/js/modules/GroupRows/GroupRows.js +4 -6
  103. package/src/js/modules/History/History.js +10 -10
  104. package/src/js/modules/History/extensions/extensions.js +9 -0
  105. package/src/js/modules/History/extensions/keybindings/actions.js +27 -0
  106. package/src/js/modules/History/extensions/keybindings/bindings.js +4 -0
  107. package/src/js/modules/HtmlTableImport/HtmlTableImport.js +4 -6
  108. package/src/js/modules/Import/Import.js +7 -9
  109. package/src/js/modules/Import/defaults/importers/array.js +2 -4
  110. package/src/js/modules/Import/defaults/importers/csv.js +2 -4
  111. package/src/js/modules/Interaction/Interaction.js +4 -6
  112. package/src/js/modules/Keybindings/Keybindings.js +8 -10
  113. package/src/js/modules/Keybindings/defaults/actions.js +5 -71
  114. package/src/js/modules/Keybindings/defaults/bindings.js +0 -16
  115. package/src/js/modules/Layout/Layout.js +7 -9
  116. package/src/js/modules/Localize/Localize.js +7 -9
  117. package/src/js/modules/Menu/Menu.js +7 -9
  118. package/src/js/modules/MoveColumns/MoveColumns.js +6 -8
  119. package/src/js/modules/MoveRows/MoveRows.js +13 -45
  120. package/src/js/modules/MoveRows/defaults/receivers.js +30 -0
  121. package/src/js/modules/MoveRows/defaults/senders.js +5 -0
  122. package/src/js/modules/Mutator/Mutator.js +7 -9
  123. package/src/js/modules/Page/Page.js +7 -9
  124. package/src/js/modules/Persistence/Persistence.js +10 -12
  125. package/src/js/modules/Popup/Popup.js +4 -8
  126. package/src/js/modules/Print/Print.js +4 -6
  127. package/src/js/modules/ReactiveData/ReactiveData.js +4 -9
  128. package/src/js/modules/ResizeColumns/ResizeColumns.js +91 -53
  129. package/src/js/modules/ResizeRows/ResizeRows.js +41 -8
  130. package/src/js/modules/ResizeTable/ResizeTable.js +4 -6
  131. package/src/js/modules/ResponsiveLayout/ResponsiveLayout.js +15 -9
  132. package/src/js/modules/ResponsiveLayout/extensions/extensions.js +9 -0
  133. package/src/js/modules/SelectRange/Range.js +22 -10
  134. package/src/js/modules/SelectRange/RangeComponent.js +2 -4
  135. package/src/js/modules/SelectRange/SelectRange.js +58 -28
  136. package/src/js/modules/SelectRange/extensions/clipboard/pasteActions.js +45 -0
  137. package/src/js/modules/SelectRange/extensions/clipboard/pasteParsers.js +57 -0
  138. package/src/js/modules/SelectRange/extensions/export/columnLookups.js +11 -0
  139. package/src/js/modules/SelectRange/extensions/export/rowLookups.js +5 -0
  140. package/src/js/modules/SelectRange/extensions/extensions.js +21 -0
  141. package/src/js/modules/SelectRange/extensions/keybindings/actions.js +38 -0
  142. package/src/js/modules/SelectRange/extensions/keybindings/bindings.js +14 -0
  143. package/src/js/modules/SelectRow/SelectRow.js +12 -12
  144. package/src/js/modules/SelectRow/extensions/extensions.js +9 -0
  145. package/src/js/modules/Sort/Sort.js +16 -13
  146. package/src/js/modules/Spreadsheet/GridCalculator.js +64 -0
  147. package/src/js/modules/Spreadsheet/Sheet.js +243 -0
  148. package/src/js/modules/Spreadsheet/SheetComponent.js +59 -0
  149. package/src/js/modules/Spreadsheet/Spreadsheet.js +309 -0
  150. package/src/js/modules/Tooltip/Tooltip.js +6 -8
  151. package/src/js/modules/Validate/Validate.js +7 -9
  152. package/src/scss/tabulator.scss +79 -3
  153. package/src/scss/themes/bootstrap/tabulator_bootstrap3.scss +14 -0
  154. package/src/scss/themes/bootstrap/tabulator_bootstrap4.scss +18 -0
  155. package/src/scss/themes/bootstrap/tabulator_bootstrap5.scss +18 -0
  156. package/src/scss/themes/bulma/tabulator_bulma.scss +24 -0
  157. package/src/scss/themes/materialize/tabulator_materialize.scss +18 -0
  158. package/src/scss/themes/semanticui/tabulator_semanticui.scss +14 -0
  159. package/src/scss/themes/tabulator_midnight.scss +34 -21
  160. package/src/scss/themes/tabulator_modern.scss +23 -0
  161. package/src/scss/themes/tabulator_simple.scss +15 -0
  162. package/src/scss/themes/tabulator_site.scss +25 -0
  163. package/build/rollup.js +0 -6
  164. package/src/js/modules/Edit/defaults/editors/autocomplete.js +0 -12
  165. package/src/js/modules/Edit/defaults/editors/select.js +0 -10
  166. /package/src/js/modules/{Format/defaults → ResponsiveLayout/extensions}/formatters/responsiveCollapse.js +0 -0
  167. /package/src/js/modules/{Format/defaults → SelectRow/extensions}/formatters/rowSelection.js +0 -0
@@ -1,4 +1,4 @@
1
- class CalcComponent{
1
+ export default class CalcComponent{
2
2
  constructor (row){
3
3
  this._row = row;
4
4
 
@@ -43,6 +43,4 @@ class CalcComponent{
43
43
  _getSelf(){
44
44
  return this._row;
45
45
  }
46
- }
47
-
48
- export default CalcComponent;
46
+ }
@@ -8,7 +8,12 @@ import Row from '../../core/row/Row.js';
8
8
 
9
9
  import defaultCalculations from './defaults/calculations.js';
10
10
 
11
- class ColumnCalcs extends Module{
11
+ export default class ColumnCalcs extends Module{
12
+
13
+ static moduleName = "columnCalcs";
14
+
15
+ //load defaults
16
+ static calculations = defaultCalculations;
12
17
 
13
18
  constructor(table){
14
19
  super(table);
@@ -397,19 +402,19 @@ class ColumnCalcs extends Module{
397
402
  }
398
403
 
399
404
  rowsToData(rows){
400
- var data = [];
401
-
405
+ var data = [],
406
+ hasDataTreeColumnCalcs = this.table.options.dataTree && this.table.options.dataTreeChildColumnCalcs,
407
+ dataTree = this.table.modules.dataTree;
408
+
402
409
  rows.forEach((row) => {
403
410
  data.push(row.getData());
404
-
405
- if(this.table.options.dataTree && this.table.options.dataTreeChildColumnCalcs){
406
- if(row.modules.dataTree && row.modules.dataTree.open){
407
- var children = this.rowsToData(this.table.modules.dataTree.getFilteredTreeChildren(row));
408
- data = data.concat(children);
409
- }
411
+
412
+ if(hasDataTreeColumnCalcs && row.modules.dataTree?.open){
413
+ this.rowsToData(dataTree.getFilteredTreeChildren(row)).forEach(dataRow =>{
414
+ data.push(row);
415
+ });
410
416
  }
411
417
  });
412
-
413
418
  return data;
414
419
  }
415
420
 
@@ -578,11 +583,4 @@ class ColumnCalcs extends Module{
578
583
  }
579
584
  }
580
585
  }
581
- }
582
-
583
- ColumnCalcs.moduleName = "columnCalcs";
584
-
585
- //load defaults
586
- ColumnCalcs.calculations = defaultCalculations;
587
-
588
- export default ColumnCalcs;
586
+ }
@@ -1,7 +1,8 @@
1
1
  import Module from '../../core/Module.js';
2
- import TableRegistry from '../../core/tools/TableRegistry.js';
3
2
 
4
- class Comms extends Module{
3
+ export default class Comms extends Module{
4
+
5
+ static moduleName = "comms";
5
6
 
6
7
  constructor(table){
7
8
  super(table);
@@ -15,7 +16,7 @@ class Comms extends Module{
15
16
  var connections = [],
16
17
  connection;
17
18
 
18
- connection = TableRegistry.lookupTable(selectors);
19
+ connection = this.table.constructor.registry.lookupTable(selectors);
19
20
 
20
21
  connection.forEach((con) =>{
21
22
  if(this.table !== con){
@@ -45,8 +46,4 @@ class Comms extends Module{
45
46
  console.warn("Inter-table Comms Error - no such module:", module);
46
47
  }
47
48
  }
48
- }
49
-
50
- Comms.moduleName = "comms";
51
-
52
- export default Comms;
49
+ }
@@ -4,7 +4,9 @@ import Row from '../../core/row/Row.js';
4
4
 
5
5
  import RowComponent from '../../core/row/RowComponent.js';
6
6
 
7
- class DataTree extends Module{
7
+ export default class DataTree extends Module{
8
+
9
+ static moduleName = "dataTree";
8
10
 
9
11
  constructor(table){
10
12
  super(table);
@@ -311,7 +313,7 @@ class DataTree extends Module{
311
313
  config = row.modules.dataTree;
312
314
 
313
315
  if(!config.index && config.children !== false){
314
- children = this.getChildren(row);
316
+ children = this.getChildren(row, false, true);
315
317
 
316
318
  children.forEach((child) => {
317
319
  child.create();
@@ -324,7 +326,7 @@ class DataTree extends Module{
324
326
  return output;
325
327
  }
326
328
 
327
- getChildren(row, allChildren){
329
+ getChildren(row, allChildren, sortOnly){
328
330
  var config = row.modules.dataTree,
329
331
  children = [],
330
332
  output = [];
@@ -341,13 +343,13 @@ class DataTree extends Module{
341
343
  }
342
344
 
343
345
  if(this.table.modExists("sort") && this.table.options.dataTreeSort){
344
- this.table.modules.sort.sort(children);
346
+ this.table.modules.sort.sort(children, sortOnly);
345
347
  }
346
348
 
347
349
  children.forEach((child) => {
348
350
  output.push(child);
349
351
 
350
- var subChildren = this.getChildren(child);
352
+ var subChildren = this.getChildren(child, false, true);
351
353
 
352
354
  subChildren.forEach((sub) => {
353
355
  output.push(sub);
@@ -584,7 +586,9 @@ class DataTree extends Module{
584
586
  output.push(component ? childRow.getComponent() : childRow);
585
587
 
586
588
  if(recurse){
587
- output = output.concat(this.getTreeChildren(childRow, component, recurse));
589
+ this.getTreeChildren(childRow, component, recurse).forEach(child => {
590
+ output.push(child);
591
+ });
588
592
  }
589
593
  }
590
594
  });
@@ -600,8 +604,4 @@ class DataTree extends Module{
600
604
  redrawNeeded(data){
601
605
  return (this.field ? typeof data[this.field] !== "undefined" : false) || (this.elementField ? typeof data[this.elementField] !== "undefined" : false);
602
606
  }
603
- }
604
-
605
- DataTree.moduleName = "dataTree";
606
-
607
- export default DataTree;
607
+ }
@@ -2,7 +2,12 @@ import Module from '../../core/Module.js';
2
2
 
3
3
  import defaultDownloaders from './defaults/downloaders.js';
4
4
 
5
- class Download extends Module{
5
+ export default class Download extends Module{
6
+
7
+ static moduleName = "download";
8
+
9
+ //load defaults
10
+ static downloaders = defaultDownloaders;
6
11
 
7
12
  constructor(table){
8
13
  super(table);
@@ -10,7 +15,7 @@ class Download extends Module{
10
15
  this.registerTableOption("downloadEncoder", function(data, mimeType){
11
16
  return new Blob([data],{type:mimeType});
12
17
  }); //function to manipulate download data
13
- this.registerTableOption("downloadReady", undefined); //warn of function deprecation
18
+ // this.registerTableOption("downloadReady", undefined); //warn of function deprecation
14
19
  this.registerTableOption("downloadConfig", {}); //download config
15
20
  this.registerTableOption("downloadRowRange", "active"); //restrict download to active rows only
16
21
 
@@ -26,7 +31,7 @@ class Download extends Module{
26
31
  }
27
32
 
28
33
  deprecatedOptionsCheck(){
29
- this.deprecationCheck("downloadReady", "downloadEncoder");
34
+ // this.deprecationCheck("downloadReady", "downloadEncoder");
30
35
  }
31
36
 
32
37
  ///////////////////////////////////
@@ -139,11 +144,4 @@ class Download extends Module{
139
144
  break;
140
145
  }
141
146
  }
142
- }
143
-
144
- Download.moduleName = "download";
145
-
146
- //load defaults
147
- Download.downloaders = defaultDownloaders;
148
-
149
- export default Download;
147
+ }
@@ -3,7 +3,12 @@ import Helpers from '../../core/tools/Helpers.js';
3
3
 
4
4
  import defaultEditors from './defaults/editors.js';
5
5
 
6
- class Edit extends Module{
6
+ export default class Edit extends Module{
7
+
8
+ static moduleName = "edit";
9
+
10
+ //load defaults
11
+ static editors = defaultEditors;
7
12
 
8
13
  constructor(table){
9
14
  super(table);
@@ -13,19 +18,24 @@ class Edit extends Module{
13
18
  this.recursionBlock = false; //prevent focus recursion
14
19
  this.invalidEdit = false;
15
20
  this.editedCells = [];
21
+ this.convertEmptyValues = false;
16
22
 
17
23
  this.editors = Edit.editors;
18
-
24
+
25
+ this.registerTableOption("editTriggerEvent", "focus");
26
+ this.registerTableOption("editorEmptyValue");
27
+ this.registerTableOption("editorEmptyValueFunc", this.emptyValueCheck.bind(this));
28
+
19
29
  this.registerColumnOption("editable");
20
30
  this.registerColumnOption("editor");
21
31
  this.registerColumnOption("editorParams");
32
+ this.registerColumnOption("editorEmptyValue");
33
+ this.registerColumnOption("editorEmptyValueFunc");
22
34
 
23
35
  this.registerColumnOption("cellEditing");
24
36
  this.registerColumnOption("cellEdited");
25
37
  this.registerColumnOption("cellEditCancelled");
26
38
 
27
- this.registerTableOption("editTriggerEvent", "focus");
28
-
29
39
  this.registerTableFunction("getEditedCells", this.getEditedCells.bind(this));
30
40
  this.registerTableFunction("clearCellEdited", this.clearCellEdited.bind(this));
31
41
  this.registerTableFunction("navigatePrev", this.navigatePrev.bind(this));
@@ -62,11 +72,14 @@ class Edit extends Module{
62
72
  this.subscribe("keybinding-nav-prev", this.navigatePrev.bind(this, undefined));
63
73
  this.subscribe("keybinding-nav-next", this.keybindingNavigateNext.bind(this));
64
74
 
65
-
66
75
  // this.subscribe("keybinding-nav-left", this.navigateLeft.bind(this, undefined));
67
76
  // this.subscribe("keybinding-nav-right", this.navigateRight.bind(this, undefined));
68
77
  this.subscribe("keybinding-nav-up", this.navigateUp.bind(this, undefined));
69
78
  this.subscribe("keybinding-nav-down", this.navigateDown.bind(this, undefined));
79
+
80
+ if(Object.keys(this.table.options).includes("editorEmptyValue")){
81
+ this.convertEmptyValues = true;
82
+ }
70
83
  }
71
84
 
72
85
 
@@ -378,11 +391,16 @@ class Edit extends Module{
378
391
 
379
392
  //initialize column editor
380
393
  initializeColumn(column){
394
+ var convertEmpty = Object.keys(column.definition).includes("editorEmptyValue");
395
+
381
396
  var config = {
382
397
  editor:false,
383
398
  blocked:false,
384
399
  check:column.definition.editable,
385
- params:column.definition.editorParams || {}
400
+ params:column.definition.editorParams || {},
401
+ convertEmptyValues:convertEmpty,
402
+ editorEmptyValue:column.definition.editorEmptyValue,
403
+ editorEmptyValueFunc:column.definition.editorEmptyValueFunc,
386
404
  };
387
405
 
388
406
  //set column editor
@@ -628,6 +646,8 @@ class Edit extends Module{
628
646
  if(self.editedCells.indexOf(cell) == -1){
629
647
  self.editedCells.push(cell);
630
648
  }
649
+
650
+ value = self.transformEmptyValues(value, cell);
631
651
 
632
652
  cell.setValue(value, true);
633
653
 
@@ -740,6 +760,26 @@ class Edit extends Module{
740
760
  return false;
741
761
  }
742
762
  }
763
+
764
+ emptyValueCheck(value){
765
+ return value === "" || value === null || typeof value === "undefined";
766
+ }
767
+
768
+ transformEmptyValues(value, cell){
769
+ var mod = cell.column.modules.edit,
770
+ convert = mod.convertEmptyValues || this.convertEmptyValues,
771
+ checkFunc;
772
+
773
+ if(convert){
774
+ checkFunc = mod.editorEmptyValueFunc || this.options("editorEmptyValueFunc");
775
+
776
+ if(checkFunc && checkFunc(value)){
777
+ value = mod.convertEmptyValues ? mod.editorEmptyValue : this.options("editorEmptyValue");
778
+ }
779
+ }
780
+
781
+ return value;
782
+ }
743
783
 
744
784
  blur(element){
745
785
  if(!this.confirm("edit-blur", [element]) ){
@@ -772,12 +812,4 @@ class Edit extends Module{
772
812
  this.editedCells.splice(editIndex, 1);
773
813
  }
774
814
  }
775
- }
776
-
777
- Edit.moduleName = "edit";
778
-
779
- //load defaults
780
- Edit.editors = defaultEditors;
781
-
782
-
783
- export default Edit;
815
+ }
@@ -46,21 +46,21 @@ export default class Edit{
46
46
  }
47
47
 
48
48
  _deprecatedOptionsCheck(){
49
- if(this.params.listItemFormatter){
50
- this.cell.getTable().deprecationAdvisor.msg("The listItemFormatter editor param has been deprecated, please see the latest editor documentation for updated options");
51
- }
49
+ // if(this.params.listItemFormatter){
50
+ // this.cell.getTable().deprecationAdvisor.msg("The listItemFormatter editor param has been deprecated, please see the latest editor documentation for updated options");
51
+ // }
52
52
 
53
- if(this.params.sortValuesList){
54
- this.cell.getTable().deprecationAdvisor.msg("The sortValuesList editor param has been deprecated, please see the latest editor documentation for updated options");
55
- }
53
+ // if(this.params.sortValuesList){
54
+ // this.cell.getTable().deprecationAdvisor.msg("The sortValuesList editor param has been deprecated, please see the latest editor documentation for updated options");
55
+ // }
56
56
 
57
- if(this.params.searchFunc){
58
- this.cell.getTable().deprecationAdvisor.msg("The searchFunc editor param has been deprecated, please see the latest editor documentation for updated options");
59
- }
57
+ // if(this.params.searchFunc){
58
+ // this.cell.getTable().deprecationAdvisor.msg("The searchFunc editor param has been deprecated, please see the latest editor documentation for updated options");
59
+ // }
60
60
 
61
- if(this.params.searchingPlaceholder){
62
- this.cell.getTable().deprecationAdvisor.msg("The searchingPlaceholder editor param has been deprecated, please see the latest editor documentation for updated options");
63
- }
61
+ // if(this.params.searchingPlaceholder){
62
+ // this.cell.getTable().deprecationAdvisor.msg("The searchingPlaceholder editor param has been deprecated, please see the latest editor documentation for updated options");
63
+ // }
64
64
  }
65
65
 
66
66
  _initializeValue(){
@@ -43,8 +43,6 @@ export default function(cell, onRendered, success, cancel, editorParams){
43
43
  console.error("Editor Error - 'date' editor 'format' param is dependant on luxon.js");
44
44
  }
45
45
  }
46
-
47
- console.log("val", cellValue);
48
46
 
49
47
  input.value = cellValue;
50
48
 
@@ -5,9 +5,7 @@ import range from './editors/range.js';
5
5
  import date from './editors/date.js';
6
6
  import time from './editors/time.js';
7
7
  import datetime from './editors/datetime.js';
8
- import select from './editors/select.js';
9
8
  import list from './editors/list.js';
10
- import autocomplete from './editors/autocomplete.js';
11
9
  import star from './editors/star.js';
12
10
  import progress from './editors/progress.js';
13
11
  import tickCross from './editors/tickCross.js';
@@ -20,9 +18,7 @@ export default {
20
18
  date:date,
21
19
  time:time,
22
20
  datetime:datetime,
23
- select:select,
24
21
  list:list,
25
- autocomplete:autocomplete,
26
22
  star:star,
27
23
  progress:progress,
28
24
  tickCross:tickCross,
@@ -3,7 +3,15 @@ import Module from '../../core/Module.js';
3
3
  import ExportRow from './ExportRow.js';
4
4
  import ExportColumn from './ExportColumn.js';
5
5
 
6
- class Export extends Module{
6
+ import columnLookups from './defaults/columnLookups.js';
7
+ import rowLookups from './defaults/rowLookups.js';
8
+
9
+ export default class Export extends Module{
10
+
11
+ static moduleName = "export";
12
+
13
+ static columnLookups = columnLookups;
14
+ static rowLookups = rowLookups;
7
15
 
8
16
  constructor(table){
9
17
  super(table);
@@ -11,6 +19,7 @@ class Export extends Module{
11
19
  this.config = {};
12
20
  this.cloneTableStyle = true;
13
21
  this.colVisProp = "";
22
+ this.colVisPropAttach = "";
14
23
 
15
24
  this.registerTableOption("htmlOutputConfig", false); //html output config
16
25
 
@@ -22,32 +31,32 @@ class Export extends Module{
22
31
  this.registerTableFunction("getHtml", this.getHtml.bind(this));
23
32
  }
24
33
 
25
- ///////////////////////////////////
26
- ///////// Table Functions /////////
27
- ///////////////////////////////////
28
-
29
-
30
34
  ///////////////////////////////////
31
35
  ///////// Internal Logic //////////
32
36
  ///////////////////////////////////
33
37
 
34
38
  generateExportList(config, style, range, colVisProp){
39
+ var headers, body, columns, colLookup;
40
+
35
41
  this.cloneTableStyle = style;
36
42
  this.config = config || {};
37
43
  this.colVisProp = colVisProp;
44
+ this.colVisPropAttach = this.colVisProp.charAt(0).toUpperCase() + this.colVisProp.slice(1);
45
+
46
+ colLookup = Export.columnLookups[range];
47
+
48
+ if(colLookup){
49
+ columns = colLookup.call(this.table);
50
+ columns = columns.filter(col => this.columnVisCheck(col));
51
+ }
52
+
53
+ headers = this.config.columnHeaders !== false ? this.headersToExportRows(this.generateColumnGroupHeaders(columns)) : [];
38
54
 
39
- var headers, body;
40
-
41
- if (range === 'range') {
42
- var columns = this.table.modules.selectRange.selectedColumns();
43
- headers = this.config.columnHeaders !== false
44
- ? this.headersToExportRows(this.generateColumnGroupHeaders(columns))
45
- : [];
46
- body = this.bodyToExportRows(this.rowLookup(range), this.table.modules.selectRange.selectedColumns(true));
47
- } else {
48
- headers = this.config.columnHeaders !== false ? this.headersToExportRows(this.generateColumnGroupHeaders()) : [];
49
- body = this.bodyToExportRows(this.rowLookup(range));
55
+ if(columns){
56
+ columns = columns.map(col => col.getComponent());
50
57
  }
58
+
59
+ body = this.bodyToExportRows(this.rowLookup(range), columns);
51
60
 
52
61
  return headers.concat(body);
53
62
  }
@@ -59,7 +68,8 @@ class Export extends Module{
59
68
  }
60
69
 
61
70
  rowLookup(range){
62
- var rows = [];
71
+ var rows = [],
72
+ rowLookup;
63
73
 
64
74
  if(typeof range == "function"){
65
75
  range.call(this.table).forEach((row) =>{
@@ -70,32 +80,9 @@ class Export extends Module{
70
80
  }
71
81
  });
72
82
  }else{
73
- switch(range){
74
- case true:
75
- case "visible":
76
- rows = this.table.rowManager.getVisibleRows(false, true);
77
- break;
78
-
79
- case "all":
80
- rows = this.table.rowManager.rows;
81
- break;
82
-
83
- case "selected":
84
- rows = this.table.modules.selectRow.selectedRows;
85
- break;
83
+ rowLookup = Export.rowLookups[range] || Export.rowLookups["active"];
86
84
 
87
- case "range":
88
- rows = this.table.modules.selectRange.selectedRows();
89
- break;
90
-
91
- case "active":
92
- default:
93
- if(this.table.options.pagination){
94
- rows = this.table.rowManager.getDisplayRows(this.table.rowManager.displayRows.length - 2);
95
- }else{
96
- rows = this.table.rowManager.getDisplayRows();
97
- }
98
- }
85
+ rows = rowLookup.call(this.table);
99
86
  }
100
87
 
101
88
  return Object.assign([], rows);
@@ -116,13 +103,15 @@ class Export extends Module{
116
103
  }
117
104
  });
118
105
 
106
+
107
+
119
108
  return output;
120
109
  }
121
110
 
122
111
  processColumnGroup(column){
123
112
  var subGroups = column.columns,
124
113
  maxDepth = 0,
125
- title = column.definition["title" + (this.colVisProp.charAt(0).toUpperCase() + this.colVisProp.slice(1))] || column.definition.title;
114
+ title = column.definition["title" + (this.colVisPropAttach)] || column.definition.title;
126
115
 
127
116
  var groupData = {
128
117
  title:title,
@@ -165,12 +154,20 @@ class Export extends Module{
165
154
 
166
155
  columnVisCheck(column){
167
156
  var visProp = column.definition[this.colVisProp];
157
+
158
+ if(this.config.rowHeaders === false && column.isRowHeader){
159
+ return false;
160
+ }
168
161
 
169
162
  if(typeof visProp === "function"){
170
163
  visProp = visProp.call(this.table, column.getComponent());
171
164
  }
172
-
173
- return visProp !== false && (column.visible || (!column.visible && visProp));
165
+
166
+ if(visProp === false || visProp === true){
167
+ return visProp;
168
+ }
169
+
170
+ return column.visible && column.field;
174
171
  }
175
172
 
176
173
  headersToExportRows(columns){
@@ -313,7 +310,7 @@ class Export extends Module{
313
310
  headerEl = document.createElement("thead"),
314
311
  bodyEl = document.createElement("tbody"),
315
312
  styles = this.lookupTableStyles(),
316
- rowFormatter = this.table.options["rowFormatter" + (this.colVisProp.charAt(0).toUpperCase() + this.colVisProp.slice(1))],
313
+ rowFormatter = this.table.options["rowFormatter" + (this.colVisPropAttach)],
317
314
  setup = {};
318
315
 
319
316
  setup.rowFormatter = rowFormatter !== null ? rowFormatter : this.table.options.rowFormatter;
@@ -323,7 +320,7 @@ class Export extends Module{
323
320
  }
324
321
 
325
322
  //assign group header formatter
326
- setup.groupHeader = this.table.options["groupHeader" + (this.colVisProp.charAt(0).toUpperCase() + this.colVisProp.slice(1))];
323
+ setup.groupHeader = this.table.options["groupHeader" + (this.colVisPropAttach)];
327
324
 
328
325
  if(setup.groupHeader && !Array.isArray(setup.groupHeader)){
329
326
  setup.groupHeader = [setup.groupHeader];
@@ -332,8 +329,7 @@ class Export extends Module{
332
329
  table.classList.add("tabulator-print-table");
333
330
 
334
331
  this.mapElementStyles(this.table.columnManager.getHeadersElement(), headerEl, ["border-top", "border-left", "border-right", "border-bottom", "background-color", "color", "font-weight", "font-family", "font-size"]);
335
-
336
-
332
+
337
333
  if(list.length > 1000){
338
334
  console.warn("It may take a long time to render an HTML table with more than 1000 rows");
339
335
  }
@@ -387,6 +383,7 @@ class Export extends Module{
387
383
 
388
384
  if(styles.firstRow){
389
385
  styles.styleCells = styles.firstRow.getElementsByClassName("tabulator-cell");
386
+ styles.styleRowHeader = styles.firstRow.getElementsByClassName("tabulator-row-header")[0];
390
387
  styles.firstCell = styles.styleCells[0];
391
388
  styles.lastCell = styles.styleCells[styles.styleCells.length - 1];
392
389
  }
@@ -416,9 +413,9 @@ class Export extends Module{
416
413
  cellEl.classList.add(className);
417
414
  });
418
415
 
419
- this.mapElementStyles(column.component.getElement(), cellEl, ["text-align", "border-top", "border-left", "border-right", "border-bottom", "background-color", "color", "font-weight", "font-family", "font-size"]);
416
+ this.mapElementStyles(column.component.getElement(), cellEl, ["text-align", "border-left", "border-right", "background-color", "color", "font-weight", "font-family", "font-size"]);
420
417
  this.mapElementStyles(column.component._column.contentElement, cellEl, ["padding-top", "padding-left", "padding-right", "padding-bottom"]);
421
-
418
+
422
419
  if(column.component._column.visible){
423
420
  this.mapElementStyles(column.component.getElement(), cellEl, ["width"]);
424
421
  }else{
@@ -427,8 +424,16 @@ class Export extends Module{
427
424
  }
428
425
  }
429
426
 
430
- if(column.component._column.parent){
427
+ if(column.component._column.parent && column.component._column.parent.isGroup){
431
428
  this.mapElementStyles(column.component._column.parent.groupElement, cellEl, ["border-top"]);
429
+ }else{
430
+ this.mapElementStyles(column.component.getElement(), cellEl, ["border-top"]);
431
+ }
432
+
433
+ if(column.component._column.isGroup){
434
+ this.mapElementStyles(column.component.getElement(), cellEl, ["border-bottom"]);
435
+ }else{
436
+ this.mapElementStyles(this.table.columnManager.getElement(), cellEl, ["border-bottom"]);
432
437
  }
433
438
 
434
439
  rowEl.appendChild(cellEl);
@@ -493,7 +498,7 @@ class Export extends Module{
493
498
  table = this.table,
494
499
  index = table.columnManager.findColumnIndex(column),
495
500
  value = col.value,
496
- cellStyle;
501
+ cellStyle, styleProps;
497
502
 
498
503
  var cellWrapper = {
499
504
  modules:{},
@@ -552,11 +557,18 @@ class Export extends Module{
552
557
  }else{
553
558
  cellEl.innerHTML = value;
554
559
  }
555
-
556
- cellStyle = styles.styleCells && styles.styleCells[index] ? styles.styleCells[index] : styles.firstCell;
560
+
561
+ styleProps = ["padding-top", "padding-left", "padding-right", "padding-bottom", "border-top", "border-left", "border-right", "border-bottom", "color", "font-weight", "font-family", "font-size", "text-align"];
562
+
563
+ if(column.isRowHeader){
564
+ cellStyle = styles.styleRowHeader;
565
+ styleProps.push("background-color");
566
+ }else{
567
+ cellStyle = styles.styleCells && styles.styleCells[index] ? styles.styleCells[index] : styles.firstCell;
568
+ }
557
569
 
558
570
  if(cellStyle){
559
- this.mapElementStyles(cellStyle, cellEl, ["padding-top", "padding-left", "padding-right", "padding-bottom", "border-top", "border-left", "border-right", "border-bottom", "color", "font-weight", "font-family", "font-size", "text-align"]);
571
+ this.mapElementStyles(cellStyle, cellEl, styleProps);
560
572
 
561
573
  if(column.definition.align){
562
574
  cellEl.style.textAlign = column.definition.align;
@@ -630,7 +642,7 @@ class Export extends Module{
630
642
 
631
643
  if(window.getComputedStyle){
632
644
  var fromStyle = window.getComputedStyle(from);
633
-
645
+
634
646
  props.forEach(function(prop){
635
647
  if(!to.style[lookup[prop]]){
636
648
  to.style[lookup[prop]] = fromStyle.getPropertyValue(prop);
@@ -640,7 +652,3 @@ class Export extends Module{
640
652
  }
641
653
  }
642
654
  }
643
-
644
- Export.moduleName = "export";
645
-
646
- export default Export;
@@ -1,4 +1,4 @@
1
- class ExportColumn{
1
+ export default class ExportColumn{
2
2
  constructor(value, component, width, height, depth){
3
3
  this.value = value;
4
4
  this.component = component || false;
@@ -6,6 +6,4 @@ class ExportColumn{
6
6
  this.height = height;
7
7
  this.depth = depth;
8
8
  }
9
- }
10
-
11
- export default ExportColumn;
9
+ }