tabulator-tables 5.2.6 → 5.2.7

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tabulator-tables",
3
- "version": "5.2.6",
3
+ "version": "5.2.7",
4
4
  "description": "Interactive table generation JavaScript library",
5
5
  "style": "dist/css/tabulator.css",
6
6
  "main": "dist/js/tabulator.js",
@@ -50,6 +50,7 @@ class Tabulator {
50
50
  this.optionsList = new OptionsList(this, "table constructor");
51
51
 
52
52
  this.initialized = false;
53
+ this.destroyed = false;
53
54
 
54
55
  if(this.initializeElement(element)){
55
56
 
@@ -279,6 +280,8 @@ class Tabulator {
279
280
  destroy(){
280
281
  var element = this.element;
281
282
 
283
+ this.destroyed = true;
284
+
282
285
  TableRegistry.deregister(this); //deregister table from inter-device communication
283
286
 
284
287
  this.eventBus.dispatch("table-destroy");
@@ -23,7 +23,13 @@ export default class Popup extends CoreFeature{
23
23
  this.blurEvent = this.hide.bind(this, false);
24
24
  this.escEvent = this._escapeCheck.bind(this);
25
25
 
26
- this.destroyBinding = this.hide.bind(this, true);
26
+ this.destroyBinding = this.tableDestroyed;
27
+ this.destroyed = false;
28
+ }
29
+
30
+ tableDestroyed(){
31
+ this.destroyed = true;
32
+ this.hide(true);
27
33
  }
28
34
 
29
35
  _lookupContainer(){
@@ -107,6 +113,10 @@ export default class Popup extends CoreFeature{
107
113
 
108
114
  show(origin, position){
109
115
  var x, y, parentEl, parentOffset, containerOffset, coords;
116
+
117
+ if(this.destroyed || this.table.destroyed){
118
+ return this;
119
+ }
110
120
 
111
121
  if(origin instanceof HTMLElement){
112
122
  parentEl = origin;
@@ -143,6 +153,10 @@ export default class Popup extends CoreFeature{
143
153
  this.visible = true;
144
154
 
145
155
  this.subscribe("table-destroy", this.destroyBinding);
156
+
157
+ this.element.addEventListener("mousedown", (e) => {
158
+ e.stopPropagation();
159
+ })
146
160
 
147
161
  return this;
148
162
  }
@@ -194,8 +208,10 @@ export default class Popup extends CoreFeature{
194
208
  this.subscribe("cell-editing", this.blurEvent);
195
209
  document.body.addEventListener("click", this.blurEvent);
196
210
  document.body.addEventListener("contextmenu", this.blurEvent);
211
+ document.body.addEventListener("mousedown", this.blurEvent);
197
212
  window.addEventListener("resize", this.blurEvent);
198
213
  document.body.addEventListener("keydown", this.escEvent);
214
+
199
215
  }, 100);
200
216
 
201
217
  this.blurCallback = callback;
@@ -216,6 +232,7 @@ export default class Popup extends CoreFeature{
216
232
  document.body.removeEventListener("keydown", this.escEvent);
217
233
  document.body.removeEventListener("click", this.blurEvent);
218
234
  document.body.removeEventListener("contextmenu", this.blurEvent);
235
+ document.body.removeEventListener("mousedown", this.blurEvent);
219
236
  window.removeEventListener("resize", this.blurEvent);
220
237
  this.table.rowManager.element.removeEventListener("scroll", this.blurEvent);
221
238
  this.unsubscribe("cell-editing", this.blurEvent);
@@ -29,6 +29,8 @@ export default class Edit{
29
29
 
30
30
  this.listIteration = 0;
31
31
 
32
+ this.lastAction="";
33
+
32
34
  this.blurable = true;
33
35
 
34
36
  this.actions = {
@@ -159,7 +161,7 @@ export default class Edit{
159
161
  _initializeParams(params){
160
162
  var valueKeys = ["values", "valuesURL", "valuesLookup"],
161
163
  valueCheck;
162
-
164
+
163
165
  params = Object.assign({}, params);
164
166
 
165
167
  params.verticalNavigation = params.verticalNavigation || "editor";
@@ -168,9 +170,9 @@ export default class Edit{
168
170
  params.filterDelay = typeof params.filterDelay === "undefined" ? 300 : params.filterDelay;
169
171
 
170
172
  params.emptyValue = Object.keys(params).includes("emptyValue") ? params.emptyValue : "";
171
-
173
+
172
174
  valueCheck = Object.keys(params).filter(key => valueKeys.includes(key)).length;
173
-
175
+
174
176
  if(!valueCheck){
175
177
  console.warn("list editor config error - either the values, valuesURL, or valuesLookup option must be set")
176
178
  }else if(valueCheck > 1){
@@ -370,10 +372,12 @@ export default class Edit{
370
372
  }
371
373
 
372
374
  _keyEnter(e){
373
- if(this.focusedItem){
374
- this._chooseItem(this.focusedItem);
375
+ if(this.params.autocomplete && this.lastAction === "typing"){
376
+ this._resolveValue(true);
375
377
  }else{
376
- this._cancel();
378
+ if(this.focusedItem){
379
+ this._chooseItem(this.focusedItem);
380
+ }
377
381
  }
378
382
  }
379
383
 
@@ -402,6 +406,7 @@ export default class Edit{
402
406
 
403
407
  _keyAutoCompLetter(e){
404
408
  this._filter();
409
+ this.lastAction = "typing";
405
410
  this.typing = true;
406
411
  }
407
412
 
@@ -426,6 +431,8 @@ export default class Edit{
426
431
  }
427
432
 
428
433
  _focusItem(item){
434
+ this.lastAction = "focus";
435
+
429
436
  if(this.focusedItem && this.focusedItem.element){
430
437
  this.focusedItem.element.classList.remove("focused");
431
438
  }
@@ -595,6 +602,12 @@ export default class Edit{
595
602
 
596
603
  this._parseListItem(value, data, 0);
597
604
  });
605
+
606
+ if(!this.currentItems.length && this.params.freetext){
607
+ this.input.value = this.initialValues;
608
+ this.typing = true;
609
+ this.lastAction = "typing";
610
+ }
598
611
 
599
612
  this.data = data;
600
613
 
@@ -939,6 +952,8 @@ export default class Edit{
939
952
  }else{
940
953
  this.currentItems = [item];
941
954
  item.selected = true;
955
+
956
+ console.log("choose")
942
957
 
943
958
  this.input.value = item.label;
944
959
 
@@ -166,29 +166,29 @@ $table-cell-padding-sm: 5px;
166
166
 
167
167
  &.thead-dark{
168
168
  .tabulator-header{
169
- border-color: $table-border-color;
170
- background-color: $table-bg;
169
+ border-color: $borderColor;
170
+ background-color: $backgroundColor;
171
171
  color: $table-color;
172
172
 
173
173
  .tabulator-col{
174
- border-color: $table-border-color;
175
- background-color: $table-bg;
174
+ border-color: $borderColor;
175
+ background-color: $backgroundColor;
176
176
  color: $table-color;
177
177
  }
178
178
  }
179
179
  }
180
180
 
181
181
  &.table{
182
- background-color: $table-bg;
182
+ background-color: $backgroundColor;
183
183
 
184
184
  &:not(.thead-light) .tabulator-header{
185
- border-color: $table-border-color;
186
- background-color: $table-bg;
185
+ border-color: $borderColor;
186
+ background-color: $backgroundColor;
187
187
  color: $table-color;
188
188
 
189
189
  .tabulator-col{
190
- border-color: $table-border-color;
191
- background-color: $table-bg;
190
+ border-color: $borderColor;
191
+ background-color: $backgroundColor;
192
192
  color: $table-color;
193
193
  }
194
194
  }
@@ -199,12 +199,12 @@ $table-cell-padding-sm: 5px;
199
199
 
200
200
 
201
201
  .tabulator-row{
202
- border-color: $table-border-color;
203
- background-color: $table-bg;
202
+ border-color: $borderColor;
203
+ background-color: $backgroundColor;
204
204
  color: $table-color;
205
205
 
206
206
  &:hover{
207
- background-color: $table-border-color;
207
+ background-color: $borderColor;
208
208
 
209
209
  .tabulator-cell{
210
210
  background-color: $table-hover-bg;
@@ -217,15 +217,15 @@ $table-cell-padding-sm: 5px;
217
217
  }
218
218
 
219
219
  .tabulator-footer{
220
- border-color: $table-border-color !important;
220
+ border-color: $borderColor !important;
221
221
 
222
222
  .tabulator-calcs-holder{
223
- border-color: $table-border-color !important;
224
- background:$table-bg !important;
223
+ border-color: $borderColor !important;
224
+ background:$backgroundColor !important;
225
225
 
226
226
  .tabulator-row{
227
- border-color: $table-border-color !important;
228
- background-color: $table-bg !important;
227
+ border-color: $borderColor !important;
228
+ background-color: $backgroundColor !important;
229
229
  color: $table-color !important;
230
230
  }
231
231
  }
@@ -692,22 +692,22 @@ $table-cell-padding-x-sm: .25rem !default;
692
692
  $table-cell-vertical-align: top !default;
693
693
 
694
694
  $table-color: $body-color !default;
695
- $table-bg: transparent !default;
695
+ $table-bg: #fff !default;
696
696
  $table-accent-bg: transparent !default;
697
697
 
698
698
  $table-th-font-weight: null !default;
699
699
 
700
700
  $table-striped-color: $table-color !default;
701
701
  $table-striped-bg-factor: .05 !default;
702
- $table-striped-bg: rgba($black, $table-striped-bg-factor) !default;
702
+ $table-striped-bg: $gray-200 !default;
703
703
 
704
704
  $table-active-color: $table-color !default;
705
705
  $table-active-bg-factor: .1 !default;
706
- $table-active-bg: rgba($black, $table-active-bg-factor) !default;
706
+ $table-active-bg: $gray-600 !default;
707
707
 
708
708
  $table-hover-color: $table-color !default;
709
709
  $table-hover-bg-factor: .075 !default;
710
- $table-hover-bg: rgba($black, $table-hover-bg-factor) !default;
710
+ $table-hover-bg: $gray-400 !default;
711
711
 
712
712
  $table-border-factor: .1 !default;
713
713
  $table-border-width: $border-width !default;