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
@@ -4,7 +4,7 @@ import TableRegistry from './TableRegistry.js';
4
4
  export default class ModuleBinder {
5
5
 
6
6
  constructor(tabulator, modules){
7
- this.bindStaticFuctionality(tabulator);
7
+ this.bindStaticFunctionality(tabulator);
8
8
  this.bindModules(tabulator, coreModules, true);
9
9
 
10
10
  if(modules){
@@ -12,7 +12,7 @@ export default class ModuleBinder {
12
12
  }
13
13
  }
14
14
 
15
- bindStaticFuctionality(tabulator){
15
+ bindStaticFunctionality(tabulator){
16
16
  tabulator.moduleBindings = {};
17
17
 
18
18
  tabulator.extendModule = function(name, property, values){
@@ -41,9 +41,9 @@ export default class ModuleBinder {
41
41
  }
42
42
 
43
43
  modules.forEach((mod) => {
44
- tabulator.registerModuleBinding(mod)
44
+ tabulator.registerModuleBinding(mod);
45
45
  });
46
- }
46
+ };
47
47
 
48
48
  tabulator.registerModuleBinding = function(mod){
49
49
  tabulator.moduleBindings[mod.moduleName] = mod;
@@ -52,7 +52,7 @@ export default class ModuleBinder {
52
52
  tabulator.findTable = function(query){
53
53
  var results = TableRegistry.lookupTable(query, true);
54
54
  return Array.isArray(results) && !results.length ? false : results;
55
- }
55
+ };
56
56
 
57
57
  //ensure that module are bound to instantiated function
58
58
  tabulator.prototype.bindModules = function(){
@@ -88,7 +88,7 @@ export default class ModuleBinder {
88
88
  orderedEndMods.sort((a, b) => a.moduleInitOrder > b.moduleInitOrder ? 1 : -1);
89
89
 
90
90
  this.modulesRegular = orderedStartMods.concat(unOrderedMods.concat(orderedEndMods));
91
- }
91
+ };
92
92
  }
93
93
 
94
94
  bindModules(tabulator, modules, core){
@@ -2,7 +2,7 @@ export default class OptionsList {
2
2
  constructor(table, msgType, defaults = {}){
3
3
  this.table = table;
4
4
  this.msgType = msgType;
5
- this.registeredDefaults = Object.assign({}, defaults)
5
+ this.registeredDefaults = Object.assign({}, defaults);
6
6
  }
7
7
 
8
8
  register(option, value){
@@ -15,14 +15,14 @@ export default class OptionsList {
15
15
  Object.assign(output, defaultOptions);
16
16
 
17
17
  if(userOptions.debugInvalidOptions !== false || this.table.options.debugInvalidOptions){
18
- for (var key in userOptions){
18
+ for (let key in userOptions){
19
19
  if(!output.hasOwnProperty(key)){
20
- console.warn("Invalid " + this.msgType + " option:", key)
20
+ console.warn("Invalid " + this.msgType + " option:", key);
21
21
  }
22
22
  }
23
23
  }
24
24
 
25
- for (var key in output){
25
+ for (let key in output){
26
26
  if(key in userOptions){
27
27
  output[key] = userOptions[key];
28
28
  }else{
@@ -2,273 +2,282 @@ import CoreFeature from '../CoreFeature.js';
2
2
  import Helpers from './Helpers.js';
3
3
 
4
4
  export default class Popup extends CoreFeature{
5
- constructor(table, element, parent){
6
- super(table);
5
+ constructor(table, element, parent){
6
+ super(table);
7
7
 
8
- this.element = element;
9
- this.container = this._lookupContainer();
8
+ this.element = element;
9
+ this.container = this._lookupContainer();
10
10
 
11
- this.parent = parent;
11
+ this.parent = parent;
12
12
 
13
- this.reversedX = false;
14
- this.childPopup = null;
15
- this.blurable = false;
16
- this.blurCallback = null;
17
- this.renderedCallback = null;
13
+ this.reversedX = false;
14
+ this.childPopup = null;
15
+ this.blurable = false;
16
+ this.blurCallback = null;
17
+ this.renderedCallback = null;
18
18
 
19
- this.visible = false;
19
+ this.visible = false;
20
+ this.hideable = true;
20
21
 
21
- this.element.classList.add("tabulator-popup-container");
22
+ this.element.classList.add("tabulator-popup-container");
22
23
 
23
- this.blurEvent = this.hide.bind(this, false);
24
- this.escEvent = this._escapeCheck.bind(this);
24
+ this.blurEvent = this.hide.bind(this, false);
25
+ this.escEvent = this._escapeCheck.bind(this);
25
26
 
26
- this.destroyBinding = this.tableDestroyed;
27
- this.destroyed = false;
28
- }
27
+ this.destroyBinding = this.tableDestroyed;
28
+ this.destroyed = false;
29
+ }
29
30
 
30
- tableDestroyed(){
31
- this.destroyed = true;
32
- this.hide(true);
33
- }
31
+ tableDestroyed(){
32
+ this.destroyed = true;
33
+ this.hide(true);
34
+ }
34
35
 
35
- _lookupContainer(){
36
- var container = this.table.options.popupContainer;
36
+ _lookupContainer(){
37
+ var container = this.table.options.popupContainer;
37
38
 
38
- if(typeof container === "string"){
39
- container = document.querySelector(container);
39
+ if(typeof container === "string"){
40
+ container = document.querySelector(container);
40
41
 
41
- if(!container){
42
- console.warn("Menu Error - no container element found matching selector:", this.table.options.popupContainer , "(defaulting to document body)");
43
- }
44
- }else if (container === true){
45
- container = this.table.element;
46
- }
42
+ if(!container){
43
+ console.warn("Menu Error - no container element found matching selector:", this.table.options.popupContainer , "(defaulting to document body)");
44
+ }
45
+ }else if (container === true){
46
+ container = this.table.element;
47
+ }
47
48
 
48
- if(container && !this._checkContainerIsParent(container)){
49
- container = false;
50
- console.warn("Menu Error - container element does not contain this table:", this.table.options.popupContainer , "(defaulting to document body)");
51
- }
49
+ if(container && !this._checkContainerIsParent(container)){
50
+ container = false;
51
+ console.warn("Menu Error - container element does not contain this table:", this.table.options.popupContainer , "(defaulting to document body)");
52
+ }
52
53
 
53
- if(!container){
54
- container = document.body;
55
- }
54
+ if(!container){
55
+ container = document.body;
56
+ }
56
57
 
57
- return container;
58
- }
58
+ return container;
59
+ }
59
60
 
60
- _checkContainerIsParent(container, element = this.table.element){
61
- if(container === element){
62
- return true;
63
- }else{
64
- return element.parentNode ? this._checkContainerIsParent(container, element.parentNode) : false;
65
- }
66
- }
61
+ _checkContainerIsParent(container, element = this.table.element){
62
+ if(container === element){
63
+ return true;
64
+ }else{
65
+ return element.parentNode ? this._checkContainerIsParent(container, element.parentNode) : false;
66
+ }
67
+ }
67
68
 
68
- renderCallback(callback){
69
- this.renderedCallback = callback;
70
- }
69
+ renderCallback(callback){
70
+ this.renderedCallback = callback;
71
+ }
71
72
 
72
- containerEventCoords(e){
73
- var touch = !(e instanceof MouseEvent);
73
+ containerEventCoords(e){
74
+ var touch = !(e instanceof MouseEvent);
74
75
 
75
- var x = touch ? e.touches[0].pageX : e.pageX;
76
- var y = touch ? e.touches[0].pageY : e.pageY;
76
+ var x = touch ? e.touches[0].pageX : e.pageX;
77
+ var y = touch ? e.touches[0].pageY : e.pageY;
77
78
 
78
- if(this.container !== document.body){
79
- let parentOffset = Helpers.elOffset(this.container);
79
+ if(this.container !== document.body){
80
+ let parentOffset = Helpers.elOffset(this.container);
80
81
 
81
- x -= parentOffset.left;
82
- y -= parentOffset.top;
83
- }
82
+ x -= parentOffset.left;
83
+ y -= parentOffset.top;
84
+ }
84
85
 
85
- return {x, y};
86
- }
86
+ return {x, y};
87
+ }
87
88
 
88
- elementPositionCoords(element, position = "right"){
89
- var offset = Helpers.elOffset(element),
90
- containerOffset, x, y;
89
+ elementPositionCoords(element, position = "right"){
90
+ var offset = Helpers.elOffset(element),
91
+ containerOffset, x, y;
91
92
 
92
- if(this.container !== document.body){
93
- containerOffset = Helpers.elOffset(this.container);
93
+ if(this.container !== document.body){
94
+ containerOffset = Helpers.elOffset(this.container);
94
95
 
95
- offset.left -= containerOffset.left;
96
- offset.top -= containerOffset.top;
97
- }
96
+ offset.left -= containerOffset.left;
97
+ offset.top -= containerOffset.top;
98
+ }
98
99
 
99
- switch(position){
100
- case "right":
101
- x = offset.left + element.offsetWidth;
102
- y = offset.top - 1;
103
- break;
100
+ switch(position){
101
+ case "right":
102
+ x = offset.left + element.offsetWidth;
103
+ y = offset.top - 1;
104
+ break;
104
105
 
105
- case "bottom":
106
- x = offset.left;
107
- y = offset.top + element.offsetHeight;
108
- break;
109
- }
106
+ case "bottom":
107
+ x = offset.left;
108
+ y = offset.top + element.offsetHeight;
109
+ break;
110
+ }
110
111
 
111
- return {x, y, offset};
112
- }
112
+ return {x, y, offset};
113
+ }
113
114
 
114
- show(origin, position){
115
- var x, y, parentEl, parentOffset, containerOffset, coords;
115
+ show(origin, position){
116
+ var x, y, parentEl, parentOffset, coords;
116
117
 
117
- if(this.destroyed || this.table.destroyed){
118
- return this;
119
- }
118
+ if(this.destroyed || this.table.destroyed){
119
+ return this;
120
+ }
120
121
 
121
- if(origin instanceof HTMLElement){
122
- parentEl = origin;
123
- coords = this.elementPositionCoords(origin, position);
122
+ if(origin instanceof HTMLElement){
123
+ parentEl = origin;
124
+ coords = this.elementPositionCoords(origin, position);
124
125
 
125
- parentOffset = coords.offset;
126
- x = coords.x;
127
- y = coords.y;
126
+ parentOffset = coords.offset;
127
+ x = coords.x;
128
+ y = coords.y;
128
129
 
129
- }else if(typeof origin === "number"){
130
- parentOffset = {top:0, left:0};
131
- x = origin;
132
- y = position;
133
- }else{
134
- coords = this.containerEventCoords(origin);
130
+ }else if(typeof origin === "number"){
131
+ parentOffset = {top:0, left:0};
132
+ x = origin;
133
+ y = position;
134
+ }else{
135
+ coords = this.containerEventCoords(origin);
135
136
 
136
- x = coords.x;
137
- y = coords.y;
137
+ x = coords.x;
138
+ y = coords.y;
138
139
 
139
- this.reversedX = false;
140
- }
140
+ this.reversedX = false;
141
+ }
141
142
 
142
- this.element.style.top = y + "px";
143
- this.element.style.left = x + "px";
143
+ this.element.style.top = y + "px";
144
+ this.element.style.left = x + "px";
144
145
 
145
- this.container.appendChild(this.element);
146
+ this.container.appendChild(this.element);
146
147
 
147
- if(typeof this.renderedCallback === "function"){
148
- this.renderedCallback();
149
- }
148
+ if(typeof this.renderedCallback === "function"){
149
+ this.renderedCallback();
150
+ }
150
151
 
151
- this._fitToScreen(x, y, parentEl, parentOffset, position);
152
+ this._fitToScreen(x, y, parentEl, parentOffset, position);
152
153
 
153
- this.visible = true;
154
+ this.visible = true;
154
155
 
155
- this.subscribe("table-destroy", this.destroyBinding);
156
+ this.subscribe("table-destroy", this.destroyBinding);
156
157
 
157
- this.element.addEventListener("mousedown", (e) => {
158
- e.stopPropagation();
159
- })
158
+ this.element.addEventListener("mousedown", (e) => {
159
+ e.stopPropagation();
160
+ });
160
161
 
161
- return this;
162
- }
162
+ return this;
163
+ }
163
164
 
164
- _fitToScreen(x, y, parentEl, parentOffset, position){
165
- var scrollTop = this.container === document.body ? document.documentElement.scrollTop : this.container.scrollTop;
165
+ _fitToScreen(x, y, parentEl, parentOffset, position){
166
+ var scrollTop = this.container === document.body ? document.documentElement.scrollTop : this.container.scrollTop;
166
167
 
167
- //move menu to start on right edge if it is too close to the edge of the screen
168
- if((x + this.element.offsetWidth) >= this.container.offsetWidth || this.reversedX){
169
- this.element.style.left = "";
168
+ //move menu to start on right edge if it is too close to the edge of the screen
169
+ if((x + this.element.offsetWidth) >= this.container.offsetWidth || this.reversedX){
170
+ this.element.style.left = "";
170
171
 
171
- if(parentEl){
172
- this.element.style.right = (this.container.offsetWidth - parentOffset.left) + "px";
173
- }else{
174
- this.element.style.right = (this.container.offsetWidth - x) + "px";
175
- }
172
+ if(parentEl){
173
+ this.element.style.right = (this.container.offsetWidth - parentOffset.left) + "px";
174
+ }else{
175
+ this.element.style.right = (this.container.offsetWidth - x) + "px";
176
+ }
176
177
 
177
- this.reversedX = true;
178
- }
178
+ this.reversedX = true;
179
+ }
179
180
 
180
- //move menu to start on bottom edge if it is too close to the edge of the screen
181
- if((y + this.element.offsetHeight) > Math.max(this.container.offsetHeight, scrollTop ? this.container.scrollHeight : 0)) {
182
- if(parentEl){
183
- switch(position){
184
- case "bottom":
185
- this.element.style.top = (parseInt(this.element.style.top) - this.element.offsetHeight - parentEl.offsetHeight - 1) + "px";
186
- break;
181
+ //move menu to start on bottom edge if it is too close to the edge of the screen
182
+ if((y + this.element.offsetHeight) > Math.max(this.container.offsetHeight, scrollTop ? this.container.scrollHeight : 0)) {
183
+ if(parentEl){
184
+ switch(position){
185
+ case "bottom":
186
+ this.element.style.top = (parseInt(this.element.style.top) - this.element.offsetHeight - parentEl.offsetHeight - 1) + "px";
187
+ break;
187
188
 
188
- default:
189
- this.element.style.top = (parseInt(this.element.style.top) - this.element.offsetHeight + parentEl.offsetHeight + 1) + "px";
190
- }
189
+ default:
190
+ this.element.style.top = (parseInt(this.element.style.top) - this.element.offsetHeight + parentEl.offsetHeight + 1) + "px";
191
+ }
191
192
 
192
- }else{
193
- this.element.style.top = (parseInt(this.element.style.top) - this.element.offsetHeight) + "px";
194
- }
195
- }
196
- }
193
+ }else{
194
+ this.element.style.top = (parseInt(this.element.style.top) - this.element.offsetHeight) + "px";
195
+ }
196
+ }
197
+ }
197
198
 
198
- isVisible(){
199
- return this.visible;
200
- }
199
+ isVisible(){
200
+ return this.visible;
201
+ }
201
202
 
202
- hideOnBlur(callback){
203
- this.blurable = true;
203
+ hideOnBlur(callback){
204
+ this.blurable = true;
204
205
 
205
- if(this.visible){
206
- setTimeout(() => {
207
- this.table.rowManager.element.addEventListener("scroll", this.blurEvent);
208
- this.subscribe("cell-editing", this.blurEvent);
209
- document.body.addEventListener("click", this.blurEvent);
210
- document.body.addEventListener("contextmenu", this.blurEvent);
211
- document.body.addEventListener("mousedown", this.blurEvent);
212
- window.addEventListener("resize", this.blurEvent);
213
- document.body.addEventListener("keydown", this.escEvent);
206
+ if(this.visible){
207
+ setTimeout(() => {
208
+ this.table.rowManager.element.addEventListener("scroll", this.blurEvent);
209
+ this.subscribe("cell-editing", this.blurEvent);
210
+ document.body.addEventListener("click", this.blurEvent);
211
+ document.body.addEventListener("contextmenu", this.blurEvent);
212
+ document.body.addEventListener("mousedown", this.blurEvent);
213
+ window.addEventListener("resize", this.blurEvent);
214
+ document.body.addEventListener("keydown", this.escEvent);
214
215
 
215
- }, 100);
216
+ }, 100);
216
217
 
217
- this.blurCallback = callback;
218
- }
218
+ this.blurCallback = callback;
219
+ }
219
220
 
220
- return this;
221
- }
221
+ return this;
222
+ }
222
223
 
223
- _escapeCheck(e){
224
- if(e.keyCode == 27){
225
- this.hide();
226
- }
227
- }
224
+ _escapeCheck(e){
225
+ if(e.keyCode == 27){
226
+ this.hide();
227
+ }
228
+ }
229
+
230
+ blockHide(){
231
+ this.hideable = false;
232
+ }
233
+
234
+ restoreHide(){
235
+ this.hideable = true;
236
+ }
228
237
 
229
- hide(silent = false){
230
- if(this.visible){
231
- if(this.blurable){
232
- document.body.removeEventListener("keydown", this.escEvent);
233
- document.body.removeEventListener("click", this.blurEvent);
234
- document.body.removeEventListener("contextmenu", this.blurEvent);
235
- document.body.removeEventListener("mousedown", this.blurEvent);
236
- window.removeEventListener("resize", this.blurEvent);
237
- this.table.rowManager.element.removeEventListener("scroll", this.blurEvent);
238
- this.unsubscribe("cell-editing", this.blurEvent);
239
- }
238
+ hide(silent = false){
239
+ if(this.visible && this.hideable){
240
+ if(this.blurable){
241
+ document.body.removeEventListener("keydown", this.escEvent);
242
+ document.body.removeEventListener("click", this.blurEvent);
243
+ document.body.removeEventListener("contextmenu", this.blurEvent);
244
+ document.body.removeEventListener("mousedown", this.blurEvent);
245
+ window.removeEventListener("resize", this.blurEvent);
246
+ this.table.rowManager.element.removeEventListener("scroll", this.blurEvent);
247
+ this.unsubscribe("cell-editing", this.blurEvent);
248
+ }
240
249
 
241
- if(this.childPopup){
242
- this.childPopup.hide();
243
- }
250
+ if(this.childPopup){
251
+ this.childPopup.hide();
252
+ }
244
253
 
245
- if(this.parent){
246
- this.parent.childPopup = null;
247
- }
254
+ if(this.parent){
255
+ this.parent.childPopup = null;
256
+ }
248
257
 
249
- if(this.element.parentNode){
250
- this.element.parentNode.removeChild(this.element);
251
- }
258
+ if(this.element.parentNode){
259
+ this.element.parentNode.removeChild(this.element);
260
+ }
252
261
 
253
- this.visible = false;
262
+ this.visible = false;
254
263
 
255
- if(this.blurCallback && !silent){
256
- this.blurCallback();
257
- }
264
+ if(this.blurCallback && !silent){
265
+ this.blurCallback();
266
+ }
258
267
 
259
- this.unsubscribe("table-destroy", this.destroyBinding);
260
- }
268
+ this.unsubscribe("table-destroy", this.destroyBinding);
269
+ }
261
270
 
262
- return this;
263
- }
271
+ return this;
272
+ }
264
273
 
265
- child(element){
266
- if(this.childPopup){
267
- this.childPopup.hide();
268
- }
274
+ child(element){
275
+ if(this.childPopup){
276
+ this.childPopup.hide();
277
+ }
269
278
 
270
- this.childPopup = new Popup(this.table, element, this);
279
+ this.childPopup = new Popup(this.table, element, this);
271
280
 
272
- return this.childPopup;
273
- }
281
+ return this.childPopup;
282
+ }
274
283
  }
@@ -1,14 +1,14 @@
1
1
  import Module from '../../core/Module.js';
2
2
  import Helpers from '../../core/tools/Helpers.js';
3
3
 
4
- import defautlAccessors from './defaults/accessors.js';
4
+ import defaultAccessors from './defaults/accessors.js';
5
5
 
6
6
  class Accessor extends Module{
7
7
 
8
8
  constructor(table){
9
9
  super(table);
10
10
 
11
- this.allowedTypes = ["", "data", "download", "clipboard", "print", "htmlOutput"] //list of accessor types
11
+ this.allowedTypes = ["", "data", "download", "clipboard", "print", "htmlOutput"]; //list of accessor types
12
12
 
13
13
  this.registerColumnOption("accessor");
14
14
  this.registerColumnOption("accessorParams");
@@ -47,7 +47,7 @@ class Accessor extends Module{
47
47
  config[key] = {
48
48
  accessor:accessor,
49
49
  params: column.definition[key + "Params"] || {},
50
- }
50
+ };
51
51
  }
52
52
  }
53
53
  });
@@ -63,16 +63,16 @@ class Accessor extends Module{
63
63
  //set column accessor
64
64
  switch(typeof value){
65
65
  case "string":
66
- if(Accessor.accessors[value]){
67
- accessor = Accessor.accessors[value]
68
- }else{
69
- console.warn("Accessor Error - No such accessor found, ignoring: ", value);
70
- }
71
- break;
66
+ if(Accessor.accessors[value]){
67
+ accessor = Accessor.accessors[value];
68
+ }else{
69
+ console.warn("Accessor Error - No such accessor found, ignoring: ", value);
70
+ }
71
+ break;
72
72
 
73
73
  case "function":
74
- accessor = value;
75
- break;
74
+ accessor = value;
75
+ break;
76
76
  }
77
77
 
78
78
  return accessor;
@@ -87,7 +87,7 @@ class Accessor extends Module{
87
87
  var data = Helpers.deepClone(row.data || {});
88
88
 
89
89
  this.table.columnManager.traverse(function(column){
90
- var value, accessor, params, colCompnent;
90
+ var value, accessor, params, colComponent;
91
91
 
92
92
  if(column.modules.accessor){
93
93
 
@@ -97,9 +97,9 @@ class Accessor extends Module{
97
97
  value = column.getFieldValue(data);
98
98
 
99
99
  if(value != "undefined"){
100
- colCompnent = column.getComponent();
101
- params = typeof accessor.params === "function" ? accessor.params(value, data, type, colCompnent, rowComponent) : accessor.params;
102
- column.setFieldValue(data, accessor.accessor(value, data, type, params, colCompnent, rowComponent));
100
+ colComponent = column.getComponent();
101
+ params = typeof accessor.params === "function" ? accessor.params(value, data, type, colComponent, rowComponent) : accessor.params;
102
+ column.setFieldValue(data, accessor.accessor(value, data, type, params, colComponent, rowComponent));
103
103
  }
104
104
  }
105
105
  }
@@ -111,6 +111,6 @@ class Accessor extends Module{
111
111
 
112
112
  //load defaults
113
113
  Accessor.moduleName = "accessor";
114
- Accessor.accessors = defautlAccessors;
114
+ Accessor.accessors = defaultAccessors;
115
115
 
116
116
  export default Accessor;
@@ -1 +1 @@
1
- export default {}
1
+ export default {};