tabulator-tables 6.5.0 → 6.5.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 (222) hide show
  1. package/dist/js/tabulator.js +1 -1
  2. package/dist/js/tabulator.min.js +1 -1
  3. package/dist/js/tabulator_esm.js +1 -1
  4. package/dist/js/tabulator_esm.min.js +1 -1
  5. package/dist/js/tabulator_esm.min.mjs +1 -1
  6. package/dist/js/tabulator_esm.mjs +1 -1
  7. package/package.json +2 -1
  8. package/src/js/builds/esm.js +16 -0
  9. package/src/js/builds/jquery_wrapper.js +63 -0
  10. package/src/js/builds/usd.js +1 -0
  11. package/src/js/core/ColumnManager.js +789 -0
  12. package/src/js/core/CoreFeature.js +140 -0
  13. package/src/js/core/FooterManager.js +102 -0
  14. package/src/js/core/Module.js +140 -0
  15. package/src/js/core/RowManager.js +1140 -0
  16. package/src/js/core/Tabulator.js +928 -0
  17. package/src/js/core/TabulatorFull.js +21 -0
  18. package/src/js/core/cell/Cell.js +299 -0
  19. package/src/js/core/cell/CellComponent.js +79 -0
  20. package/src/js/core/column/Column.js +978 -0
  21. package/src/js/core/column/ColumnComponent.js +151 -0
  22. package/src/js/core/column/defaults/options.js +18 -0
  23. package/src/js/core/defaults/options.js +66 -0
  24. package/src/js/core/modules/core.js +3 -0
  25. package/src/js/core/modules/optional.js +37 -0
  26. package/src/js/core/rendering/Renderer.js +204 -0
  27. package/src/js/core/rendering/renderers/BasicHorizontal.js +27 -0
  28. package/src/js/core/rendering/renderers/BasicVertical.js +103 -0
  29. package/src/js/core/rendering/renderers/VirtualDomHorizontal.js +587 -0
  30. package/src/js/core/rendering/renderers/VirtualDomVertical.js +642 -0
  31. package/src/js/core/row/PseudoRow.js +47 -0
  32. package/src/js/core/row/Row.js +487 -0
  33. package/src/js/core/row/RowComponent.js +94 -0
  34. package/src/js/core/tools/Alert.js +66 -0
  35. package/src/js/core/tools/ComponentFunctionBinder.js +32 -0
  36. package/src/js/core/tools/DataLoader.js +128 -0
  37. package/src/js/core/tools/DependencyRegistry.js +82 -0
  38. package/src/js/core/tools/DeprecationAdvisor.js +51 -0
  39. package/src/js/core/tools/ExternalEventBus.js +105 -0
  40. package/src/js/core/tools/Helpers.js +66 -0
  41. package/src/js/core/tools/InteractionMonitor.js +329 -0
  42. package/src/js/core/tools/InternalEventBus.js +162 -0
  43. package/src/js/core/tools/ModuleBinder.js +153 -0
  44. package/src/js/core/tools/OptionsList.js +45 -0
  45. package/src/js/core/tools/Popup.js +317 -0
  46. package/src/js/core/tools/TableRegistry.js +65 -0
  47. package/src/js/modules/Accessor/Accessor.js +115 -0
  48. package/src/js/modules/Accessor/defaults/accessors.js +5 -0
  49. package/src/js/modules/Ajax/Ajax.js +142 -0
  50. package/src/js/modules/Ajax/defaults/config.js +3 -0
  51. package/src/js/modules/Ajax/defaults/contentTypeFormatters.js +45 -0
  52. package/src/js/modules/Ajax/defaults/loaderPromise.js +87 -0
  53. package/src/js/modules/Ajax/defaults/urlGenerator.js +44 -0
  54. package/src/js/modules/Clipboard/Clipboard.js +282 -0
  55. package/src/js/modules/Clipboard/defaults/pasteActions.js +11 -0
  56. package/src/js/modules/Clipboard/defaults/pasteParsers.js +75 -0
  57. package/src/js/modules/Clipboard/extensions/extensions.js +9 -0
  58. package/src/js/modules/Clipboard/extensions/keybindings/actions.js +9 -0
  59. package/src/js/modules/Clipboard/extensions/keybindings/bindings.js +3 -0
  60. package/src/js/modules/ColumnCalcs/CalcComponent.js +46 -0
  61. package/src/js/modules/ColumnCalcs/ColumnCalcs.js +586 -0
  62. package/src/js/modules/ColumnCalcs/defaults/calculations.js +93 -0
  63. package/src/js/modules/Comms/Comms.js +49 -0
  64. package/src/js/modules/DataTree/DataTree.js +620 -0
  65. package/src/js/modules/Download/Download.js +146 -0
  66. package/src/js/modules/Download/defaults/downloaders/csv.js +61 -0
  67. package/src/js/modules/Download/defaults/downloaders/html.js +5 -0
  68. package/src/js/modules/Download/defaults/downloaders/json.js +34 -0
  69. package/src/js/modules/Download/defaults/downloaders/jsonLines.js +32 -0
  70. package/src/js/modules/Download/defaults/downloaders/pdf.js +113 -0
  71. package/src/js/modules/Download/defaults/downloaders/xlsx.js +103 -0
  72. package/src/js/modules/Download/defaults/downloaders.js +15 -0
  73. package/src/js/modules/Edit/Edit.js +845 -0
  74. package/src/js/modules/Edit/List.js +1060 -0
  75. package/src/js/modules/Edit/defaults/editors/adaptable.js +37 -0
  76. package/src/js/modules/Edit/defaults/editors/date.js +144 -0
  77. package/src/js/modules/Edit/defaults/editors/datetime.js +131 -0
  78. package/src/js/modules/Edit/defaults/editors/input.js +77 -0
  79. package/src/js/modules/Edit/defaults/editors/list.js +7 -0
  80. package/src/js/modules/Edit/defaults/editors/number.js +110 -0
  81. package/src/js/modules/Edit/defaults/editors/progress.js +127 -0
  82. package/src/js/modules/Edit/defaults/editors/range.js +81 -0
  83. package/src/js/modules/Edit/defaults/editors/star.js +146 -0
  84. package/src/js/modules/Edit/defaults/editors/textarea.js +123 -0
  85. package/src/js/modules/Edit/defaults/editors/tickCross.js +95 -0
  86. package/src/js/modules/Edit/defaults/editors/time.js +132 -0
  87. package/src/js/modules/Edit/defaults/editors.js +27 -0
  88. package/src/js/modules/Edit/inputMask.js +74 -0
  89. package/src/js/modules/Export/Export.js +654 -0
  90. package/src/js/modules/Export/ExportColumn.js +9 -0
  91. package/src/js/modules/Export/ExportRow.js +8 -0
  92. package/src/js/modules/Export/defaults/columnLookups.js +3 -0
  93. package/src/js/modules/Export/defaults/rowLookups.js +18 -0
  94. package/src/js/modules/Filter/Filter.js +902 -0
  95. package/src/js/modules/Filter/defaults/filters.js +215 -0
  96. package/src/js/modules/Format/Format.js +200 -0
  97. package/src/js/modules/Format/defaults/formatters/adaptable.js +32 -0
  98. package/src/js/modules/Format/defaults/formatters/array.js +30 -0
  99. package/src/js/modules/Format/defaults/formatters/buttonCross.js +3 -0
  100. package/src/js/modules/Format/defaults/formatters/buttonTick.js +3 -0
  101. package/src/js/modules/Format/defaults/formatters/color.js +4 -0
  102. package/src/js/modules/Format/defaults/formatters/datetime.js +39 -0
  103. package/src/js/modules/Format/defaults/formatters/datetimediff.js +43 -0
  104. package/src/js/modules/Format/defaults/formatters/handle.js +4 -0
  105. package/src/js/modules/Format/defaults/formatters/html.js +3 -0
  106. package/src/js/modules/Format/defaults/formatters/image.js +40 -0
  107. package/src/js/modules/Format/defaults/formatters/json.js +12 -0
  108. package/src/js/modules/Format/defaults/formatters/link.js +82 -0
  109. package/src/js/modules/Format/defaults/formatters/lookup.js +10 -0
  110. package/src/js/modules/Format/defaults/formatters/money.js +44 -0
  111. package/src/js/modules/Format/defaults/formatters/plaintext.js +3 -0
  112. package/src/js/modules/Format/defaults/formatters/progress.js +133 -0
  113. package/src/js/modules/Format/defaults/formatters/rownum.js +14 -0
  114. package/src/js/modules/Format/defaults/formatters/star.js +38 -0
  115. package/src/js/modules/Format/defaults/formatters/textarea.js +4 -0
  116. package/src/js/modules/Format/defaults/formatters/tickCross.js +22 -0
  117. package/src/js/modules/Format/defaults/formatters/toggle.js +48 -0
  118. package/src/js/modules/Format/defaults/formatters/traffic.js +47 -0
  119. package/src/js/modules/Format/defaults/formatters.js +47 -0
  120. package/src/js/modules/FrozenColumns/FrozenColumns.js +302 -0
  121. package/src/js/modules/FrozenRows/FrozenRows.js +175 -0
  122. package/src/js/modules/GroupRows/Group.js +615 -0
  123. package/src/js/modules/GroupRows/GroupComponent.js +69 -0
  124. package/src/js/modules/GroupRows/GroupRows.js +636 -0
  125. package/src/js/modules/History/History.js +172 -0
  126. package/src/js/modules/History/defaults/redoers.js +31 -0
  127. package/src/js/modules/History/defaults/undoers.js +33 -0
  128. package/src/js/modules/History/extensions/extensions.js +9 -0
  129. package/src/js/modules/History/extensions/keybindings/actions.js +27 -0
  130. package/src/js/modules/History/extensions/keybindings/bindings.js +4 -0
  131. package/src/js/modules/HtmlTableImport/HtmlTableImport.js +180 -0
  132. package/src/js/modules/Import/Import.js +303 -0
  133. package/src/js/modules/Import/defaults/importers/array.js +3 -0
  134. package/src/js/modules/Import/defaults/importers/csv.js +61 -0
  135. package/src/js/modules/Import/defaults/importers/json.js +8 -0
  136. package/src/js/modules/Import/defaults/importers/xlsx.js +7 -0
  137. package/src/js/modules/Import/defaults/importers.js +11 -0
  138. package/src/js/modules/Interaction/Interaction.js +339 -0
  139. package/src/js/modules/Keybindings/Keybindings.js +198 -0
  140. package/src/js/modules/Keybindings/defaults/actions.js +90 -0
  141. package/src/js/modules/Keybindings/defaults/bindings.js +12 -0
  142. package/src/js/modules/Layout/Layout.js +66 -0
  143. package/src/js/modules/Layout/defaults/modes/fitColumns.js +171 -0
  144. package/src/js/modules/Layout/defaults/modes/fitData.js +10 -0
  145. package/src/js/modules/Layout/defaults/modes/fitDataGeneral.js +10 -0
  146. package/src/js/modules/Layout/defaults/modes/fitDataStretch.js +40 -0
  147. package/src/js/modules/Layout/defaults/modes.js +12 -0
  148. package/src/js/modules/Localize/Localize.js +184 -0
  149. package/src/js/modules/Localize/defaults/langs.js +37 -0
  150. package/src/js/modules/Menu/Menu.js +302 -0
  151. package/src/js/modules/MoveColumns/MoveColumns.js +311 -0
  152. package/src/js/modules/MoveRows/MoveRows.js +604 -0
  153. package/src/js/modules/MoveRows/defaults/receivers.js +30 -0
  154. package/src/js/modules/MoveRows/defaults/senders.js +5 -0
  155. package/src/js/modules/Mutator/Mutator.js +164 -0
  156. package/src/js/modules/Mutator/defaults/mutators.js +1 -0
  157. package/src/js/modules/Page/Page.js +891 -0
  158. package/src/js/modules/Page/defaults/pageCounters/pages.js +33 -0
  159. package/src/js/modules/Page/defaults/pageCounters/rows.js +40 -0
  160. package/src/js/modules/Page/defaults/pageCounters.js +8 -0
  161. package/src/js/modules/Persistence/Persistence.js +473 -0
  162. package/src/js/modules/Persistence/defaults/readers.js +29 -0
  163. package/src/js/modules/Persistence/defaults/writers.js +13 -0
  164. package/src/js/modules/Popup/Popup.js +227 -0
  165. package/src/js/modules/Print/Print.js +136 -0
  166. package/src/js/modules/ReactiveData/ReactiveData.js +416 -0
  167. package/src/js/modules/ResizeColumns/ResizeColumns.js +365 -0
  168. package/src/js/modules/ResizeRows/ResizeRows.js +145 -0
  169. package/src/js/modules/ResizeTable/ResizeTable.js +158 -0
  170. package/src/js/modules/ResponsiveLayout/ResponsiveLayout.js +354 -0
  171. package/src/js/modules/ResponsiveLayout/extensions/extensions.js +9 -0
  172. package/src/js/modules/ResponsiveLayout/extensions/formatters/responsiveCollapse.js +44 -0
  173. package/src/js/modules/SelectRange/Range.js +366 -0
  174. package/src/js/modules/SelectRange/RangeComponent.js +91 -0
  175. package/src/js/modules/SelectRange/SelectRange.js +993 -0
  176. package/src/js/modules/SelectRange/extensions/clipboard/pasteActions.js +45 -0
  177. package/src/js/modules/SelectRange/extensions/clipboard/pasteParsers.js +57 -0
  178. package/src/js/modules/SelectRange/extensions/export/columnLookups.js +11 -0
  179. package/src/js/modules/SelectRange/extensions/export/rowLookups.js +5 -0
  180. package/src/js/modules/SelectRange/extensions/extensions.js +21 -0
  181. package/src/js/modules/SelectRange/extensions/keybindings/actions.js +38 -0
  182. package/src/js/modules/SelectRange/extensions/keybindings/bindings.js +14 -0
  183. package/src/js/modules/SelectRow/SelectRow.js +499 -0
  184. package/src/js/modules/SelectRow/extensions/extensions.js +9 -0
  185. package/src/js/modules/SelectRow/extensions/formatters/rowSelection.js +60 -0
  186. package/src/js/modules/Sort/Sort.js +480 -0
  187. package/src/js/modules/Sort/defaults/sorters/alphanum.js +44 -0
  188. package/src/js/modules/Sort/defaults/sorters/array.js +82 -0
  189. package/src/js/modules/Sort/defaults/sorters/boolean.js +7 -0
  190. package/src/js/modules/Sort/defaults/sorters/date.js +10 -0
  191. package/src/js/modules/Sort/defaults/sorters/datetime.js +48 -0
  192. package/src/js/modules/Sort/defaults/sorters/exists.js +7 -0
  193. package/src/js/modules/Sort/defaults/sorters/number.js +40 -0
  194. package/src/js/modules/Sort/defaults/sorters/string.js +34 -0
  195. package/src/js/modules/Sort/defaults/sorters/time.js +10 -0
  196. package/src/js/modules/Sort/defaults/sorters.js +21 -0
  197. package/src/js/modules/Spreadsheet/GridCalculator.js +64 -0
  198. package/src/js/modules/Spreadsheet/Sheet.js +243 -0
  199. package/src/js/modules/Spreadsheet/SheetComponent.js +59 -0
  200. package/src/js/modules/Spreadsheet/Spreadsheet.js +309 -0
  201. package/src/js/modules/Tooltip/Tooltip.js +128 -0
  202. package/src/js/modules/Validate/Validate.js +303 -0
  203. package/src/js/modules/Validate/defaults/validators.js +150 -0
  204. package/src/scss/tabulator.scss +1693 -0
  205. package/src/scss/themes/bootstrap/tabulator_bootstrap3.scss +302 -0
  206. package/src/scss/themes/bootstrap/tabulator_bootstrap4.scss +589 -0
  207. package/src/scss/themes/bootstrap/tabulator_bootstrap5.scss +979 -0
  208. package/src/scss/themes/bootstrap/variables3.scss +872 -0
  209. package/src/scss/themes/bootstrap/variables4.scss +1059 -0
  210. package/src/scss/themes/bootstrap/variables5.scss +1967 -0
  211. package/src/scss/themes/bulma/tabulator_bulma.scss +316 -0
  212. package/src/scss/themes/bulma/variables.scss +198 -0
  213. package/src/scss/themes/materialize/tabulator_materialize.scss +318 -0
  214. package/src/scss/themes/materialize/variables.scss +71 -0
  215. package/src/scss/themes/semanticui/tabulator_semanticui.scss +623 -0
  216. package/src/scss/themes/semanticui/variables.scss +843 -0
  217. package/src/scss/themes/semanticui/variables_table.scss +248 -0
  218. package/src/scss/themes/tabulator_midnight.scss +235 -0
  219. package/src/scss/themes/tabulator_modern.scss +308 -0
  220. package/src/scss/themes/tabulator_simple.scss +143 -0
  221. package/src/scss/themes/tabulator_site.scss +267 -0
  222. package/src/scss/themes/tabulator_site_dark.scss +496 -0
@@ -0,0 +1,128 @@
1
+ import CoreFeature from '../CoreFeature.js';
2
+
3
+ export default class DataLoader extends CoreFeature{
4
+ constructor(table){
5
+ super(table);
6
+
7
+ this.requestOrder = 0; //prevent requests coming out of sequence if overridden by another load request
8
+ this.loading = false;
9
+ }
10
+
11
+ initialize(){}
12
+
13
+ load(data, params, config, replace, silent, columnsChanged){
14
+ var requestNo = ++this.requestOrder;
15
+
16
+ if(this.table.destroyed){
17
+ return Promise.resolve();
18
+ }
19
+
20
+ this.dispatchExternal("dataLoading", data);
21
+
22
+ //parse json data to array
23
+ if (data && (data.indexOf("{") == 0 || data.indexOf("[") == 0)){
24
+ data = JSON.parse(data);
25
+ }
26
+
27
+ if(this.confirm("data-loading", [data, params, config, silent])){
28
+ this.loading = true;
29
+
30
+ if(!silent){
31
+ this.alertLoader();
32
+ }
33
+
34
+ //get params for request
35
+ params = this.chain("data-params", [data, config, silent], params || {}, params || {});
36
+
37
+ params = this.mapParams(params, this.table.options.dataSendParams);
38
+
39
+ var result = this.chain("data-load", [data, params, config, silent], false, Promise.resolve([]));
40
+
41
+ return result.then((response) => {
42
+ if(!this.table.destroyed){
43
+ if(!Array.isArray(response) && typeof response == "object"){
44
+ response = this.mapParams(response, this.objectInvert(this.table.options.dataReceiveParams));
45
+ }
46
+
47
+ var rowData = this.chain("data-loaded", [response], null, response);
48
+
49
+ if(requestNo == this.requestOrder){
50
+ this.clearAlert();
51
+
52
+ if(rowData !== false){
53
+ this.dispatchExternal("dataLoaded", rowData);
54
+ this.table.rowManager.setData(rowData, replace, typeof columnsChanged === "undefined" ? !replace : columnsChanged);
55
+ }
56
+ }else{
57
+ console.warn("Data Load Response Blocked - An active data load request was blocked by an attempt to change table data while the request was being made");
58
+ }
59
+ }else{
60
+ console.warn("Data Load Response Blocked - Table has been destroyed");
61
+ }
62
+ }).catch((error) => {
63
+ console.error("Data Load Error: ", error);
64
+ this.dispatchExternal("dataLoadError", error);
65
+
66
+ if(!silent){
67
+ this.alertError();
68
+ }
69
+
70
+ setTimeout(() => {
71
+ this.clearAlert();
72
+ }, this.table.options.dataLoaderErrorTimeout);
73
+ })
74
+ .finally(() => {
75
+ this.loading = false;
76
+ });
77
+ }else{
78
+ this.dispatchExternal("dataLoaded", data);
79
+
80
+ if(!data){
81
+ data = [];
82
+ }
83
+
84
+ this.table.rowManager.setData(data, replace, typeof columnsChanged === "undefined" ? !replace : columnsChanged);
85
+ return Promise.resolve();
86
+ }
87
+ }
88
+
89
+ mapParams(params, map){
90
+ var output = {};
91
+
92
+ for(let key in params){
93
+ output[map.hasOwnProperty(key) ? map[key] : key] = params[key];
94
+ }
95
+
96
+ return output;
97
+ }
98
+
99
+ objectInvert(obj){
100
+ var output = {};
101
+
102
+ for(let key in obj){
103
+ output[obj[key]] = key;
104
+ }
105
+
106
+ return output;
107
+ }
108
+
109
+ blockActiveLoad(){
110
+ this.requestOrder++;
111
+ }
112
+
113
+ alertLoader(){
114
+ var shouldLoad = typeof this.table.options.dataLoader === "function" ? this.table.options.dataLoader() : this.table.options.dataLoader;
115
+
116
+ if(shouldLoad){
117
+ this.table.alertManager.alert(this.table.options.dataLoaderLoading || this.langText("data|loading"));
118
+ }
119
+ }
120
+
121
+ alertError(){
122
+ this.table.alertManager.alert(this.table.options.dataLoaderError || this.langText("data|error"), "error");
123
+ }
124
+
125
+ clearAlert(){
126
+ this.table.alertManager.clear();
127
+ }
128
+ }
@@ -0,0 +1,82 @@
1
+ import CoreFeature from '../CoreFeature.js';
2
+
3
+ export default class DependencyRegistry extends CoreFeature{
4
+
5
+ constructor(table){
6
+ super(table);
7
+
8
+ this.deps = {};
9
+
10
+ this.props = {
11
+
12
+ };
13
+ }
14
+
15
+ initialize(){
16
+ this.deps = Object.assign({}, this.options("dependencies"));
17
+ }
18
+
19
+ lookup(key, prop, silent){
20
+ if(Array.isArray(key)){
21
+ for (const item of key) {
22
+ var match = this.lookup(item, prop, true);
23
+
24
+ if(match){
25
+ break;
26
+ }
27
+ }
28
+
29
+ if(match){
30
+ return match;
31
+ }else{
32
+ this.error(key);
33
+ }
34
+ }else{
35
+ if(prop){
36
+ return this.lookupProp(key, prop, silent);
37
+ }else{
38
+ return this.lookupKey(key, silent);
39
+ }
40
+ }
41
+ }
42
+
43
+ lookupProp(key, prop, silent){
44
+ var dependency;
45
+
46
+ if(this.props[key] && this.props[key][prop]){
47
+ return this.props[key][prop];
48
+ }else{
49
+ dependency = this.lookupKey(key, silent);
50
+
51
+ if(dependency){
52
+ if(!this.props[key]){
53
+ this.props[key] = {};
54
+ }
55
+
56
+ this.props[key][prop] = dependency[prop] || dependency;
57
+ return this.props[key][prop];
58
+ }
59
+ }
60
+ }
61
+
62
+ lookupKey(key, silent){
63
+ var dependency;
64
+
65
+ if(this.deps[key]){
66
+ dependency = this.deps[key];
67
+ }else if(window[key]){
68
+ this.deps[key] = window[key];
69
+ dependency = this.deps[key];
70
+ }else{
71
+ if(!silent){
72
+ this.error(key);
73
+ }
74
+ }
75
+
76
+ return dependency;
77
+ }
78
+
79
+ error(key){
80
+ console.error("Unable to find dependency", key, "Please check documentation and ensure you have imported the required library into your project");
81
+ }
82
+ }
@@ -0,0 +1,51 @@
1
+ import CoreFeature from '../CoreFeature.js';
2
+
3
+ export default class DeprecationAdvisor extends CoreFeature{
4
+
5
+ constructor(table){
6
+ super(table);
7
+ }
8
+
9
+ _warnUser(){
10
+ if(this.options("debugDeprecation")){
11
+ console.warn(...arguments);
12
+ }
13
+ }
14
+
15
+ check(oldOption, newOption, convert){
16
+ var msg = "";
17
+
18
+ if(typeof this.options(oldOption) !== "undefined"){
19
+ msg = "Deprecated Setup Option - Use of the %c" + oldOption + "%c option is now deprecated";
20
+
21
+ if(newOption){
22
+ msg = msg + ", Please use the %c" + newOption + "%c option instead";
23
+ this._warnUser(msg, 'font-weight: bold;', 'font-weight: normal;', 'font-weight: bold;', 'font-weight: normal;');
24
+
25
+ if(convert){
26
+ this.table.options[newOption] = this.table.options[oldOption];
27
+ }
28
+ }else{
29
+ this._warnUser(msg, 'font-weight: bold;', 'font-weight: normal;');
30
+ }
31
+
32
+ return false;
33
+ }else{
34
+ return true;
35
+ }
36
+ }
37
+
38
+ checkMsg(oldOption, msg){
39
+ if(typeof this.options(oldOption) !== "undefined"){
40
+ this._warnUser("%cDeprecated Setup Option - Use of the %c" + oldOption + " %c option is now deprecated, " + msg, 'font-weight: normal;', 'font-weight: bold;', 'font-weight: normal;');
41
+
42
+ return false;
43
+ }else{
44
+ return true;
45
+ }
46
+ }
47
+
48
+ msg(msg){
49
+ this._warnUser(msg);
50
+ }
51
+ }
@@ -0,0 +1,105 @@
1
+ export default class ExternalEventBus {
2
+
3
+ constructor(table, optionsList, debug){
4
+ this.table = table;
5
+ this.events = {};
6
+ this.optionsList = optionsList || {};
7
+ this.subscriptionNotifiers = {};
8
+
9
+ this.dispatch = debug ? this._debugDispatch.bind(this) : this._dispatch.bind(this);
10
+ this.debug = debug;
11
+ }
12
+
13
+ subscriptionChange(key, callback){
14
+ if(!this.subscriptionNotifiers[key]){
15
+ this.subscriptionNotifiers[key] = [];
16
+ }
17
+
18
+ this.subscriptionNotifiers[key].push(callback);
19
+
20
+ if(this.subscribed(key)){
21
+ this._notifySubscriptionChange(key, true);
22
+ }
23
+ }
24
+
25
+ subscribe(key, callback){
26
+ if(!this.events[key]){
27
+ this.events[key] = [];
28
+ }
29
+
30
+ this.events[key].push(callback);
31
+
32
+ this._notifySubscriptionChange(key, true);
33
+ }
34
+
35
+ unsubscribe(key, callback){
36
+ var index;
37
+
38
+ if(this.events[key]){
39
+ if(callback){
40
+ index = this.events[key].findIndex((item) => {
41
+ return item === callback;
42
+ });
43
+
44
+ if(index > -1){
45
+ this.events[key].splice(index, 1);
46
+ }else{
47
+ console.warn("Cannot remove event, no matching event found:", key, callback);
48
+ return;
49
+ }
50
+ }else{
51
+ delete this.events[key];
52
+ }
53
+ }else{
54
+ console.warn("Cannot remove event, no events set on:", key);
55
+ return;
56
+ }
57
+
58
+ this._notifySubscriptionChange(key, false);
59
+ }
60
+
61
+ subscribed(key){
62
+ return this.events[key] && this.events[key].length;
63
+ }
64
+
65
+ _notifySubscriptionChange(key, subscribed){
66
+ var notifiers = this.subscriptionNotifiers[key];
67
+
68
+ if(notifiers){
69
+ notifiers.forEach((callback)=>{
70
+ callback(subscribed);
71
+ });
72
+ }
73
+ }
74
+
75
+ _dispatch(){
76
+ var args = Array.from(arguments),
77
+ key = args.shift(),
78
+ result;
79
+
80
+ if(this.events[key]){
81
+ this.events[key].forEach((callback, i) => {
82
+ let callResult = callback.apply(this.table, args);
83
+
84
+ if(!i){
85
+ result = callResult;
86
+ }
87
+ });
88
+ }
89
+
90
+ return result;
91
+ }
92
+
93
+ _debugDispatch(){
94
+ var args = Array.from(arguments),
95
+ key = args[0];
96
+
97
+ args[0] = "ExternalEvent:" + args[0];
98
+
99
+ if(this.debug === true || this.debug.includes(key)){
100
+ console.log(...args);
101
+ }
102
+
103
+ return this._dispatch(...arguments);
104
+ }
105
+ }
@@ -0,0 +1,66 @@
1
+ export default class Helpers{
2
+
3
+ static elVisible(el){
4
+ return !(el.offsetWidth <= 0 && el.offsetHeight <= 0);
5
+ }
6
+
7
+ static elOffset(el){
8
+ var box = el.getBoundingClientRect();
9
+
10
+ return {
11
+ top: box.top + window.pageYOffset - document.documentElement.clientTop,
12
+ left: box.left + window.pageXOffset - document.documentElement.clientLeft
13
+ };
14
+ }
15
+
16
+ static retrieveNestedData(separator, field, data){
17
+ var structure = separator ? field.split(separator) : [field],
18
+ length = structure.length,
19
+ output;
20
+
21
+ for(let i = 0; i < length; i++){
22
+
23
+ data = data[structure[i]];
24
+
25
+ output = data;
26
+
27
+ if(!data){
28
+ break;
29
+ }
30
+ }
31
+
32
+ return output;
33
+ }
34
+
35
+ static deepClone(obj, clone, list = []){
36
+ var objectProto = {}.__proto__,
37
+ arrayProto = [].__proto__;
38
+
39
+ if (!clone){
40
+ clone = Object.assign(Array.isArray(obj) ? [] : {}, obj);
41
+ }
42
+
43
+ for(var i in obj) {
44
+ let subject = obj[i],
45
+ match, copy;
46
+
47
+ if(subject != null && typeof subject === "object" && (subject.__proto__ === objectProto || subject.__proto__ === arrayProto)){
48
+ match = list.findIndex((item) => {
49
+ return item.subject === subject;
50
+ });
51
+
52
+ if(match > -1){
53
+ clone[i] = list[match].copy;
54
+ }else{
55
+ copy = Object.assign(Array.isArray(subject) ? [] : {}, subject);
56
+
57
+ list.unshift({subject, copy});
58
+
59
+ clone[i] = this.deepClone(subject, copy, list);
60
+ }
61
+ }
62
+ }
63
+
64
+ return clone;
65
+ }
66
+ }