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