tabulator-tables 5.2.6 → 5.3.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 (216) hide show
  1. package/.eslintignore +3 -0
  2. package/.eslintrc.js +28 -0
  3. package/.github/ISSUE_TEMPLATE/bug_report.md +1 -0
  4. package/.github/workflows/bad-files-check.yml +39 -0
  5. package/.github/workflows/lint-and-test.yml +31 -0
  6. package/README.md +18 -6
  7. package/bower.json +1 -1
  8. package/build/Bundler.js +77 -77
  9. package/dist/css/tabulator.css +12 -7
  10. package/dist/css/tabulator.css.map +1 -1
  11. package/dist/css/tabulator.min.css +1 -1
  12. package/dist/css/tabulator.min.css.map +1 -1
  13. package/dist/css/tabulator_bootstrap3.css +12 -7
  14. package/dist/css/tabulator_bootstrap3.css.map +1 -1
  15. package/dist/css/tabulator_bootstrap3.min.css +1 -1
  16. package/dist/css/tabulator_bootstrap3.min.css.map +1 -1
  17. package/dist/css/tabulator_bootstrap4.css +12 -7
  18. package/dist/css/tabulator_bootstrap4.css.map +1 -1
  19. package/dist/css/tabulator_bootstrap4.min.css +1 -1
  20. package/dist/css/tabulator_bootstrap4.min.css.map +1 -1
  21. package/dist/css/tabulator_bootstrap5.css +51 -46
  22. package/dist/css/tabulator_bootstrap5.css.map +1 -1
  23. package/dist/css/tabulator_bootstrap5.min.css +1 -1
  24. package/dist/css/tabulator_bootstrap5.min.css.map +1 -1
  25. package/dist/css/tabulator_bulma.css +12 -7
  26. package/dist/css/tabulator_bulma.css.map +1 -1
  27. package/dist/css/tabulator_bulma.min.css +1 -1
  28. package/dist/css/tabulator_bulma.min.css.map +1 -1
  29. package/dist/css/tabulator_materialize.css +12 -7
  30. package/dist/css/tabulator_materialize.css.map +1 -1
  31. package/dist/css/tabulator_materialize.min.css +1 -1
  32. package/dist/css/tabulator_materialize.min.css.map +1 -1
  33. package/dist/css/tabulator_midnight.css +12 -7
  34. package/dist/css/tabulator_midnight.css.map +1 -1
  35. package/dist/css/tabulator_midnight.min.css +1 -1
  36. package/dist/css/tabulator_midnight.min.css.map +1 -1
  37. package/dist/css/tabulator_modern.css +12 -7
  38. package/dist/css/tabulator_modern.css.map +1 -1
  39. package/dist/css/tabulator_modern.min.css +1 -1
  40. package/dist/css/tabulator_modern.min.css.map +1 -1
  41. package/dist/css/tabulator_semanticui.css +12 -7
  42. package/dist/css/tabulator_semanticui.css.map +1 -1
  43. package/dist/css/tabulator_semanticui.min.css +1 -1
  44. package/dist/css/tabulator_semanticui.min.css.map +1 -1
  45. package/dist/css/tabulator_simple.css +12 -7
  46. package/dist/css/tabulator_simple.css.map +1 -1
  47. package/dist/css/tabulator_simple.min.css +1 -1
  48. package/dist/css/tabulator_simple.min.css.map +1 -1
  49. package/dist/css/tabulator_site.css +12 -7
  50. package/dist/css/tabulator_site.css.map +1 -1
  51. package/dist/css/tabulator_site.min.css +1 -1
  52. package/dist/css/tabulator_site.min.css.map +1 -1
  53. package/dist/js/jquery_wrapper.js +37 -37
  54. package/dist/js/tabulator.js +1506 -706
  55. package/dist/js/tabulator.js.map +1 -1
  56. package/dist/js/tabulator.min.js +2 -2
  57. package/dist/js/tabulator.min.js.map +1 -1
  58. package/dist/js/tabulator_esm.js +4226 -3460
  59. package/dist/js/tabulator_esm.js.map +1 -1
  60. package/dist/js/tabulator_esm.min.js +2 -2
  61. package/dist/js/tabulator_esm.min.js.map +1 -1
  62. package/package.json +4 -1
  63. package/src/js/builds/jquery_wrapper.js +37 -37
  64. package/src/js/core/ColumnManager.js +270 -232
  65. package/src/js/core/CoreFeature.js +16 -2
  66. package/src/js/core/FooterManager.js +10 -10
  67. package/src/js/core/Module.js +8 -8
  68. package/src/js/core/RowManager.js +81 -88
  69. package/src/js/core/Tabulator.js +89 -72
  70. package/src/js/core/TabulatorFull.js +1 -1
  71. package/src/js/core/cell/Cell.js +15 -16
  72. package/src/js/core/cell/CellComponent.js +2 -2
  73. package/src/js/core/column/Column.js +81 -68
  74. package/src/js/core/column/ColumnComponent.js +4 -4
  75. package/src/js/core/column/defaults/options.js +1 -1
  76. package/src/js/core/defaults/options.js +4 -2
  77. package/src/js/core/rendering/Renderer.js +19 -19
  78. package/src/js/core/rendering/renderers/BasicHorizontal.js +1 -2
  79. package/src/js/core/rendering/renderers/BasicVertical.js +1 -1
  80. package/src/js/core/rendering/renderers/VirtualDomHorizontal.js +42 -58
  81. package/src/js/core/rendering/renderers/VirtualDomVertical.js +31 -22
  82. package/src/js/core/row/Row.js +32 -8
  83. package/src/js/core/row/RowComponent.js +8 -4
  84. package/src/js/core/tools/Alert.js +44 -45
  85. package/src/js/core/tools/ComponentFunctionBinder.js +4 -2
  86. package/src/js/core/tools/DataLoader.js +3 -3
  87. package/src/js/core/tools/DeprecationAdvisor.js +47 -0
  88. package/src/js/core/tools/ExternalEventBus.js +5 -5
  89. package/src/js/core/tools/InteractionMonitor.js +34 -33
  90. package/src/js/core/tools/InternalEventBus.js +5 -5
  91. package/src/js/core/tools/ModuleBinder.js +6 -6
  92. package/src/js/core/tools/OptionsList.js +4 -4
  93. package/src/js/core/tools/Popup.js +215 -189
  94. package/src/js/modules/Accessor/Accessor.js +16 -16
  95. package/src/js/modules/Accessor/defaults/accessors.js +1 -1
  96. package/src/js/modules/Ajax/Ajax.js +7 -7
  97. package/src/js/modules/Ajax/defaults/loaderPromise.js +19 -19
  98. package/src/js/modules/Ajax/defaults/urlGenerator.js +1 -1
  99. package/src/js/modules/Clipboard/Clipboard.js +23 -23
  100. package/src/js/modules/Clipboard/defaults/pasteParsers.js +0 -2
  101. package/src/js/modules/ColumnCalcs/CalcComponent.js +2 -2
  102. package/src/js/modules/ColumnCalcs/ColumnCalcs.js +55 -51
  103. package/src/js/modules/ColumnCalcs/defaults/calculations.js +1 -1
  104. package/src/js/modules/DataTree/DataTree.js +24 -15
  105. package/src/js/modules/Download/Download.js +15 -8
  106. package/src/js/modules/Download/defaults/downloaders/csv.js +28 -28
  107. package/src/js/modules/Download/defaults/downloaders/html.js +2 -2
  108. package/src/js/modules/Download/defaults/downloaders/json.js +14 -14
  109. package/src/js/modules/Download/defaults/downloaders/jsonLines.js +1 -1
  110. package/src/js/modules/Download/defaults/downloaders/pdf.js +17 -19
  111. package/src/js/modules/Download/defaults/downloaders/xlsx.js +2 -2
  112. package/src/js/modules/Edit/Edit.js +219 -201
  113. package/src/js/modules/Edit/List.js +1026 -991
  114. package/src/js/modules/Edit/defaults/editors/autocomplete.js +3 -3
  115. package/src/js/modules/Edit/defaults/editors/date.js +110 -0
  116. package/src/js/modules/Edit/defaults/editors/datetime.js +97 -0
  117. package/src/js/modules/Edit/defaults/editors/input.js +7 -7
  118. package/src/js/modules/Edit/defaults/editors/list.js +2 -2
  119. package/src/js/modules/Edit/defaults/editors/number.js +12 -12
  120. package/src/js/modules/Edit/defaults/editors/progress.js +11 -11
  121. package/src/js/modules/Edit/defaults/editors/range.js +5 -5
  122. package/src/js/modules/Edit/defaults/editors/select.js +3 -3
  123. package/src/js/modules/Edit/defaults/editors/star.js +9 -9
  124. package/src/js/modules/Edit/defaults/editors/textarea.js +97 -92
  125. package/src/js/modules/Edit/defaults/editors/tickCross.js +1 -3
  126. package/src/js/modules/Edit/defaults/editors/time.js +98 -0
  127. package/src/js/modules/Edit/defaults/editors.js +8 -2
  128. package/src/js/modules/Edit/inputMask.js +19 -26
  129. package/src/js/modules/Export/Export.js +69 -65
  130. package/src/js/modules/Filter/Filter.js +88 -95
  131. package/src/js/modules/Format/Format.js +24 -26
  132. package/src/js/modules/Format/defaults/formatters/buttonCross.js +1 -1
  133. package/src/js/modules/Format/defaults/formatters/buttonTick.js +1 -1
  134. package/src/js/modules/Format/defaults/formatters/color.js +1 -1
  135. package/src/js/modules/Format/defaults/formatters/datetime.js +7 -7
  136. package/src/js/modules/Format/defaults/formatters/datetimediff.js +7 -7
  137. package/src/js/modules/Format/defaults/formatters/handle.js +1 -1
  138. package/src/js/modules/Format/defaults/formatters/html.js +1 -1
  139. package/src/js/modules/Format/defaults/formatters/image.js +9 -9
  140. package/src/js/modules/Format/defaults/formatters/link.js +10 -10
  141. package/src/js/modules/Format/defaults/formatters/lookup.js +1 -1
  142. package/src/js/modules/Format/defaults/formatters/money.js +1 -1
  143. package/src/js/modules/Format/defaults/formatters/plaintext.js +1 -1
  144. package/src/js/modules/Format/defaults/formatters/progress.js +41 -42
  145. package/src/js/modules/Format/defaults/formatters/responsiveCollapse.js +3 -3
  146. package/src/js/modules/Format/defaults/formatters/rowSelection.js +1 -1
  147. package/src/js/modules/Format/defaults/formatters/rownum.js +9 -2
  148. package/src/js/modules/Format/defaults/formatters/star.js +1 -1
  149. package/src/js/modules/Format/defaults/formatters/textarea.js +1 -1
  150. package/src/js/modules/Format/defaults/formatters/tickCross.js +1 -1
  151. package/src/js/modules/Format/defaults/formatters/traffic.js +14 -14
  152. package/src/js/modules/FrozenColumns/FrozenColumns.js +6 -8
  153. package/src/js/modules/FrozenRows/FrozenRows.js +37 -7
  154. package/src/js/modules/GroupRows/Group.js +7 -7
  155. package/src/js/modules/GroupRows/GroupComponent.js +2 -2
  156. package/src/js/modules/GroupRows/GroupRows.js +34 -11
  157. package/src/js/modules/History/History.js +2 -2
  158. package/src/js/modules/HtmlTableImport/HtmlTableImport.js +3 -6
  159. package/src/js/modules/Import/Import.js +158 -159
  160. package/src/js/modules/Import/defaults/importers/array.js +5 -0
  161. package/src/js/modules/Import/defaults/importers/csv.js +49 -49
  162. package/src/js/modules/Import/defaults/importers/json.js +6 -6
  163. package/src/js/modules/Import/defaults/importers.js +2 -0
  164. package/src/js/modules/Interaction/Interaction.js +41 -42
  165. package/src/js/modules/Keybindings/Keybindings.js +14 -14
  166. package/src/js/modules/Keybindings/defaults/actions.js +1 -2
  167. package/src/js/modules/Layout/Layout.js +4 -5
  168. package/src/js/modules/Layout/defaults/modes/fitColumns.js +13 -16
  169. package/src/js/modules/Layout/defaults/modes/fitData.js +6 -4
  170. package/src/js/modules/Layout/defaults/modes/fitDataGeneral.js +2 -2
  171. package/src/js/modules/Layout/defaults/modes/fitDataStretch.js +2 -2
  172. package/src/js/modules/Localize/Localize.js +7 -7
  173. package/src/js/modules/Menu/Menu.js +8 -11
  174. package/src/js/modules/MoveColumns/MoveColumns.js +3 -6
  175. package/src/js/modules/MoveRows/MoveRows.js +30 -36
  176. package/src/js/modules/Mutator/Mutator.js +9 -9
  177. package/src/js/modules/Page/Page.js +73 -80
  178. package/src/js/modules/Page/defaults/pageCounters/pages.js +2 -2
  179. package/src/js/modules/Page/defaults/pageCounters/rows.js +1 -1
  180. package/src/js/modules/Persistence/Persistence.js +40 -44
  181. package/src/js/modules/Persistence/defaults/readers.js +1 -1
  182. package/src/js/modules/Popup/Popup.js +4 -5
  183. package/src/js/modules/Print/Print.js +2 -2
  184. package/src/js/modules/ReactiveData/ReactiveData.js +178 -115
  185. package/src/js/modules/ResizeColumns/ResizeColumns.js +3 -3
  186. package/src/js/modules/ResizeRows/ResizeRows.js +1 -1
  187. package/src/js/modules/ResizeTable/ResizeTable.js +77 -46
  188. package/src/js/modules/ResponsiveLayout/ResponsiveLayout.js +3 -5
  189. package/src/js/modules/SelectRow/SelectRow.js +26 -28
  190. package/src/js/modules/Sort/Sort.js +110 -79
  191. package/src/js/modules/Sort/defaults/sorters/alphanum.js +1 -1
  192. package/src/js/modules/Sort/defaults/sorters/array.js +24 -28
  193. package/src/js/modules/Sort/defaults/sorters/boolean.js +1 -1
  194. package/src/js/modules/Sort/defaults/sorters/date.js +1 -1
  195. package/src/js/modules/Sort/defaults/sorters/datetime.js +13 -13
  196. package/src/js/modules/Sort/defaults/sorters/exists.js +1 -1
  197. package/src/js/modules/Sort/defaults/sorters/number.js +1 -1
  198. package/src/js/modules/Sort/defaults/sorters/string.js +7 -7
  199. package/src/js/modules/Sort/defaults/sorters/time.js +1 -1
  200. package/src/js/modules/Tooltip/Tooltip.js +5 -7
  201. package/src/js/modules/Validate/Validate.js +10 -13
  202. package/src/js/modules/Validate/defaults/validators.js +8 -3
  203. package/src/scss/tabulator.scss +28 -17
  204. package/src/scss/themes/bootstrap/functions4.scss +1 -1
  205. package/src/scss/themes/bootstrap/tabulator_bootstrap3.scss +8 -8
  206. package/src/scss/themes/bootstrap/tabulator_bootstrap4.scss +8 -8
  207. package/src/scss/themes/bootstrap/tabulator_bootstrap5.scss +25 -25
  208. package/src/scss/themes/bootstrap/variables5.scss +4 -4
  209. package/src/scss/themes/bulma/tabulator_bulma.scss +7 -7
  210. package/src/scss/themes/materialize/tabulator_materialize.scss +6 -6
  211. package/src/scss/themes/materialize/variables.scss +1 -1
  212. package/src/scss/themes/semanticui/tabulator_semanticui.scss +7 -7
  213. package/src/scss/themes/tabulator_midnight.scss +7 -7
  214. package/src/scss/themes/tabulator_modern.scss +14 -14
  215. package/src/scss/themes/tabulator_simple.scss +8 -8
  216. 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,256 +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.hide.bind(this, true);
27
- }
27
+ this.destroyBinding = this.tableDestroyed;
28
+ this.destroyed = false;
29
+ }
30
+
31
+ tableDestroyed(){
32
+ this.destroyed = true;
33
+ this.hide(true);
34
+ }
28
35
 
29
- _lookupContainer(){
30
- var container = this.table.options.popupContainer;
36
+ _lookupContainer(){
37
+ var container = this.table.options.popupContainer;
31
38
 
32
- if(typeof container === "string"){
33
- container = document.querySelector(container);
39
+ if(typeof container === "string"){
40
+ container = document.querySelector(container);
34
41
 
35
- if(!container){
36
- console.warn("Menu Error - no container element found matching selector:", this.table.options.popupContainer , "(defaulting to document body)");
37
- }
38
- }else if (container === true){
39
- container = this.table.element;
40
- }
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
+ }
41
48
 
42
- if(container && !this._checkContainerIsParent(container)){
43
- container = false;
44
- console.warn("Menu Error - container element does not contain this table:", this.table.options.popupContainer , "(defaulting to document body)");
45
- }
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
+ }
46
53
 
47
- if(!container){
48
- container = document.body;
49
- }
54
+ if(!container){
55
+ container = document.body;
56
+ }
50
57
 
51
- return container;
52
- }
58
+ return container;
59
+ }
53
60
 
54
- _checkContainerIsParent(container, element = this.table.element){
55
- if(container === element){
56
- return true;
57
- }else{
58
- return element.parentNode ? this._checkContainerIsParent(container, element.parentNode) : false;
59
- }
60
- }
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
+ }
61
68
 
62
- renderCallback(callback){
63
- this.renderedCallback = callback;
64
- }
69
+ renderCallback(callback){
70
+ this.renderedCallback = callback;
71
+ }
65
72
 
66
- containerEventCoords(e){
67
- var touch = !(e instanceof MouseEvent);
73
+ containerEventCoords(e){
74
+ var touch = !(e instanceof MouseEvent);
68
75
 
69
- var x = touch ? e.touches[0].pageX : e.pageX;
70
- 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;
71
78
 
72
- if(this.container !== document.body){
73
- let parentOffset = Helpers.elOffset(this.container);
79
+ if(this.container !== document.body){
80
+ let parentOffset = Helpers.elOffset(this.container);
74
81
 
75
- x -= parentOffset.left;
76
- y -= parentOffset.top;
77
- }
82
+ x -= parentOffset.left;
83
+ y -= parentOffset.top;
84
+ }
78
85
 
79
- return {x, y};
80
- }
86
+ return {x, y};
87
+ }
81
88
 
82
- elementPositionCoords(element, position = "right"){
83
- var offset = Helpers.elOffset(element),
84
- containerOffset, x, y;
89
+ elementPositionCoords(element, position = "right"){
90
+ var offset = Helpers.elOffset(element),
91
+ containerOffset, x, y;
85
92
 
86
- if(this.container !== document.body){
87
- containerOffset = Helpers.elOffset(this.container);
93
+ if(this.container !== document.body){
94
+ containerOffset = Helpers.elOffset(this.container);
88
95
 
89
- offset.left -= containerOffset.left;
90
- offset.top -= containerOffset.top;
91
- }
96
+ offset.left -= containerOffset.left;
97
+ offset.top -= containerOffset.top;
98
+ }
92
99
 
93
- switch(position){
94
- case "right":
95
- x = offset.left + element.offsetWidth;
96
- y = offset.top - 1;
97
- break;
100
+ switch(position){
101
+ case "right":
102
+ x = offset.left + element.offsetWidth;
103
+ y = offset.top - 1;
104
+ break;
98
105
 
99
- case "bottom":
100
- x = offset.left;
101
- y = offset.top + element.offsetHeight;
102
- break;
103
- }
106
+ case "bottom":
107
+ x = offset.left;
108
+ y = offset.top + element.offsetHeight;
109
+ break;
110
+ }
104
111
 
105
- return {x, y, offset};
106
- }
112
+ return {x, y, offset};
113
+ }
107
114
 
108
- show(origin, position){
109
- var x, y, parentEl, parentOffset, containerOffset, coords;
115
+ show(origin, position){
116
+ var x, y, parentEl, parentOffset, coords;
117
+
118
+ if(this.destroyed || this.table.destroyed){
119
+ return this;
120
+ }
110
121
 
111
- if(origin instanceof HTMLElement){
112
- parentEl = origin;
113
- coords = this.elementPositionCoords(origin, position);
122
+ if(origin instanceof HTMLElement){
123
+ parentEl = origin;
124
+ coords = this.elementPositionCoords(origin, position);
114
125
 
115
- parentOffset = coords.offset;
116
- x = coords.x;
117
- y = coords.y;
126
+ parentOffset = coords.offset;
127
+ x = coords.x;
128
+ y = coords.y;
118
129
 
119
- }else if(typeof origin === "number"){
120
- parentOffset = {top:0, left:0};
121
- x = origin;
122
- y = position;
123
- }else{
124
- 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);
125
136
 
126
- x = coords.x;
127
- y = coords.y;
137
+ x = coords.x;
138
+ y = coords.y;
128
139
 
129
- this.reversedX = false;
130
- }
140
+ this.reversedX = false;
141
+ }
131
142
 
132
- this.element.style.top = y + "px";
133
- this.element.style.left = x + "px";
143
+ this.element.style.top = y + "px";
144
+ this.element.style.left = x + "px";
134
145
 
135
- this.container.appendChild(this.element);
146
+ this.container.appendChild(this.element);
136
147
 
137
- if(typeof this.renderedCallback === "function"){
138
- this.renderedCallback();
139
- }
148
+ if(typeof this.renderedCallback === "function"){
149
+ this.renderedCallback();
150
+ }
140
151
 
141
- this._fitToScreen(x, y, parentEl, parentOffset, position);
152
+ this._fitToScreen(x, y, parentEl, parentOffset, position);
142
153
 
143
- this.visible = true;
154
+ this.visible = true;
155
+
156
+ this.subscribe("table-destroy", this.destroyBinding);
144
157
 
145
- this.subscribe("table-destroy", this.destroyBinding);
158
+ this.element.addEventListener("mousedown", (e) => {
159
+ e.stopPropagation();
160
+ });
146
161
 
147
- return this;
148
- }
162
+ return this;
163
+ }
149
164
 
150
- _fitToScreen(x, y, parentEl, parentOffset, position){
151
- 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;
152
167
 
153
- //move menu to start on right edge if it is too close to the edge of the screen
154
- if((x + this.element.offsetWidth) >= this.container.offsetWidth || this.reversedX){
155
- 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 = "";
156
171
 
157
- if(parentEl){
158
- this.element.style.right = (this.container.offsetWidth - parentOffset.left) + "px";
159
- }else{
160
- this.element.style.right = (this.container.offsetWidth - x) + "px";
161
- }
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
+ }
162
177
 
163
- this.reversedX = true;
164
- }
178
+ this.reversedX = true;
179
+ }
165
180
 
166
- //move menu to start on bottom edge if it is too close to the edge of the screen
167
- if((y + this.element.offsetHeight) > Math.max(this.container.offsetHeight, scrollTop ? this.container.scrollHeight : 0)) {
168
- if(parentEl){
169
- switch(position){
170
- case "bottom":
171
- this.element.style.top = (parseInt(this.element.style.top) - this.element.offsetHeight - parentEl.offsetHeight - 1) + "px";
172
- 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;
173
188
 
174
- default:
175
- this.element.style.top = (parseInt(this.element.style.top) - this.element.offsetHeight + parentEl.offsetHeight + 1) + "px";
176
- }
189
+ default:
190
+ this.element.style.top = (parseInt(this.element.style.top) - this.element.offsetHeight + parentEl.offsetHeight + 1) + "px";
191
+ }
177
192
 
178
- }else{
179
- this.element.style.top = (parseInt(this.element.style.top) - this.element.offsetHeight) + "px";
180
- }
181
- }
182
- }
193
+ }else{
194
+ this.element.style.top = (parseInt(this.element.style.top) - this.element.offsetHeight) + "px";
195
+ }
196
+ }
197
+ }
183
198
 
184
- isVisible(){
185
- return this.visible;
186
- }
199
+ isVisible(){
200
+ return this.visible;
201
+ }
187
202
 
188
- hideOnBlur(callback){
189
- this.blurable = true;
203
+ hideOnBlur(callback){
204
+ this.blurable = true;
190
205
 
191
- if(this.visible){
192
- setTimeout(() => {
193
- this.table.rowManager.element.addEventListener("scroll", this.blurEvent);
194
- this.subscribe("cell-editing", this.blurEvent);
195
- document.body.addEventListener("click", this.blurEvent);
196
- document.body.addEventListener("contextmenu", this.blurEvent);
197
- window.addEventListener("resize", this.blurEvent);
198
- document.body.addEventListener("keydown", this.escEvent);
199
- }, 100);
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);
215
+
216
+ }, 100);
200
217
 
201
- this.blurCallback = callback;
202
- }
218
+ this.blurCallback = callback;
219
+ }
203
220
 
204
- return this;
205
- }
221
+ return this;
222
+ }
206
223
 
207
- _escapeCheck(e){
208
- if(e.keyCode == 27){
209
- this.hide();
210
- }
211
- }
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
+ }
212
237
 
213
- hide(silent = false){
214
- if(this.visible){
215
- if(this.blurable){
216
- document.body.removeEventListener("keydown", this.escEvent);
217
- document.body.removeEventListener("click", this.blurEvent);
218
- document.body.removeEventListener("contextmenu", this.blurEvent);
219
- window.removeEventListener("resize", this.blurEvent);
220
- this.table.rowManager.element.removeEventListener("scroll", this.blurEvent);
221
- this.unsubscribe("cell-editing", this.blurEvent);
222
- }
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
+ }
223
249
 
224
- if(this.childPopup){
225
- this.childPopup.hide();
226
- }
250
+ if(this.childPopup){
251
+ this.childPopup.hide();
252
+ }
227
253
 
228
- if(this.parent){
229
- this.parent.childPopup = null;
230
- }
254
+ if(this.parent){
255
+ this.parent.childPopup = null;
256
+ }
231
257
 
232
- if(this.element.parentNode){
233
- this.element.parentNode.removeChild(this.element);
234
- }
258
+ if(this.element.parentNode){
259
+ this.element.parentNode.removeChild(this.element);
260
+ }
235
261
 
236
- this.visible = false;
262
+ this.visible = false;
237
263
 
238
- if(this.blurCallback && !silent){
239
- this.blurCallback();
240
- }
264
+ if(this.blurCallback && !silent){
265
+ this.blurCallback();
266
+ }
241
267
 
242
- this.unsubscribe("table-destroy", this.destroyBinding);
243
- }
268
+ this.unsubscribe("table-destroy", this.destroyBinding);
269
+ }
244
270
 
245
- return this;
246
- }
271
+ return this;
272
+ }
247
273
 
248
- child(element){
249
- if(this.childPopup){
250
- this.childPopup.hide();
251
- }
274
+ child(element){
275
+ if(this.childPopup){
276
+ this.childPopup.hide();
277
+ }
252
278
 
253
- this.childPopup = new Popup(this.table, element, this);
279
+ this.childPopup = new Popup(this.table, element, this);
254
280
 
255
- return this.childPopup;
256
- }
281
+ return this.childPopup;
282
+ }
257
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 {};
@@ -95,7 +95,7 @@ class Ajax extends Module{
95
95
 
96
96
  //load config object
97
97
  generateConfig(config = {}){
98
- var ajaxConfig = Object.assign({}, this.config)
98
+ var ajaxConfig = Object.assign({}, this.config);
99
99
 
100
100
  if(typeof config == "string"){
101
101
  ajaxConfig.method = config;
@@ -120,13 +120,13 @@ class Ajax extends Module{
120
120
  sendRequest(url, params, config){
121
121
  if(this.table.options.ajaxRequesting.call(this.table, url, params) !== false){
122
122
  return this.loaderPromise(url, config, params)
123
- .then((data)=>{
124
- if(this.table.options.ajaxResponse){
125
- data = this.table.options.ajaxResponse.call(this.table, url, params, data);
126
- }
123
+ .then((data)=>{
124
+ if(this.table.options.ajaxResponse){
125
+ data = this.table.options.ajaxResponse.call(this.table, url, params, data);
126
+ }
127
127
 
128
- return data;
129
- });
128
+ return data;
129
+ });
130
130
  }else{
131
131
  return Promise.reject();
132
132
  }