@limetech/lime-elements 40.14.4 → 40.15.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.
@@ -231,7 +231,7 @@ function pickBy(object, predicate) {
231
231
  });
232
232
  }
233
233
 
234
- /* Tabulator v6.6.1 (c) Oliver Folkerd 2026 */
234
+ /* Tabulator v6.7.1 (c) Oliver Folkerd 2026 */
235
235
  class CoreFeature{
236
236
 
237
237
  constructor(table){
@@ -5861,11 +5861,11 @@ function input(cell, onRendered, success, cancel, editorParams){
5861
5861
 
5862
5862
  function onChange(e){
5863
5863
  if(((cellValue === null || typeof cellValue === "undefined") && input.value !== "") || input.value !== cellValue){
5864
- if(success(input.value)){
5864
+ if(success(input.value, e)){
5865
5865
  cellValue = input.value; //persist value if successfully validated incase editor is used as header filter
5866
5866
  }
5867
5867
  }else {
5868
- cancel();
5868
+ cancel(e);
5869
5869
  }
5870
5870
  }
5871
5871
 
@@ -5878,11 +5878,11 @@ function input(cell, onRendered, success, cancel, editorParams){
5878
5878
  switch(e.key){
5879
5879
  // case "Tab":
5880
5880
  case "Enter":
5881
- onChange();
5881
+ onChange(e);
5882
5882
  break;
5883
5883
 
5884
5884
  case "Escape":
5885
- cancel();
5885
+ cancel(e);
5886
5886
  break;
5887
5887
 
5888
5888
  case "End":
@@ -5946,7 +5946,7 @@ function textarea$1(cell, onRendered, success, cancel, editorParams){
5946
5946
 
5947
5947
  if(((cellValue === null || typeof cellValue === "undefined") && input.value !== "") || input.value !== cellValue){
5948
5948
 
5949
- if(success(input.value)){
5949
+ if(success(input.value, e)){
5950
5950
  cellValue = input.value; //persist value if successfully validated incase editor is used as header filter
5951
5951
  }
5952
5952
 
@@ -5954,7 +5954,7 @@ function textarea$1(cell, onRendered, success, cancel, editorParams){
5954
5954
  cell.getRow().normalizeHeight();
5955
5955
  },300);
5956
5956
  }else {
5957
- cancel();
5957
+ cancel(e);
5958
5958
  }
5959
5959
  }
5960
5960
 
@@ -5982,12 +5982,23 @@ function textarea$1(cell, onRendered, success, cancel, editorParams){
5982
5982
 
5983
5983
  case "Enter":
5984
5984
  if(e.shiftKey && editorParams.shiftEnterSubmit){
5985
- onChange();
5985
+ onChange(e);
5986
+ } else if(
5987
+ (e.shiftKey && editorParams.shiftEnterNewLine)
5988
+ || (e.altKey && editorParams.altEnterNewLine)
5989
+ || (e.ctrlKey && editorParams.ctrlEnterNewLine)
5990
+ || (e.metaKey && editorParams.metaEnterNewLine)
5991
+ ) {
5992
+ e.preventDefault();
5993
+ input.setRangeText("\n", input.selectionStart, input.selectionEnd, "end");
5994
+ } else if (editorParams.enterSubmit){
5995
+ e.preventDefault();
5996
+ onChange(e);
5986
5997
  }
5987
5998
  break;
5988
5999
 
5989
6000
  case "Escape":
5990
- cancel();
6001
+ cancel(e);
5991
6002
  break;
5992
6003
 
5993
6004
  case "ArrowUp":
@@ -6058,7 +6069,7 @@ function number$1(cell, onRendered, success, cancel, editorParams){
6058
6069
  input.value = cellValue;
6059
6070
 
6060
6071
  var blurFunc = function(e){
6061
- onChange();
6072
+ onChange(e);
6062
6073
  };
6063
6074
 
6064
6075
  onRendered(function () {
@@ -6078,7 +6089,7 @@ function number$1(cell, onRendered, success, cancel, editorParams){
6078
6089
  }
6079
6090
  });
6080
6091
 
6081
- function onChange(){
6092
+ function onChange(e){
6082
6093
  var value = input.value;
6083
6094
 
6084
6095
  if(!isNaN(value) && value !==""){
@@ -6086,11 +6097,11 @@ function number$1(cell, onRendered, success, cancel, editorParams){
6086
6097
  }
6087
6098
 
6088
6099
  if(value !== cellValue){
6089
- if(success(value)){
6100
+ if(success(value, e)){
6090
6101
  cellValue = value; //persist value if successfully validated incase editor is used as header filter
6091
6102
  }
6092
6103
  }else {
6093
- cancel();
6104
+ cancel(e);
6094
6105
  }
6095
6106
  }
6096
6107
 
@@ -6099,11 +6110,11 @@ function number$1(cell, onRendered, success, cancel, editorParams){
6099
6110
  switch(e.key){
6100
6111
  case "Enter":
6101
6112
  // case "Tab":
6102
- onChange();
6113
+ onChange(e);
6103
6114
  break;
6104
6115
 
6105
6116
  case "Escape":
6106
- cancel();
6117
+ cancel(e);
6107
6118
  break;
6108
6119
 
6109
6120
  case "ArrowUp":
@@ -6172,7 +6183,7 @@ function range(cell, onRendered, success, cancel, editorParams){
6172
6183
  }
6173
6184
  });
6174
6185
 
6175
- function onChange(){
6186
+ function onChange(e){
6176
6187
  var value = input.value;
6177
6188
 
6178
6189
  if(!isNaN(value) && value !==""){
@@ -6180,17 +6191,17 @@ function range(cell, onRendered, success, cancel, editorParams){
6180
6191
  }
6181
6192
 
6182
6193
  if(value != cellValue){
6183
- if(success(value)){
6194
+ if(success(value, e)){
6184
6195
  cellValue = value; //persist value if successfully validated incase editor is used as header filter
6185
6196
  }
6186
6197
  }else {
6187
- cancel();
6198
+ cancel(e);
6188
6199
  }
6189
6200
  }
6190
6201
 
6191
6202
  //submit new value on blur
6192
6203
  input.addEventListener("blur", function(e){
6193
- onChange();
6204
+ onChange(e);
6194
6205
  });
6195
6206
 
6196
6207
  //submit new value on enter
@@ -6198,11 +6209,11 @@ function range(cell, onRendered, success, cancel, editorParams){
6198
6209
  switch(e.key){
6199
6210
  case "Enter":
6200
6211
  // case "Tab":
6201
- onChange();
6212
+ onChange(e);
6202
6213
  break;
6203
6214
 
6204
6215
  case "Escape":
6205
- cancel();
6216
+ cancel(e);
6206
6217
  break;
6207
6218
  }
6208
6219
  });
@@ -6283,7 +6294,7 @@ function date$1(cell, onRendered, success, cancel, editorParams){
6283
6294
  }
6284
6295
  });
6285
6296
 
6286
- function onChange(){
6297
+ function onChange(e){
6287
6298
  var value = input.value,
6288
6299
  luxDate;
6289
6300
 
@@ -6310,18 +6321,18 @@ function date$1(cell, onRendered, success, cancel, editorParams){
6310
6321
  }
6311
6322
  }
6312
6323
 
6313
- if(success(value)){
6324
+ if(success(value, e)){
6314
6325
  cellValue = input.value; //persist value if successfully validated incase editor is used as header filter
6315
6326
  }
6316
6327
  }else {
6317
- cancel();
6328
+ cancel(e);
6318
6329
  }
6319
6330
  }
6320
6331
 
6321
6332
  //submit new value on blur
6322
6333
  input.addEventListener("blur", function(e) {
6323
6334
  if (e.relatedTarget || e.rangeParent || e.explicitOriginalTarget !== input) {
6324
- onChange(); // only on a "true" blur; not when focusing browser's date/time picker
6335
+ onChange(e); // only on a "true" blur; not when focusing browser's date/time picker
6325
6336
  }
6326
6337
  });
6327
6338
 
@@ -6330,11 +6341,11 @@ function date$1(cell, onRendered, success, cancel, editorParams){
6330
6341
  switch(e.key){
6331
6342
  // case "Tab":
6332
6343
  case "Enter":
6333
- onChange();
6344
+ onChange(e);
6334
6345
  break;
6335
6346
 
6336
6347
  case "Escape":
6337
- cancel();
6348
+ cancel(e);
6338
6349
  break;
6339
6350
 
6340
6351
  case "End":
@@ -6416,7 +6427,7 @@ function time$1(cell, onRendered, success, cancel, editorParams){
6416
6427
  }
6417
6428
  });
6418
6429
 
6419
- function onChange(){
6430
+ function onChange(e){
6420
6431
  var value = input.value,
6421
6432
  luxTime;
6422
6433
 
@@ -6443,18 +6454,18 @@ function time$1(cell, onRendered, success, cancel, editorParams){
6443
6454
  }
6444
6455
  }
6445
6456
 
6446
- if(success(value)){
6457
+ if(success(value, e)){
6447
6458
  cellValue = input.value; //persist value if successfully validated incase editor is used as header filter
6448
6459
  }
6449
6460
  }else {
6450
- cancel();
6461
+ cancel(e);
6451
6462
  }
6452
6463
  }
6453
6464
 
6454
6465
  //submit new value on blur
6455
6466
  input.addEventListener("blur", function(e) {
6456
6467
  if (e.relatedTarget || e.rangeParent || e.explicitOriginalTarget !== input) {
6457
- onChange(); // only on a "true" blur; not when focusing browser's date/time picker
6468
+ onChange(e); // only on a "true" blur; not when focusing browser's date/time picker
6458
6469
  }
6459
6470
  });
6460
6471
 
@@ -6463,11 +6474,11 @@ function time$1(cell, onRendered, success, cancel, editorParams){
6463
6474
  switch(e.key){
6464
6475
  // case "Tab":
6465
6476
  case "Enter":
6466
- onChange();
6477
+ onChange(e);
6467
6478
  break;
6468
6479
 
6469
6480
  case "Escape":
6470
- cancel();
6481
+ cancel(e);
6471
6482
  break;
6472
6483
 
6473
6484
  case "End":
@@ -6548,7 +6559,7 @@ function datetime$2(cell, onRendered, success, cancel, editorParams){
6548
6559
  }
6549
6560
  });
6550
6561
 
6551
- function onChange(){
6562
+ function onChange(e){
6552
6563
  var value = input.value,
6553
6564
  luxDateTime;
6554
6565
 
@@ -6575,18 +6586,18 @@ function datetime$2(cell, onRendered, success, cancel, editorParams){
6575
6586
  }
6576
6587
  }
6577
6588
 
6578
- if(success(value)){
6589
+ if(success(value, e)){
6579
6590
  cellValue = input.value; //persist value if successfully validated incase editor is used as header filter
6580
6591
  }
6581
6592
  }else {
6582
- cancel();
6593
+ cancel(e);
6583
6594
  }
6584
6595
  }
6585
6596
 
6586
6597
  //submit new value on blur
6587
6598
  input.addEventListener("blur", function(e) {
6588
6599
  if (e.relatedTarget || e.rangeParent || e.explicitOriginalTarget !== input) {
6589
- onChange(); // only on a "true" blur; not when focusing browser's date/time picker
6600
+ onChange(e); // only on a "true" blur; not when focusing browser's date/time picker
6590
6601
  }
6591
6602
  });
6592
6603
 
@@ -6595,11 +6606,11 @@ function datetime$2(cell, onRendered, success, cancel, editorParams){
6595
6606
  switch(e.key){
6596
6607
  // case "Tab":
6597
6608
  case "Enter":
6598
- onChange();
6609
+ onChange(e);
6599
6610
  break;
6600
6611
 
6601
6612
  case "Escape":
6602
- cancel();
6613
+ cancel(e);
6603
6614
  break;
6604
6615
 
6605
6616
  case "End":
@@ -6888,7 +6899,7 @@ let Edit$1 = class Edit{
6888
6899
  if(this.popup){
6889
6900
  this.popup.hide();
6890
6901
  }else {
6891
- this._resolveValue(true);
6902
+ this._resolveValue(true, e);
6892
6903
  }
6893
6904
  }
6894
6905
  }
@@ -6914,11 +6925,11 @@ let Edit$1 = class Edit{
6914
6925
  break;
6915
6926
 
6916
6927
  case "Enter":
6917
- this._keyEnter();
6928
+ this._keyEnter(e);
6918
6929
  break;
6919
6930
 
6920
6931
  case "Escape":
6921
- this._keyEsc();
6932
+ this._keyEsc(e);
6922
6933
  break;
6923
6934
 
6924
6935
  case "Home":
@@ -6976,7 +6987,7 @@ let Edit$1 = class Edit{
6976
6987
 
6977
6988
  _keyTab(e){
6978
6989
  if(this.params.autocomplete && this.lastAction === "typing"){
6979
- this._resolveValue(true);
6990
+ this._resolveValue(true, e);
6980
6991
  }else {
6981
6992
  if(this.focusedItem){
6982
6993
  this._chooseItem(this.focusedItem, true);
@@ -7026,20 +7037,20 @@ let Edit$1 = class Edit{
7026
7037
 
7027
7038
  _keyEnter(e){
7028
7039
  if(this.params.autocomplete && this.lastAction === "typing"){
7029
- this._resolveValue(true);
7040
+ this._resolveValue(true, e);
7030
7041
  }else {
7031
7042
  if(this.focusedItem){
7032
7043
  if(this.isFilter && !this.params.multiselect && this.focusedItem.selected){
7033
- this._resolveValue();
7044
+ this._resolveValue(false, e);
7034
7045
  }else {
7035
- this._chooseItem(this.focusedItem);
7046
+ this._chooseItem(this.focusedItem, false, e);
7036
7047
  }
7037
7048
  }
7038
7049
  }
7039
7050
  }
7040
7051
 
7041
7052
  _keyEsc(e){
7042
- this._cancel();
7053
+ this._cancel(e);
7043
7054
  }
7044
7055
 
7045
7056
  _keyHomeEnd(e){
@@ -7585,7 +7596,7 @@ let Edit$1 = class Edit{
7585
7596
  _itemClick(item, e){
7586
7597
  e.stopPropagation();
7587
7598
 
7588
- this._chooseItem(item);
7599
+ this._chooseItem(item, false, e);
7589
7600
  }
7590
7601
 
7591
7602
  _groupClick(item, e){
@@ -7597,9 +7608,9 @@ let Edit$1 = class Edit{
7597
7608
  ////// Current Item Management ///////
7598
7609
  //////////////////////////////////////
7599
7610
 
7600
- _cancel(){
7611
+ _cancel(e){
7601
7612
  this.popup.hide(true);
7602
- this.actions.cancel();
7613
+ this.actions.cancel(e);
7603
7614
  }
7604
7615
 
7605
7616
  _clearChoices(){
@@ -7615,7 +7626,7 @@ let Edit$1 = class Edit{
7615
7626
  this.focusedItem = null;
7616
7627
  }
7617
7628
 
7618
- _chooseItem(item, silent){
7629
+ _chooseItem(item, silent, e){
7619
7630
  var index;
7620
7631
 
7621
7632
  this.typing = false;
@@ -7639,7 +7650,7 @@ let Edit$1 = class Edit{
7639
7650
  if(this.isFilter && !silent && item.selected){
7640
7651
  this._clearChoices();
7641
7652
  this.input.value = "";
7642
- this._resolveValue();
7653
+ this._resolveValue(false, e);
7643
7654
  return;
7644
7655
  }
7645
7656
  this.currentItems = [item];
@@ -7650,14 +7661,14 @@ let Edit$1 = class Edit{
7650
7661
  this._styleItem(item);
7651
7662
 
7652
7663
  if(!silent){
7653
- this._resolveValue();
7664
+ this._resolveValue(false, e);
7654
7665
  }
7655
7666
  }
7656
7667
 
7657
7668
  this._focusItem(item);
7658
7669
  }
7659
7670
 
7660
- _resolveValue(blur){
7671
+ _resolveValue(blur, e){
7661
7672
  var output, initialValue;
7662
7673
 
7663
7674
  if(this.popup){
@@ -7671,7 +7682,7 @@ let Edit$1 = class Edit{
7671
7682
  if(this.params.freetext || (this.params.allowEmpty && this.input.value === "")){
7672
7683
  output = this.input.value;
7673
7684
  }else {
7674
- this.actions.cancel();
7685
+ this.actions.cancel(e);
7675
7686
  return;
7676
7687
  }
7677
7688
  }else {
@@ -7696,7 +7707,7 @@ let Edit$1 = class Edit{
7696
7707
  output = this.params.emptyValue;
7697
7708
  }
7698
7709
 
7699
- this.actions.success(output);
7710
+ this.actions.success(output, e);
7700
7711
 
7701
7712
  if(this.isFilter){
7702
7713
  this.initialValues = output && !Array.isArray(output) ? [output] : output;
@@ -7769,7 +7780,7 @@ function star$1(cell, onRendered, success, cancel, editorParams){
7769
7780
  starHolder.addEventListener("click", function(e){
7770
7781
  e.stopPropagation();
7771
7782
  e.stopImmediatePropagation();
7772
- success(i);
7783
+ success(i, e);
7773
7784
  element.blur();
7774
7785
  });
7775
7786
 
@@ -7828,11 +7839,11 @@ function star$1(cell, onRendered, success, cancel, editorParams){
7828
7839
  });
7829
7840
 
7830
7841
  starsHolder.addEventListener("click", function(e){
7831
- success(0);
7842
+ success(0, e);
7832
7843
  });
7833
7844
 
7834
7845
  element.addEventListener("blur", function(e){
7835
- cancel();
7846
+ cancel(e);
7836
7847
  });
7837
7848
 
7838
7849
  //allow key based navigation
@@ -7847,11 +7858,11 @@ function star$1(cell, onRendered, success, cancel, editorParams){
7847
7858
  break;
7848
7859
 
7849
7860
  case "Enter":
7850
- success(value);
7861
+ success(value, e);
7851
7862
  break;
7852
7863
 
7853
7864
  case "Escape":
7854
- cancel();
7865
+ cancel(e);
7855
7866
  break;
7856
7867
  }
7857
7868
  });
@@ -7871,11 +7882,11 @@ function progress$1(cell, onRendered, success, cancel, editorParams){
7871
7882
  mouseDrag, mouseDragWidth;
7872
7883
 
7873
7884
  //set new value
7874
- function updateValue(){
7885
+ function updateValue(e){
7875
7886
  var style = window.getComputedStyle(element, null);
7876
7887
 
7877
7888
  var calcVal = (percent * Math.round(bar.offsetWidth / ((element.clientWidth - parseInt(style.getPropertyValue("padding-left")) - parseInt(style.getPropertyValue("padding-right")))/100))) + min;
7878
- success(calcVal);
7889
+ success(calcVal, e);
7879
7890
  element.setAttribute("aria-valuenow", calcVal);
7880
7891
  element.setAttribute("aria-label", value);
7881
7892
  }
@@ -7951,7 +7962,7 @@ function progress$1(cell, onRendered, success, cancel, editorParams){
7951
7962
  mouseDrag = false;
7952
7963
  mouseDragWidth = false;
7953
7964
 
7954
- updateValue();
7965
+ updateValue(e);
7955
7966
  }
7956
7967
  });
7957
7968
 
@@ -7970,18 +7981,18 @@ function progress$1(cell, onRendered, success, cancel, editorParams){
7970
7981
 
7971
7982
  case "Tab":
7972
7983
  case "Enter":
7973
- updateValue();
7984
+ updateValue(e);
7974
7985
  break;
7975
7986
 
7976
7987
  case "Escape":
7977
- cancel();
7988
+ cancel(e);
7978
7989
  break;
7979
7990
 
7980
7991
  }
7981
7992
  });
7982
7993
 
7983
- element.addEventListener("blur", function(){
7984
- cancel();
7994
+ element.addEventListener("blur", function(e){
7995
+ cancel(e);
7985
7996
  });
7986
7997
 
7987
7998
  return bar;
@@ -8063,20 +8074,20 @@ function tickCross$1(cell, onRendered, success, cancel, editorParams){
8063
8074
 
8064
8075
  //submit new value on blur
8065
8076
  input.addEventListener("change", function(e){
8066
- success(setValue());
8077
+ success(setValue(), e);
8067
8078
  });
8068
8079
 
8069
8080
  input.addEventListener("blur", function(e){
8070
- success(setValue(true));
8081
+ success(setValue(true), e);
8071
8082
  });
8072
8083
 
8073
8084
  //submit new value on enter
8074
8085
  input.addEventListener("keydown", function(e){
8075
8086
  if(e.key == "Enter"){
8076
- success(setValue());
8087
+ success(setValue(), e);
8077
8088
  }
8078
8089
  if(e.key == "Escape"){
8079
- cancel();
8090
+ cancel(e);
8080
8091
  }
8081
8092
  });
8082
8093
 
@@ -8619,7 +8630,10 @@ class Edit extends Module{
8619
8630
  }
8620
8631
 
8621
8632
 
8622
- clearEditor(cancel){
8633
+ /**
8634
+ * @param {KeyboardEvent|MouseEvent|FocusEvent|Event} [e] editor event that ended the edit
8635
+ */
8636
+ clearEditor(cancel, e){
8623
8637
  var cell = this.currentCell,
8624
8638
  cellEl;
8625
8639
 
@@ -8630,7 +8644,7 @@ class Edit extends Module{
8630
8644
 
8631
8645
  cellEl = cell.getElement();
8632
8646
 
8633
- this.dispatch("edit-editor-clear", cell, cancel);
8647
+ this.dispatch("edit-editor-clear", cell, cancel, e);
8634
8648
 
8635
8649
  cellEl.classList.remove("tabulator-editing");
8636
8650
 
@@ -8648,12 +8662,15 @@ class Edit extends Module{
8648
8662
  }
8649
8663
  }
8650
8664
 
8651
- cancelEdit(){
8665
+ /**
8666
+ * @param {KeyboardEvent|MouseEvent|FocusEvent|Event} [e] editor event that ended the edit
8667
+ */
8668
+ cancelEdit(e){
8652
8669
  if(this.currentCell){
8653
8670
  var cell = this.currentCell;
8654
8671
  var component = this.currentCell.getComponent();
8655
8672
 
8656
- this.clearEditor(true);
8673
+ this.clearEditor(true, e);
8657
8674
  cell.setValueActual(cell.getValue());
8658
8675
  cell.cellRendered();
8659
8676
 
@@ -8812,7 +8829,10 @@ class Edit extends Module{
8812
8829
  }
8813
8830
 
8814
8831
  //handle successful value change
8815
- function success(value){
8832
+ /**
8833
+ * @param {KeyboardEvent|MouseEvent|FocusEvent|Event} [e] editor event that ended the edit
8834
+ */
8835
+ function success(value, e){
8816
8836
  if(self.currentCell === cell && !editFinished){
8817
8837
  var valid = self.chain("edit-success", [cell, value], true, true);
8818
8838
 
@@ -8820,7 +8840,7 @@ class Edit extends Module{
8820
8840
 
8821
8841
  editFinished = true;
8822
8842
 
8823
- self.clearEditor();
8843
+ self.clearEditor(false, e);
8824
8844
 
8825
8845
  if(!cell.modules.edit){
8826
8846
  cell.modules.edit = {};
@@ -8852,11 +8872,14 @@ class Edit extends Module{
8852
8872
  }
8853
8873
 
8854
8874
  //handle aborted edit
8855
- function cancel(){
8875
+ /**
8876
+ * @param {KeyboardEvent|MouseEvent|FocusEvent|Event} [e] editor event that ended the edit
8877
+ */
8878
+ function cancel(e){
8856
8879
  // editFinished = true;
8857
8880
 
8858
8881
  if(self.currentCell === cell && !editFinished){
8859
- self.cancelEdit();
8882
+ self.cancelEdit(e);
8860
8883
  }
8861
8884
  }
8862
8885
 
@@ -8909,6 +8932,8 @@ class Edit extends Module{
8909
8932
  //if editor returned, add to DOM, if false, abort edit
8910
8933
  if(this.currentCell && cellEditor !== false){
8911
8934
  if(cellEditor instanceof Node){
8935
+ this.dispatch("edit-editor-created", cell, cellEditor);
8936
+
8912
8937
  element.classList.add("tabulator-editing");
8913
8938
  cell.row.getElement().classList.add("tabulator-editing");
8914
8939
  cell.table.element.classList.add("tabulator-editing");
@@ -21388,9 +21413,11 @@ class SelectRange extends Module {
21388
21413
  /** @type {Range|false} */
21389
21414
  this.activeRange = false;
21390
21415
  this.blockKeydown = false;
21416
+ this.tabAnchorCol = null;
21391
21417
  this.fillHandle = null;
21392
21418
 
21393
21419
  this.keyDownEvent = this._handleKeyDown.bind(this);
21420
+ this.editKeyDownEvent = this._handleEditKeyDown.bind(this);
21394
21421
  this.mouseUpEvent = this._handleMouseUp.bind(this);
21395
21422
 
21396
21423
  this.registerTableOption("selectableRange", false); //enable selectable range
@@ -21401,6 +21428,7 @@ class SelectRange extends Module {
21401
21428
  this.registerTableOption("selectableRangeAutoFocus", true); //focus on a cell after resetRanges
21402
21429
  this.registerTableOption("selectableRangeInitializeDefault", true); //initializes default range on cell [0,0]
21403
21430
  this.registerTableOption("selectableRangeBlurEditOnNavigate", undefined); //prevent editing on navigation
21431
+ this.registerTableOption("selectableRangeCommitEditOnNavigate", false); //commit instead of cancel the edit when blurred on navigation
21404
21432
  this.registerTableOption("selectableRangeFill", false); //drag the range handle to fill neighbouring cells
21405
21433
 
21406
21434
  this.registerTableFunction("getRangesData", this.getRangesData.bind(this));
@@ -21502,11 +21530,16 @@ class SelectRange extends Module {
21502
21530
  this.subscribe("table-redraw", this.redraw.bind(this));
21503
21531
  this.subscribe("table-destroy", this.tableDestroyed.bind(this));
21504
21532
 
21533
+ this.subscribe("edit-editor-created", this.handleEditorCreated.bind(this));
21505
21534
  this.subscribe("edit-editor-clear", this.finishEditingCell.bind(this));
21506
21535
  this.subscribe("edit-blur", this.restoreFocus.bind(this));
21507
21536
 
21508
- this.subscribe("keybinding-nav-prev", this.keyNavigate.bind(this, "prev"));
21509
- this.subscribe("keybinding-nav-next", this.keyNavigate.bind(this, "next"));
21537
+ // Runs before Edit's own Tab handling, which would open the next cell's
21538
+ // editor first and make Tab move twice
21539
+ this.subscribe("keybinding-nav-prev", this.keyNavigate.bind(this, "prev"), 20);
21540
+ // Runs before Edit moves the editor, which would shift the active range
21541
+ this.subscribe("keybinding-nav-next", this.setTabAnchor.bind(this), 10);
21542
+ this.subscribe("keybinding-nav-next", this.keyNavigate.bind(this, "next"), 20);
21510
21543
  this.subscribe("keybinding-nav-left", this.keyNavigate.bind(this, "left"));
21511
21544
  this.subscribe("keybinding-nav-right", this.keyNavigate.bind(this, "right"));
21512
21545
  this.subscribe("keybinding-nav-up", this.keyNavigate.bind(this, "up"));
@@ -21632,6 +21665,28 @@ class SelectRange extends Module {
21632
21665
  }
21633
21666
  }
21634
21667
  }
21668
+
21669
+ _handleEditKeyDown(e) {
21670
+ if (e.key !== "Enter") {
21671
+ return;
21672
+ }
21673
+
21674
+ if (e.ctrlKey || e.altKey || e.metaKey) {
21675
+ return;
21676
+ }
21677
+
21678
+ if (this.table.modules.edit.checkEditing()) {
21679
+ return;
21680
+ }
21681
+
21682
+ if (e.shiftKey) {
21683
+ this.navigateToTabAnchor("up");
21684
+ } else {
21685
+ this.navigateToTabAnchor("down");
21686
+ }
21687
+
21688
+ e.preventDefault();
21689
+ }
21635
21690
 
21636
21691
  initializeFocus(cell){
21637
21692
  var range;
@@ -21765,11 +21820,15 @@ class SelectRange extends Module {
21765
21820
  this.activeRange.setBounds(cell);
21766
21821
  }
21767
21822
  }
21823
+
21824
+ handleEditorCreated(cell, editor) {
21825
+ editor.addEventListener("keydown", this.editKeyDownEvent);
21826
+ }
21768
21827
 
21769
- finishEditingCell() {
21828
+ finishEditingCell(_cell, _cancel, e) {
21770
21829
  this.blockKeydown = true;
21771
21830
  this.table.rowManager.element.focus();
21772
-
21831
+
21773
21832
  setTimeout(() => {
21774
21833
  this.blockKeydown = false;
21775
21834
  }, 10);
@@ -21785,7 +21844,12 @@ class SelectRange extends Module {
21785
21844
 
21786
21845
  if(isEditing){
21787
21846
  if(dir === 'next' || dir === 'prev'){
21788
- this.dispatch("edit-cancel-cell");
21847
+ if(this.options("selectableRangeCommitEditOnNavigate")){
21848
+ // Moving focus out of the editor commits it, like clicking away
21849
+ this.restoreFocus();
21850
+ }else {
21851
+ this.dispatch("edit-cancel-cell");
21852
+ }
21789
21853
  }else {
21790
21854
  // Prevent navigating while editing except for next/prev
21791
21855
  return false;
@@ -21793,6 +21857,10 @@ class SelectRange extends Module {
21793
21857
  }
21794
21858
  }
21795
21859
 
21860
+ if (dir !== "next") {
21861
+ this.tabAnchorCol = null;
21862
+ }
21863
+
21796
21864
  if (dir === 'prev') {
21797
21865
  dir = 'left';
21798
21866
  } else if (dir === 'next') {
@@ -21804,7 +21872,28 @@ class SelectRange extends Module {
21804
21872
  }
21805
21873
  }
21806
21874
 
21875
+ setTabAnchor(){
21876
+ if (this.tabAnchorCol === null) {
21877
+ this.tabAnchorCol = this.activeRange.start.col;
21878
+ }
21879
+ }
21880
+
21881
+ navigateToTabAnchor(dir){
21882
+ const range = this.activeRange;
21883
+
21884
+ if (this.tabAnchorCol !== null) {
21885
+ range.setStart(range.start.row, this.tabAnchorCol);
21886
+ range.setEnd(range.start.row, this.tabAnchorCol);
21887
+ this.tabAnchorCol = null;
21888
+ this.layoutElement();
21889
+ }
21890
+
21891
+ this.navigate(false, false, dir);
21892
+ }
21893
+
21807
21894
  keyNavigateRange(e, dir, jump, expand){
21895
+ this.tabAnchorCol = null;
21896
+
21808
21897
  if(this.navigate(jump, expand, dir)){
21809
21898
  e.preventDefault();
21810
21899
  }
@@ -22294,6 +22383,7 @@ class SelectRange extends Module {
22294
22383
  }
22295
22384
 
22296
22385
  range = new Range(this.table, this, { start, end });
22386
+ this.tabAnchorCol = null;
22297
22387
 
22298
22388
  this.setActiveRange(range);
22299
22389
  this.ranges.push(range);