tabulator-tables 5.6.1 → 6.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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 +3843 -2768
  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 +34 -21
  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,5 +1,3 @@
1
- import Column from './Column.js';
2
-
3
1
  //public column object
4
2
  export default class ColumnComponent {
5
3
  constructor (column){
@@ -92,7 +90,7 @@ export default class ColumnComponent {
92
90
  }
93
91
 
94
92
  getParentColumn(){
95
- return this._column.parent instanceof Column ? this._column.parent.getComponent() : false;
93
+ return this._column.getParentComponent();
96
94
  }
97
95
 
98
96
  _getSelf(){
@@ -17,6 +17,7 @@ export default {
17
17
 
18
18
  columns:[],//store for colum header info
19
19
  columnDefaults:{}, //store column default props
20
+ rowHeader:false,
20
21
 
21
22
  data:false, //default starting data
22
23
 
@@ -30,7 +30,8 @@ export {default as ResizeRowsModule} from '../../modules/ResizeRows/ResizeRows.j
30
30
  export {default as ResizeTableModule} from '../../modules/ResizeTable/ResizeTable.js';
31
31
  export {default as ResponsiveLayoutModule} from '../../modules/ResponsiveLayout/ResponsiveLayout.js';
32
32
  export {default as SelectRowModule} from '../../modules/SelectRow/SelectRow.js';
33
- export {default as SortModule} from '../../modules/Sort/Sort.js';
34
33
  export {default as SelectRangeModule} from '../../modules/SelectRange/SelectRange.js';
34
+ export {default as SortModule} from '../../modules/Sort/Sort.js';
35
+ export {default as SpreadsheetModule} from '../../modules/Spreadsheet/Spreadsheet.js';
35
36
  export {default as TooltipModule} from '../../modules/Tooltip/Tooltip.js';
36
37
  export {default as ValidateModule} from '../../modules/Validate/Validate.js';
@@ -138,20 +138,13 @@ export default class Row extends CoreFeature{
138
138
 
139
139
  //get heights when doing bulk row style calcs in virtual DOM
140
140
  calcHeight(force){
141
- var maxHeight = 0,
142
- minHeight;
143
-
141
+ var maxHeight = 0, minHeight = 0;
142
+
144
143
  if(this.table.options.rowHeight){
145
144
  this.height = this.table.options.rowHeight;
146
145
  }else{
147
- minHeight = this.table.options.resizableRows ? this.element.clientHeight : 0;
148
-
149
- this.cells.forEach(function(cell){
150
- var height = cell.getHeight();
151
- if(height > maxHeight){
152
- maxHeight = height;
153
- }
154
- });
146
+ minHeight = this.calcMinHeight();
147
+ maxHeight = this.calcMaxHeight();
155
148
 
156
149
  if(force){
157
150
  this.height = Math.max(maxHeight, minHeight);
@@ -163,6 +156,21 @@ export default class Row extends CoreFeature{
163
156
  this.heightStyled = this.height ? this.height + "px" : "";
164
157
  this.outerHeight = this.element.offsetHeight;
165
158
  }
159
+
160
+ calcMinHeight(){
161
+ return this.table.options.resizableRows ? this.element.clientHeight : 0;
162
+ }
163
+
164
+ calcMaxHeight(){
165
+ var maxHeight = 0;
166
+ this.cells.forEach(function(cell){
167
+ var height = cell.getHeight();
168
+ if(height > maxHeight){
169
+ maxHeight = height;
170
+ }
171
+ });
172
+ return maxHeight;
173
+ }
166
174
 
167
175
  //set of cells
168
176
  setCellHeight(){
@@ -203,6 +211,10 @@ export default class Row extends CoreFeature{
203
211
 
204
212
  // this.outerHeight = this.element.outerHeight();
205
213
  this.outerHeight = this.element.offsetHeight;
214
+
215
+ if(this.subscribedExternal("rowHeight")){
216
+ this.dispatchExternal("rowHeight", this.getComponent());
217
+ }
206
218
  }
207
219
  }
208
220
 
@@ -44,7 +44,7 @@ export default class DataLoader extends CoreFeature{
44
44
  response = this.mapParams(response, this.objectInvert(this.table.options.dataReceiveParams));
45
45
  }
46
46
 
47
- var rowData = this.chain("data-loaded", response, null, response);
47
+ var rowData = this.chain("data-loaded", [response], null, response);
48
48
 
49
49
  if(requestNo == this.requestOrder){
50
50
  this.clearAlert();
@@ -1,105 +1,153 @@
1
1
  import * as coreModules from '../modules/core.js';
2
2
  import TableRegistry from './TableRegistry.js';
3
3
 
4
- export default class ModuleBinder {
4
+ export default class ModuleBinder extends TableRegistry {
5
5
 
6
- constructor(tabulator, modules){
7
- this.bindStaticFunctionality(tabulator);
8
- this.bindModules(tabulator, coreModules, true);
9
-
10
- if(modules){
11
- this.bindModules(tabulator, modules);
6
+ static moduleBindings = {};
7
+ static moduleExtensions = {};
8
+ static modulesRegistered = false;
9
+
10
+ static defaultModules = false;
11
+
12
+ constructor(){
13
+ super();
14
+ }
15
+
16
+ static initializeModuleBinder(defaultModules){
17
+ if(!ModuleBinder.modulesRegistered){
18
+ ModuleBinder.modulesRegistered = true;
19
+ ModuleBinder._registerModules(coreModules, true);
20
+
21
+ if(defaultModules){
22
+ ModuleBinder._registerModules(defaultModules);
23
+ }
12
24
  }
13
25
  }
14
26
 
15
- bindStaticFunctionality(tabulator){
16
- tabulator.moduleBindings = {};
17
-
18
- tabulator.extendModule = function(name, property, values){
19
- if(tabulator.moduleBindings[name]){
20
- var source = tabulator.moduleBindings[name][property];
21
-
22
- if(source){
23
- if(typeof values == "object"){
24
- for(let key in values){
25
- source[key] = values[key];
26
- }
27
- }else{
28
- console.warn("Module Error - Invalid value type, it must be an object");
27
+ static _extendModule(name, property, values){
28
+ if(ModuleBinder.moduleBindings[name]){
29
+ var source = ModuleBinder.moduleBindings[name][property];
30
+
31
+ if(source){
32
+ if(typeof values == "object"){
33
+ for(let key in values){
34
+ source[key] = values[key];
29
35
  }
30
36
  }else{
31
- console.warn("Module Error - property does not exist:", property);
37
+ console.warn("Module Error - Invalid value type, it must be an object");
32
38
  }
33
39
  }else{
34
- console.warn("Module Error - module does not exist:", name);
40
+ console.warn("Module Error - property does not exist:", property);
35
41
  }
36
- };
42
+ }else{
43
+ console.warn("Module Error - module does not exist:", name);
44
+ }
45
+ }
46
+
47
+ static _registerModules(modules, core){
48
+ var mods = Object.values(modules);
37
49
 
38
- tabulator.registerModule = function(modules){
39
- if(!Array.isArray(modules)){
40
- modules = [modules];
41
- }
42
-
43
- modules.forEach((mod) => {
44
- tabulator.registerModuleBinding(mod);
50
+ if(core){
51
+ mods.forEach((mod) => {
52
+ mod.prototype.moduleCore = true;
45
53
  });
46
- };
54
+ }
47
55
 
48
- tabulator.registerModuleBinding = function(mod){
49
- tabulator.moduleBindings[mod.moduleName] = mod;
50
- };
56
+ ModuleBinder._registerModule(mods);
57
+ }
58
+
59
+ static _registerModule(modules){
60
+ if(!Array.isArray(modules)){
61
+ modules = [modules];
62
+ }
51
63
 
52
- tabulator.findTable = function(query){
53
- var results = TableRegistry.lookupTable(query, true);
54
- return Array.isArray(results) && !results.length ? false : results;
55
- };
64
+ modules.forEach((mod) => {
65
+ ModuleBinder._registerModuleBinding(mod);
66
+ ModuleBinder._registerModuleExtensions(mod);
67
+ });
68
+ }
69
+
70
+ static _registerModuleBinding(mod){
71
+ if(mod.moduleName){
72
+ ModuleBinder.moduleBindings[mod.moduleName] = mod;
73
+ }else{
74
+ console.error("Unable to bind module, no moduleName defined", mod.moduleName);
75
+ }
76
+ }
77
+
78
+ static _registerModuleExtensions(mod){
79
+ var extensions = mod.moduleExtensions;
56
80
 
57
- //ensure that module are bound to instantiated function
58
- tabulator.prototype.bindModules = function(){
59
- var orderedStartMods = [],
60
- orderedEndMods = [],
61
- unOrderedMods = [];
62
-
63
- this.modules = {};
64
-
65
- for(var name in tabulator.moduleBindings){
66
- let mod = tabulator.moduleBindings[name];
67
- let module = new mod(this);
68
-
69
- this.modules[name] = module;
81
+ if(mod.moduleExtensions){
82
+ for (let modKey in extensions) {
83
+ let ext = extensions[modKey];
70
84
 
71
- if(mod.prototype.moduleCore){
72
- this.modulesCore.push(module);
85
+ if(ModuleBinder.moduleBindings[modKey]){
86
+ for (let propKey in ext) {
87
+ ModuleBinder._extendModule(modKey, propKey, ext[propKey]);
88
+ }
73
89
  }else{
74
- if(mod.moduleInitOrder){
75
- if(mod.moduleInitOrder < 0){
76
- orderedStartMods.push(module);
77
- }else{
78
- orderedEndMods.push(module);
90
+ if(!ModuleBinder.moduleExtensions[modKey]){
91
+ ModuleBinder.moduleExtensions[modKey] = {};
92
+ }
93
+
94
+ for (let propKey in ext) {
95
+ if(!ModuleBinder.moduleExtensions[modKey][propKey]){
96
+ ModuleBinder.moduleExtensions[modKey][propKey] = {};
79
97
  }
80
-
81
- }else{
82
- unOrderedMods.push(module);
98
+
99
+ Object.assign(ModuleBinder.moduleExtensions[modKey][propKey], ext[propKey]);
83
100
  }
84
101
  }
85
102
  }
86
-
87
- orderedStartMods.sort((a, b) => a.moduleInitOrder > b.moduleInitOrder ? 1 : -1);
88
- orderedEndMods.sort((a, b) => a.moduleInitOrder > b.moduleInitOrder ? 1 : -1);
89
-
90
- this.modulesRegular = orderedStartMods.concat(unOrderedMods.concat(orderedEndMods));
91
- };
103
+ }
104
+
105
+ ModuleBinder._extendModuleFromQueue(mod);
92
106
  }
93
107
 
94
- bindModules(tabulator, modules, core){
95
- var mods = Object.values(modules);
108
+ static _extendModuleFromQueue(mod){
109
+ var extensions = ModuleBinder.moduleExtensions[mod.moduleName];
96
110
 
97
- if(core){
98
- mods.forEach((mod) => {
99
- mod.prototype.moduleCore = true;
100
- });
111
+ if(extensions){
112
+ for (let propKey in extensions) {
113
+ ModuleBinder._extendModule(mod.moduleName, propKey, extensions[propKey]);
114
+ }
101
115
  }
116
+ }
117
+
118
+ //ensure that module are bound to instantiated function
119
+ _bindModules(){
120
+ var orderedStartMods = [],
121
+ orderedEndMods = [],
122
+ unOrderedMods = [];
123
+
124
+ this.modules = {};
125
+
126
+ for(var name in ModuleBinder.moduleBindings){
127
+ let mod = ModuleBinder.moduleBindings[name];
128
+ let module = new mod(this);
129
+
130
+ this.modules[name] = module;
131
+
132
+ if(mod.prototype.moduleCore){
133
+ this.modulesCore.push(module);
134
+ }else{
135
+ if(mod.moduleInitOrder){
136
+ if(mod.moduleInitOrder < 0){
137
+ orderedStartMods.push(module);
138
+ }else{
139
+ orderedEndMods.push(module);
140
+ }
141
+
142
+ }else{
143
+ unOrderedMods.push(module);
144
+ }
145
+ }
146
+ }
147
+
148
+ orderedStartMods.sort((a, b) => a.moduleInitOrder > b.moduleInitOrder ? 1 : -1);
149
+ orderedEndMods.sort((a, b) => a.moduleInitOrder > b.moduleInitOrder ? 1 : -1);
102
150
 
103
- tabulator.registerModule(mods);
151
+ this.modulesRegular = orderedStartMods.concat(unOrderedMods.concat(orderedEndMods));
104
152
  }
105
153
  }
@@ -1,62 +1,65 @@
1
- import Tabulator from '../Tabulator.js';
2
-
3
- class TableRegistry {
4
-
5
- static register(table){
6
- TableRegistry.tables.push(table);
7
- }
8
-
9
- static deregister(table){
10
- var index = TableRegistry.tables.indexOf(table);
11
-
12
- if(index > -1){
13
- TableRegistry.tables.splice(index, 1);
14
- }
15
- }
16
-
17
- static lookupTable(query, silent){
18
- var results = [],
19
- matches, match;
20
-
21
- if(typeof query === "string"){
22
- matches = document.querySelectorAll(query);
23
-
24
- if(matches.length){
25
- for(var i = 0; i < matches.length; i++){
26
- match = TableRegistry.matchElement(matches[i]);
27
-
28
- if(match){
29
- results.push(match);
1
+ export default class TableRegistry {
2
+ static registry = {
3
+ tables:[],
4
+
5
+ register(table){
6
+ TableRegistry.registry.tables.push(table);
7
+ },
8
+
9
+ deregister(table){
10
+ var index = TableRegistry.registry.tables.indexOf(table);
11
+
12
+ if(index > -1){
13
+ TableRegistry.registry.tables.splice(index, 1);
14
+ }
15
+ },
16
+
17
+ lookupTable(query, silent){
18
+ var results = [],
19
+ matches, match;
20
+
21
+ if(typeof query === "string"){
22
+ matches = document.querySelectorAll(query);
23
+
24
+ if(matches.length){
25
+ for(var i = 0; i < matches.length; i++){
26
+ match = TableRegistry.registry.matchElement(matches[i]);
27
+
28
+ if(match){
29
+ results.push(match);
30
+ }
30
31
  }
31
32
  }
33
+
34
+ }else if((typeof HTMLElement !== "undefined" && query instanceof HTMLElement) || query instanceof TableRegistry){
35
+ match = TableRegistry.registry.matchElement(query);
36
+
37
+ if(match){
38
+ results.push(match);
39
+ }
40
+ }else if(Array.isArray(query)){
41
+ query.forEach(function(item){
42
+ results = results.concat(TableRegistry.registry.lookupTable(item));
43
+ });
44
+ }else{
45
+ if(!silent){
46
+ console.warn("Table Connection Error - Invalid Selector", query);
47
+ }
32
48
  }
33
-
34
- }else if((typeof HTMLElement !== "undefined" && query instanceof HTMLElement) || query instanceof Tabulator){
35
- match = TableRegistry.matchElement(query);
36
-
37
- if(match){
38
- results.push(match);
39
- }
40
- }else if(Array.isArray(query)){
41
- query.forEach(function(item){
42
- results = results.concat(TableRegistry.lookupTable(item));
49
+
50
+ return results;
51
+ },
52
+
53
+ matchElement(element){
54
+ return TableRegistry.registry.tables.find(function(table){
55
+ return element instanceof TableRegistry ? table === element : table.element === element;
43
56
  });
44
- }else{
45
- if(!silent){
46
- console.warn("Table Connection Error - Invalid Selector", query);
47
- }
48
57
  }
58
+ };
49
59
 
50
- return results;
51
- }
52
-
53
- static matchElement(element){
54
- return TableRegistry.tables.find(function(table){
55
- return element instanceof Tabulator ? table === element : table.element === element;
56
- });
60
+
61
+ static findTable(query){
62
+ var results = TableRegistry.registry.lookupTable(query, true);
63
+ return Array.isArray(results) && !results.length ? false : results;
57
64
  }
58
- }
59
-
60
- TableRegistry.tables = [];
61
-
62
- export default TableRegistry;
65
+ }
@@ -3,7 +3,12 @@ import Helpers from '../../core/tools/Helpers.js';
3
3
 
4
4
  import defaultAccessors from './defaults/accessors.js';
5
5
 
6
- class Accessor extends Module{
6
+ export default class Accessor extends Module{
7
+
8
+ static moduleName = "accessor";
9
+
10
+ //load defaults
11
+ static accessors = defaultAccessors;
7
12
 
8
13
  constructor(table){
9
14
  super(table);
@@ -107,10 +112,4 @@ class Accessor extends Module{
107
112
 
108
113
  return data;
109
114
  }
110
- }
111
-
112
- //load defaults
113
- Accessor.moduleName = "accessor";
114
- Accessor.accessors = defaultAccessors;
115
-
116
- export default Accessor;
115
+ }
@@ -1 +1,5 @@
1
- export default {};
1
+ export default {
2
+ rownum:function(value, data, type, params, column, row){
3
+ return row.getPosition();
4
+ }
5
+ };
@@ -5,7 +5,15 @@ import defaultURLGenerator from './defaults/urlGenerator.js';
5
5
  import defaultLoaderPromise from './defaults/loaderPromise.js';
6
6
  import defaultContentTypeFormatters from './defaults/contentTypeFormatters.js';
7
7
 
8
- class Ajax extends Module{
8
+ export default class Ajax extends Module{
9
+
10
+ static moduleName = "ajax";
11
+
12
+ //load defaults
13
+ static defaultConfig = defaultConfig;
14
+ static defaultURLGenerator = defaultURLGenerator;
15
+ static defaultLoaderPromise = defaultLoaderPromise;
16
+ static contentTypeFormatters = defaultContentTypeFormatters;
9
17
 
10
18
  constructor(table){
11
19
  super(table);
@@ -131,14 +139,4 @@ class Ajax extends Module{
131
139
  return Promise.reject();
132
140
  }
133
141
  }
134
- }
135
-
136
- Ajax.moduleName = "ajax";
137
-
138
- //load defaults
139
- Ajax.defaultConfig = defaultConfig;
140
- Ajax.defaultURLGenerator = defaultURLGenerator;
141
- Ajax.defaultLoaderPromise = defaultLoaderPromise;
142
- Ajax.contentTypeFormatters = defaultContentTypeFormatters;
143
-
144
- export default Ajax;
142
+ }
@@ -2,8 +2,16 @@ import Module from '../../core/Module.js';
2
2
 
3
3
  import defaultPasteActions from './defaults/pasteActions.js';
4
4
  import defaultPasteParsers from './defaults/pasteParsers.js';
5
+ import extensions from './extensions/extensions.js';
5
6
 
6
- class Clipboard extends Module{
7
+ export default class Clipboard extends Module{
8
+
9
+ static moduleName = "clipboard";
10
+ static moduleExtensions = extensions;
11
+
12
+ //load defaults
13
+ static pasteActions = defaultPasteActions;
14
+ static pasteParsers = defaultPasteParsers;
7
15
 
8
16
  constructor(table){
9
17
  super(table);
@@ -271,12 +279,4 @@ class Clipboard extends Module{
271
279
 
272
280
  return data;
273
281
  }
274
- }
275
-
276
- Clipboard.moduleName = "clipboard";
277
-
278
- //load defaults
279
- Clipboard.pasteActions = defaultPasteActions;
280
- Clipboard.pasteParsers = defaultPasteParsers;
281
-
282
- export default Clipboard;
282
+ }
@@ -8,47 +8,4 @@ export default {
8
8
  insert:function(data){
9
9
  return this.table.addData(data);
10
10
  },
11
- range:function(data){
12
- var rows = [],
13
- range = this.table.modules.selectRange.activeRange,
14
- singleCell = false,
15
- bounds, startCell, startRow, rowWidth, dataLength;
16
-
17
- dataLength = data.length;
18
-
19
- if(range){
20
- bounds = range.getBounds();
21
- startCell = bounds.start;
22
-
23
- if(bounds.start === bounds.end){
24
- singleCell = true;
25
- }
26
-
27
- if(startCell){
28
- rows = this.table.rowManager.activeRows.slice();
29
- startRow = rows.indexOf(startCell.row);
30
-
31
- if(singleCell){
32
- rowWidth = data.length;
33
- }else{
34
- rowWidth = (rows.indexOf(bounds.end.row) - startRow) + 1;
35
- }
36
-
37
-
38
- if(startRow >-1){
39
- this.table.blockRedraw();
40
-
41
- rows = rows.slice(startRow, startRow + rowWidth);
42
-
43
- rows.forEach((row, i) => {
44
- row.updateData(data[i % dataLength]);
45
- });
46
-
47
- this.table.restoreRedraw();
48
- }
49
- }
50
- }
51
-
52
- return rows;
53
- }
54
11
  };
@@ -72,59 +72,4 @@ export default {
72
72
  return false;
73
73
  }
74
74
  },
75
- range:function(clipboard){
76
- var data = [],
77
- rows = [],
78
- range = this.table.modules.selectRange.activeRange,
79
- singleCell = false,
80
- bounds, startCell, colWidth, columnMap, startCol;
81
-
82
- if(range){
83
- bounds = range.getBounds();
84
- startCell = bounds.start;
85
-
86
- if(bounds.start === bounds.end){
87
- singleCell = true;
88
- }
89
-
90
- if(startCell){
91
- //get data from clipboard into array of columns and rows.
92
- clipboard = clipboard.split("\n");
93
-
94
- clipboard.forEach(function(row){
95
- data.push(row.split("\t"));
96
- });
97
-
98
- if(data.length){
99
- columnMap = this.table.columnManager.getVisibleColumnsByIndex();
100
- startCol = columnMap.indexOf(startCell.column);
101
-
102
- if(startCol > -1){
103
- if(singleCell){
104
- colWidth = data[0].length;
105
- }else{
106
- colWidth = (columnMap.indexOf(bounds.end.column) - startCol) + 1;
107
- }
108
-
109
- columnMap = columnMap.slice(startCol, startCol + colWidth);
110
-
111
- data.forEach((item) => {
112
- var row = {};
113
- var itemLength = item.length;
114
-
115
- columnMap.forEach(function(col, i){
116
- row[col.field] = item[i % itemLength];
117
- });
118
-
119
- rows.push(row);
120
- });
121
-
122
- return rows;
123
- }
124
- }
125
- }
126
- }
127
-
128
- return false;
129
- }
130
75
  };
@@ -0,0 +1,9 @@
1
+ import bindings from './keybindings/bindings.js';
2
+ import actions from './keybindings/actions.js';
3
+
4
+ export default {
5
+ keybindings:{
6
+ bindings:bindings,
7
+ actions:actions
8
+ },
9
+ };
@@ -0,0 +1,9 @@
1
+ export default {
2
+ copyToClipboard:function(e){
3
+ if(!this.table.modules.edit.currentCell){
4
+ if(this.table.modExists("clipboard", true)){
5
+ this.table.modules.clipboard.copy(false, true);
6
+ }
7
+ }
8
+ },
9
+ };
@@ -0,0 +1,3 @@
1
+ export default {
2
+ copyToClipboard:["ctrl + 67", "meta + 67"],
3
+ };